Here is a useful trigonometric identity:
A more convenient formulation is
For example, suppose we have two frequencies that are close together: one at 20 Hz and the other 2 Hz higher (so 22 Hz). According to the above formula, with and :
Think of this as
The blue graph below is . The red graph is . (The dotted curve is just .)
Therefore, in addition to the 21 Hz tone (the average of the two frequencies, 22 Hz and 20 Hz), there will be a perceptible beat every half-second—in other words, a 2 Hz beat.
That last fact needs a little explanation. The function has a frequency of 1 Hz, so why are the beats heard at 2 Hz? If you look at the graph above, you can see that the 21 Hz wave "fills up" both halves of the cosine graph, so it repeats every half-cycle of the cosine graph.
The net effect is that the beats are heard at the freuency , and here, .