Intuition first
Aliasing is false, lower-frequency content that appears when a signal is sampled too slowly. In films, a fast-spinning wheel can look as if it turns slowly or even backwards. The camera takes snapshots at a fixed rate, and between two snapshots the wheel moves alm ost a full turn, so the pictures are consistent with a much slower motion. Sampling a signal works the same way: if you take samples too rarely, a fast oscillation produces exactly the same samples as a slower one. The slower one is called an alias, and the effect is aliasing.
Once the samples are taken, nothing can tell the two signals apart. That is why aliasing has to be prevented before sampling. It cannot be removed afterwards.
The math
Sampling a continuous signal \(x(t)\) every \(T = 1/f_s\) seconds gives the sequence
For a cosine of frequency \(f\), the samples are \(\cos(2\pi f n / f_s)\). Because cosine repeats every \(2\pi\), adding any whole multiple of \(f_s\) to \(f\) gives identical samples:
So every real tone shows up somewhere between 0 and \(f_s/2\). The frequency you observe is
This gives the sampling theorem (Nyquist–Shannon): a signal whose highest frequency is \(f_{\max}\) can be represented without aliasing only if
Half the sample rate, \(f_s/2\), is called the Nyquist frequency. Every component above it folds back into the range 0 … \(f_s/2\).
Worked example
- A 30 Hz tone is sampled at \(f_s\) = 40 Hz. The Nyquist frequency is 20 Hz, so the tone is too high.
- \(k = \operatorname{round}(30/40) = 1\), so \(f_{\text{alias}} = |30 - 40| = 10\) Hz.
- The samples are therefore identical to those of a 10 Hz tone, as the plot below shows.

A second example: a 700 Hz tone sampled at 1,000 Hz. Here \(k = 1\) and \(f_{\text{alias}} = |700 - 1000| = 300\) Hz, which is where an FFT will put the peak.
Python code
Both examples, with NumPy. Each snippet was run with Python 3, NumPy 2.5 and Matplotlib 3.11; the output shown is the real output. The plotting lines are left out for brevity.
import numpy as np
fs = 40.0 # sample rate (Hz); Nyquist frequency = 20 Hz
f = 30.0 # tone frequency (Hz), above fs/2
tn = np.arange(0, 0.25 + 1e-9, 1 / fs) # sampling instants (0.25 s)
x_samp = np.cos(2 * np.pi * f * tn)
f_alias = abs(f - fs * round(f / fs)) # fold into 0 ... fs/2
print(f"Nyquist frequency: {fs / 2:.1f} Hz")
print(f"Alias frequency: {f_alias:.1f} Hz")
print("Samples identical to the alias tone:",
np.allclose(x_samp, np.cos(2 * np.pi * f_alias * tn)))
Nyquist frequency: 20.0 Hz
Alias frequency: 10.0 Hz
Samples identical to the alias tone: Trueimport numpy as np
fs, N = 1000, 1000
n = np.arange(N)
x = np.sin(2 * np.pi * 700 * n / fs) # 700 Hz, above fs/2 = 500 Hz
X = np.abs(np.fft.rfft(x)) / (N / 2) # single-sided amplitude spectrum
freqs = np.fft.rfftfreq(N, d=1 / fs)
print(f"FFT peak at {freqs[np.argmax(X)]:.0f} Hz (amplitude {X.max():.2f})")
FFT peak at 300 Hz (amplitude 1.00)
Try it yourself
Move the sliders: as soon as the tone frequency reaches half the sample rate, the dashed alias appears.
original tone samples alias the samples also fit
How to prevent aliasing
- Low-pass filter before the ADC. An analog anti-aliasing filter removes energy above \(f_s/2\) before sampling. Real filters need a transition band, which is why audio uses 44.1 kHz or 48 kHz for a 20 kHz bandwidth rather than exactly 40 kHz.
- Sample faster (oversampling). A higher \(f_s\) pushes the Nyquist frequency up and relaxes the filter.
- Filter before downsampling. Reducing the sample rate in software (decimation) can alias too; apply a digital low-pass filter first (for example
scipy.signal.decimate).
Common mistakes
Quiz
FAQ
What is the Nyquist frequency?
Half the sample rate, fs/2. It is the highest frequency a sampled signal can represent without aliasing.
Is aliasing the same as the wagon-wheel effect?
Yes, it is the same phenomenon in time instead of rotation: periodic snapshots make a fast motion look like a slower one.
Why do CDs use 44.1 kHz?
Human hearing reaches about 20 kHz, so the rate must exceed 40 kHz; the extra margin leaves room for a practical anti-aliasing filter.
References
- A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Pearson, 2010: Chapter 4, “Sampling of Continuous-Time Signals”.
- R. G. Lyons, Understanding Digital Signal Processing, 3rd ed., Prentice Hall, 2010: Chapter 2, “Periodic Sampling”.
- S. W. Smith, The Scientist and Engineer’s Guide to Digital Signal Processing: Chapter 3, “ADC and DAC”.
- NumPy documentation: numpy.fft.rfft.
Try it yourself
This lesson comes with a matching demo: pick a tone, drop the sample rate below Nyquist, and watch the folded alias appear exactly where the math in this lesson predicts. Open the Aliasing and Nyquist Demo.
Keep going in order: the Beginner DSP learning path shows what to learn next.