Sampling Theorem
Nyquist-Shannon Sampling Theorem and Bandlimited Signals
The Nyquist-Shannon sampling theorem answers a fundamental question: how often do you need to sample a continuous signal to capture all of its information? Without this guarantee, converting analog signals to digital form would be guesswork.
The theorem applies specifically to bandlimited signals, meaning signals whose frequency content doesn't extend beyond some maximum frequency. That maximum frequency component is called the bandwidth. Any signal with energy above that limit is considered non-bandlimited, and the theorem's guarantees no longer hold cleanly.
Some real-world examples of approximately bandlimited signals:
- Audio signals occupy roughly 20 Hz to 20 kHz (the range of human hearing)
- Standard-definition video signals have bandwidth around 4.2 MHz
Sampling Rate and Nyquist Frequency
The sampling rate is the number of samples taken per second when converting a continuous-time signal to discrete time, measured in hertz (Hz). A higher sampling rate captures more detail about the original signal.
The Nyquist frequency is defined as half the sampling rate:
This represents the highest frequency that can be accurately represented in the sampled signal. Any frequency content above will not be captured correctly.
The theorem states that to perfectly reconstruct a bandlimited signal with bandwidth , you need:
This minimum value is called the Nyquist rate. Think of it this way: you need at least two samples per cycle of the highest frequency present. One sample alone can't tell you whether a wave is going up or down, so two per period is the bare minimum to track the oscillation.

Aliasing and Undersampling
Aliasing
Aliasing occurs when you sample below the Nyquist rate. Frequency components above don't just disappear; they "fold back" into the spectrum below , masquerading as lower frequencies. The result is distortion that you can't undo after the fact, because the aliased components become indistinguishable from real low-frequency content.
Mathematically, a frequency that's above the Nyquist frequency appears in the sampled signal as a mirror image reflected across . For example, if kHz (so kHz) and the signal contains a 5 kHz tone, that tone shows up as a 3 kHz tone in the sampled data (it folds back by kHz from the Nyquist frequency, landing at kHz).
You've likely seen aliasing without realizing it:
- Wagon wheel effect in video: wheel spokes appear to rotate backwards because the frame rate undersamples the rotation frequency
- Stroboscopic effect in audio: a high-pitched tone, when undersampled, sounds like a completely different lower-pitched tone

Undersampling and the Frequency Spectrum
Undersampling simply means sampling below the Nyquist rate. It causes the copies of the signal's spectrum (which repeat at multiples of ) to overlap. This spectral overlap is exactly what aliasing looks like in the frequency domain: high-frequency components fold on top of low-frequency components, and you can no longer separate them.
To prevent aliasing, you have two tools:
- Choose a high enough sampling rate so that exceeds the signal's maximum frequency
- Apply a low-pass filter before sampling (called an anti-aliasing filter) to remove any frequency content above
In practice, you almost always use both.
Oversampling and Filtering
Oversampling
Oversampling means sampling at a rate significantly higher than the Nyquist rate. This gives you more headroom and several practical benefits:
- The sampled signal more accurately represents the original continuous signal
- Quantization noise gets spread across a wider frequency band, improving the signal-to-noise ratio (SNR)
- The anti-aliasing filter design becomes much easier (more on this below)
A familiar example: audio CDs sample at 44.1 kHz. Since human hearing tops out at about 20 kHz, the Nyquist rate is 40 kHz. The extra 4.1 kHz of margin is deliberate oversampling that gives the anti-aliasing filter room to roll off gradually rather than needing a perfectly sharp cutoff at 20 kHz. Sigma-delta analog-to-digital converters (ADCs) take this even further, oversampling by large factors to achieve high resolution.
Anti-Aliasing Filter
An anti-aliasing filter is a low-pass filter placed before the sampler. Its job is to remove (or at least heavily attenuate) any frequency content above so that aliasing doesn't occur.
An ideal anti-aliasing filter would have a perfectly sharp cutoff right at , passing everything below and blocking everything above. In reality, every filter has a transition band where it gradually rolls off, so some small amount of energy above may leak through.
This is where oversampling helps: the gap between the signal's highest frequency and gets wider, so the filter's transition band can be more gradual. A gentler rolloff is far easier and cheaper to build in hardware.
Common implementations include:
- Analog RC or active filters placed before the ADC
- Digital FIR filters used in multi-stage conversion systems where initial oversampling is followed by decimation