Suppose you have a sine wave with frequency f0 Hz.
We’re going to discretize this signal by sampling it fs times per second. That is, we’re going to evaluate S at integer multiples of
The result is the sequence
where n runs through the integers.
Next, let k be an integer and consider the sine wave
(Foreshadowing: A is for “alias.”)
Now let’s sample A at the same frequency as S, i.e. fs Hz. This gives us the sequence
A short derivation shows
which is exactly what we got from sampling S.
To recap, sampling a signal of f0 Hz at a rate of fs Hz produces the same samples as sampling a signal of f0 + kfs Hz at the same rate for any integer k.
So, for example, if we’re sampling signals at 1000 samples per second, then we’ll get the same samples whether we’re sampling a signal of 440 Hz or 1440 Hz or 2440 Hz etc.
Periodic sampling cannot distinguish frequency components that differ by an integer multiple of the sampling frequency.
If a signal has components at 440 Hz and at 1440 Hz, and we sample at 1000 Hz, all the information from the higher frequency component is aliased, added to the samples of the 440 Hz component.
If a signal contains frequencies between –B and B, you can avoid aliasing by sampling at a rate higher than 2B. In practice this may mean that your signal has frequency components outside the interval [-B, B] but these components are small enough to ignore.
A good rule of thumb is to sample at a frequency of at least 2.5B and not just the theoretical minimum of 2B. For more on this, see The Engineer’s Nyquist frequency.
Of course, aliasing can occur when sampling in spatial dimensions as well as in time:
https://xkcd.com/1814/
(hat tip to Dean Martin)