Improvisation is the creation of spontaneous music.
Improvisation is often considered an act of instantaneous composition by composers,
where compositional techniques are employed with or without preparation.
Music theory encompasses the nature and mechanics of music.
It often involves identifying patterns that govern composers' techniques.
In a more detailed sense, music theory (in the western system) also
distills and analyzes the elements of music – rhythm, harmony (harmonic function),
melody, structure, and texture.
People who study these properties are known as music theorists.