The **Nyquist sampling theorem** says that a band-limited signal can be recovered from evenly-spaced samples. If the highest frequency component of the signal is *f*_{c} then the function needs to be sampled at a frequency of at least the Nyquist frequency 2*f*_{c}. Or to put it another way, the spacing between samples needs to be no more than than Δ = 1/2*f*_{c}.

If the signal is given by a function *h*(*t*), then the Nyquist-Shannon sampling theorem says we can recover *h*(*t*) by

where sinc(*x*) = sin(π*x*) / π*x*.

In practice, signals may not entirely band-limited, but beyond some frequency *f*_{c} higher frequencies can be ignored. This means that the cutoff frequency *f*_{c} is somewhat fuzzy. As we demonstrate below, it’s much better to err on the side of making the cutoff frequency higher than necessary. Sampling at a little less than the necessary frequency can cause the reconstructed signal to be a poor approximation of the original. That is, the sampling theorem is robust to over-sampling but not to under-sampling. There’s no harm from sampling more frequently than necessary. (No harm as far as the accuracy of the equation above. There may be economic costs, for example, that come from using an unnecessarily high sampling rate.)

Let’s look at the function *h*(*t*) = cos(18πt) + cos(20πt). The bandwidth of this function is 10 Hz, and so the sampling theorem requires that we sample our function at 20 Hz. If we sample at 20.4 Hz, 2% higher than necessary, the reconstruction lines up with the original function so well that the plots of the two functions agree to the thickness of the plotting line.

But if we sample at 19.6 Hz, 2% less than necessary, the reconstruction is not at all accurate due to problems with aliasing.

One rule of thumb is to use the **Engineer’s Nyquist frequency** of 2.5 *f*_{c} which is 25% more than the exact Nyquist frequency. An engineer’s Nyquist frequency is sorta like a baker’s dozen, a conventional safety margin added to a well-known quantity.

**Update**: Here’s a plot of the error, the RMS difference between the signal and its reconstruction, as a function of sampling frequency.

By the way, the function in the example demonstrates beats. The sum of a 9 Hz signal and a 10 Hz signal is a 9.5 Hz signal modulated at 0.5 Hz. More details on beats in this post on AM radio and musical instruments.