A sonata is a composition usually for a solo instrument, most commonly the piano or other keyboard instrument, that typically consists of three independent or four movements, often each with a different key, tempo and mood.
A common pattern for four-movement sonatas is a lively first movement that utilizes sonata form, followed by a slower, contrasting second movement, a light, dance-like third movement, and a faster fourth movement that returns to themes from previous movements.
The term "sonata" originated in the mid-sixteenth century refering to pieces that were played on instruments rather than sung, but later came to be associated with the specific multi-movement forms that evolved substantially through the Baroque, Classical and Romantic eras. Works named "sonata" continue to be composed, but while many still adhere to the traditional structure, others use this term more loosely and experiment with fewer movements or even completely new forms.