Here's how it works:
* Compression: The wave compresses the particles in the medium, causing them to move closer together.
* Rarefaction: The wave then expands the particles, causing them to move further apart.
The particles oscillate back and forth around their equilibrium positions, transferring energy through the medium without the particles themselves traveling long distances. This is why sound waves, which are compression waves, can travel through air even though the air molecules themselves don't travel from the source to your ear.