A scherzo (plural scherzi) is a name given to a piece of music or a movement from a larger pieces such as a symphony. The word literally means "joke" in Italian. Sometimes the word scherzando is used in musical notation to indicate that a passage should be played in a humourous way.
The scherzo developed from the minuet, and gradually came to replace it as the third (or sometimes second) movement in symphonies, string quartets, sonatas and similar works. It typically retains the 3/4 time signature and ternary form of the minuet, but is considerably quicker. It is often, but not always, of a light-hearted nature. A few examples of scherzi exist which are not in the normal 3/4 time, such as in Beethoven's Piano Sonata No. 18.
Joseph Haydn wrote minuets which are very close to scherzi in tone, but it was Ludwig van Beethoven and Franz Schubert who first used the form widely, with Beethoven in particular turning the polite rhythm of the minuet into a much more intense, and sometimes even savage dance.
The scherzo remained a standard movement in the symphony and related forms right through the 19th century, and composers also began to write scherzi as pieces in themselves, with Frederic Chopin writing four quite well known ones for the piano.
An unrelated use of the word in music is in light-hearted madrigalss of the renaissance period, which were often called scherzi musicali. Claudio Monteverdi, for example, wrote two sets of works with this title, the first in 1607, the second in 1632.