Nyquist Sampling Theorem
In one sentence: The Nyquist sampling theorem says you must measure a signal more than twice for each cycle of its fastest wave, or the recording comes out distorted.
Read it out loud: “f sub s, the sampling rate, is greater than two times f sub max. Here f sub s is how many samples are taken each second, measured in hertz. The letter s stands for sampling. The f sub max is the highest frequency in the signal, and max stands for maximum.”
Before you start
The ideas and signs this page uses, explained from zero. For powers of ten, Greek letters and other notation in general, see Math basics.
- Frequency, cycles and the hertz (Hz)
A cycle is one full up-and-down swing of a wave. Frequency is the number of cycles per second, and its unit is the hertz, written Hz. One hertz means one cycle per second. A 440 Hz tone, the note A above middle C, makes 440 full cycles every second.
- Powers of ten and the prefix kilo,
The prefix kilo, written k, means one thousand, which is , a power of ten. So 20 kHz is 20,000 Hz, which is 20,000 cycles every second. Human hearing covers roughly the range from 20 Hz to 20,000 Hz, and the rule on this page is about that top end.
- Sampling and samples
Sampling means measuring a signal at regular moments, such as 44,100 times per second. Each single measurement is a sample. Between two samples the value of the signal is unknown, so the question is how close together the samples must be to capture the wave.
- Greater than, , and twice
The sign means ‘greater than’. So says the sampling rate must be bigger than twice the highest frequency. Twice means multiplied by 2. The rule needs a bigger value, not an equal one, which is why the margin matters.
- Subscripts, and
A small word or letter written below a symbol is a subscript. In , the letter stands for sampling, so is the sampling rate. In , the letters stand for maximum, so it is the highest frequency present in the signal.
- Aliasing
Aliasing is the false lower frequency that appears in a recording when a high frequency is sampled too slowly. The high tone does not vanish. It folds down and sounds like a different tone that was never played, which is a distortion that cannot be undone afterward.
What each symbol means
| Symbol | Meaning |
|---|---|
| The sampling rate, the number of samples taken each second, measured in hertz (Hz). For CD audio it is 44.1 kHz, which means 44,100 samples every second. A higher sampling rate can capture higher frequencies. | |
| The highest frequency present in the signal, measured in hertz. For example, a 20 kHz tone has kHz. A signal with several tones uses the top one, not the average, when applying the rule. | |
| A fixed factor, a plain number with no unit. The rule needs the sampling rate to be more than twice the highest frequency, which gives at least two samples for each cycle of the highest tone. |
The formula piece by piece
The sampling rate, the number of samples taken each second. In the CD example it is 44,100 samples every second, so it tells you how many measurements the recorder makes in one second.
The highest frequency that the signal contains, measured in cycles per second. It is the fastest wiggle in the wave, and every other frequency in the signal is lower than it.
Twice the highest frequency. This is the Nyquist rate, the lowest sampling rate that could capture the signal, and the actual rule asks for a rate that is more than this number.
The whole formula in one sentence: the sampling rate must be greater than twice the highest frequency in the signal, so there are at least two measurements for each cycle of the fastest wave.
What the formula is doing, and why
Sampling means measuring a signal at regular times, a fixed number of times per second. Between two samples the value of the signal is unknown. The question is how often you must sample so that the wave can be rebuilt from the measurements. A digital recorder, a camera and a radio receiver all sample their signals this way.
What goes in and what comes out? A signal with a highest frequency goes in, and the sampling rate is chosen. The theorem says that such a signal can be recovered exactly from its samples when . Each cycle of the fastest tone needs at least two samples, one near a peak and one near a trough, to be captured. The output is a list of sample values, and from them the original wave can be rebuilt.
Why twice? A wave goes up and comes down once per cycle. One sample per cycle could land on the same point every time and show nothing changing. Two evenly spaced samples per cycle are enough to tell up from down. If the rule is broken, high frequencies do not vanish. They fold down and appear as a false lower frequency, called aliasing. A 30 kHz tone sampled at 44.1 kHz shows up as a 14.1 kHz tone in the recording.
When does it apply, and how big is the margin? The rule assumes the signal has no frequencies above . That is why an anti-aliasing filter removes frequencies above half the sampling rate before the signal is sampled. The factor of 2 is a minimum, not a target. Real filters cannot cut off sharply, so practical systems sample a little faster. CD audio uses 44.1 kHz, which leaves room above the roughly 20 kHz upper limit of human hearing.
An everyday picture
Think of a strobe light on a spinning fan. If the flashes come too slowly, the blades seem to move slowly, or even backward. Sampling a sound wave too slowly does the same thing to the wave, so a fast sound looks like a slow one in the recording.
Worked example: Sampling a 30 kHz tone on a CD at 44.1 kHz
Compact disc audio uses a sampling rate of kHz, which is 44,100 samples every second. We ask three questions: the highest frequency it can represent, whether it is enough for hearing up to 20 kHz, and what happens to a 30 kHz tone if no filter removes it first.
- Convert the sampling rate to plain hertz. The prefix kilo means one thousand, so Hz. That is 44,100 samples every second.
- Find the highest frequency the rate can represent. Each cycle needs two samples, so the highest frequency is half the sampling rate: kHz. Any tone above 22.05 kHz cannot be captured correctly.
- Check the rule for hearing up to 20 kHz. Human hearing reaches about 20 kHz, so the rule needs a rate more than kHz. Since , the rule holds with some room to spare.
- Pick a tone that is too high. Take a 30 kHz tone. This is above 22.05 kHz, so it breaks the rule. Without a filter, the sampler cannot tell it apart from a lower tone.
- Count the samples in one cycle. One cycle of the 30 kHz tone lasts of a second, and the CD takes samples during each cycle. That is less than two, so the samples cannot show the wave’s shape.
- Find the alias. The false frequency is the distance from the tone to the sampling rate: kHz. So the 30 kHz tone appears in the recording as a 14.1 kHz tone, which is well inside the range of hearing.
- Read the result. The sampling rate can represent frequencies up to 22.05 kHz. A 30 kHz tone above that limit folds down into the audible range as 14.1 kHz, which is why audio is filtered before it is sampled.
Answer: The sampling rate can represent frequencies up to 22.05 kHz. A 30 kHz tone above that limit folds down into the audible range as 14.1 kHz, which is why audio is filtered before it is sampled.
The numbers in this example are recomputed by script every time the site is built.
Common mistakes
- Sampling at exactly the highest frequency. For a 20 kHz top frequency, a rate of 20 kHz is not enough, because the rule needs more than twice that, which is more than 40 kHz.
- Applying the rule to the average frequency instead of the highest frequency present in the signal.
- Confusing sampling rate with bit depth. The sampling rate sets which frequencies can be captured. Bit depth is the number of bits used to store each sample, which sets how precisely its height is measured. CD audio uses 16 bits per sample.
- Skipping the anti-aliasing filter. A fast enough sampling rate does not help if the input still contains frequencies above half the rate.
Where you will meet it
- Digital audio, where CD quality uses 44.1 kHz and many studio formats use 48 kHz.
- Vibration and condition monitoring, where sensors must sample faster than twice the fastest vibration they need to see.
- Software-defined radio and signal processing, where the digitizer’s rate limits which frequencies can be captured.
- Digital video, where frames are taken at a fixed rate, and that rate limits how fast motion can be captured without distortion.
Questions people ask
Why does CD audio use 44.1 kHz and not exactly 40 kHz?
Filters that remove frequencies above half the sampling rate cannot cut off sharply. The gap between 20 kHz and 22.05 kHz gives the filter room to roll off, so it can remove the frequencies that would alias without cutting into what people hear.
Does the theorem apply only to pure sine waves?
No. It applies to any signal with a known highest frequency. Real sounds contain many frequencies, and the highest one sets the required sampling rate.
What happens at exactly twice the highest frequency?
The theorem asks for a rate strictly greater than . At exactly twice, samples of a sine wave can land on its zero crossings and miss its shape, depending on phase, so a margin is needed.
Related formulas
- Shannon-Hartley Theorem: The Shannon-Hartley theorem gives the fastest error-free rate, in bits per second, that a noisy channel can carry, based on its width and how strong the signal is compared with the noise.
- Shannon Entropy: Shannon entropy is one number, measured in bits, that says how unpredictable a source of messages is on average: the more predictable it is, the fewer bits its messages need.
- Data Transfer Time: Data transfer time tells you how long a file takes to send: divide its size by the link’s speed, using units that match.