Sound waves in fluids (liquids and gases) are examples of the longitudinal wave. When a longitudinal wave travels through a medium, it produces compressions and rarefactions.
In the case of a spiral spring, whose one end is tied to a hook of a wall and the other end is moved forward and backwards, the coils of the spring vibrate about their original position along the length of the spring and longitudinal waves propagate through the spring (Figure).
The regions where the coils are closer are said to be in the state of compression, while the regions where the coils are farther are said to be in the state of rarefaction.
When we strike a tuning fork on a rubber pad, the prongs of the tuning fork begin to vibrate to and fro about their mean positions. When the prong A moves outwards to A1, it compresses the layer of air in its neighbourhood. As the compressed layer moves forward it compresses the next layer and a wave of compression passes through the air. But when the prong moves inwards to A2, the particles of the medium which moved to the right now move backwards to the left due to the elasticity of air. This gives rise to rarefaction. Thus a longitudinal wave is characterized by the formation of compressions and rarefactions following each other. Longitudinal waves can be produced in all types of material medium.
Fig: Longitudinal wave