Superposition of waves: If two waves cross through a particle of a medium simultaneously, then each wave will displace that particle. As a result, there will be a resultant displacement of the particle. This resultant displacement will be equal to the sum of individual displacement by the two waves. This is called the superposition of waves.
The principle of superposition may be applied to waves whenever two (or more) waves traveling through the same medium at the same time. The waves pass through each other without being disturbed.
Suppose two waves pass through a particle of a medium. Let the separate displacement of the particle by individual wave be y1 and y2. If the two waves are incident with the same phase, then the resultant displacement of the particle, y = y1 + y2.
On the other hand, if these two waves are incident on the particle in opposite phase, then the resultant displacement, y = y1 ~ y2.
Finally, when two waves having slightly varying frequencies travel with the same speed along the same direction in a specific medium, they superpose to produce beats.