We saw earlier that when two waves are in phase they reinforce each other and when they are out of phase they tend to cancel each other out. When two waves that have nearly but not exactly the same frequency combine they might start off reinforcing each other, but as time passes the difference in frequency means that they start to cancel, and then later still they reinforce each other again.
This is exactly what is happening in the graph above. It shows the combination of a 50Hz tone and a 55Hz tone. It was made by mixing two pure tones in the free audio software 'Audacity'. The image shows about 3/4 of a second of audio. In a second the overall amplitude reaches a maximum five times. Listening to the combination one hears a single tone halfway between 50 and 55 Hz that appears to vary in loudness five times a second, i.e. at 5Hz. You don't hear two separate tones one at 50Hz and one at 55Hz.
The 5Hz tone is called a beat frequency.
Here is a button that will play a beat frequency sound made by combining two higher frequency sounds, a 220Hz tone and a 222Hz tone.
The MathEdit
Mathematically we have added two sounds with frequencies that are quite close, but the net result seems to be a multiplication of two sounds with quite different frequencies. What are those frequencies? One is the average, that is 52.5Hz. The other appears at first glance to be the difference, i.e. 5Hz, but actually it is half that because a 5Hz sine wave would reach its maximum size (ignoring whether it is positive or negative) ten times in a second.
So, one frequency is half the difference and one frequency the average. We can understand how a sum of two sines becomes a product (of sine and cosine) mathematically using the addition formulae for sines.
The individual waves we're adding are:


and 
to give us frequencies of 50Hz and 55Hz. Because we are looking for average and half the difference frequencies we can put
and then reexpress and in terms of these two new variables.
So now we have:
Don't continue reading this page until you've checked that these two formulas follows from the addition formula for sines! Reading this page without checking the steps doesn't help you get better at using the maths.
So we can now combine these two formulas and get:
that is:
We've expressed the sum of two sine waves in terms of a product of sine and cosine. As expected, the frequency of the sine wave is the average of the frequencies of the two waves being combined, while the frequency of the cosine wave is half the difference of the frequencies.