Formula Bro

Math and physics formulas, explained like you are new.


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.

fs>2fmaxf_s > 2 f_{\max}

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, 10310^{3}

The prefix kilo, written k, means one thousand, which is 10310^{3}, 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 fs>2fmaxf_s > 2 f_{\max} 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, fsf_s and fmaxf_{\max}

A small word or letter written below a symbol is a subscript. In fsf_s, the letter ss stands for sampling, so fsf_s is the sampling rate. In fmaxf_{\max}, 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

SymbolMeaning

fsf_s

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.

fmaxf_{\max}

The highest frequency present in the signal, measured in hertz. For example, a 20 kHz tone has fmax=20f_{\max} = 20 kHz. A signal with several tones uses the top one, not the average, when applying the rule.

22

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

fsf_s

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.

fmaxf_{\max}

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.

2fmax2 f_{\max}

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.

fs>2fmaxf_s > 2 f_{\max}

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 fmaxf_{\max} goes in, and the sampling rate fsf_s is chosen. The theorem says that such a signal can be recovered exactly from its samples when fs>2fmaxf_s > 2 f_{\max}. 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 fmaxf_{\max}. 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 fs=44.1f_s = 44.1 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.

  1. Convert the sampling rate to plain hertz. The prefix kilo means one thousand, so 44.1 kHz=44.1×103=44,10044.1 \text{ kHz} = 44.1 \times 10^{3} = \text{44,100} Hz. That is 44,100 samples every second.
  2. Find the highest frequency the rate can represent. Each cycle needs two samples, so the highest frequency is half the sampling rate: fmax=fs2=44.12=22.05f_{\max} = \frac{f_s}{2} = \frac{44.1}{2} = 22.05 kHz. Any tone above 22.05 kHz cannot be captured correctly.
  3. Check the rule for hearing up to 20 kHz. Human hearing reaches about 20 kHz, so the rule needs a rate more than 2×20=402 \times 20 = 40 kHz. Since 44.1>4044.1 > 40, the rule holds with some room to spare.
  4. 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.
  5. Count the samples in one cycle. One cycle of the 30 kHz tone lasts 130000\frac{1}{30000} of a second, and the CD takes 4410030000=1.47\frac{44100}{30000} = 1.47 samples during each cycle. That is less than two, so the samples cannot show the wave’s shape.
  6. Find the alias. The false frequency is the distance from the tone to the sampling rate: |30−44.1|=14.1|30 - 44.1| = 14.1 kHz. So the 30 kHz tone appears in the recording as a 14.1 kHz tone, which is well inside the range of hearing.
  7. 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

Where you will meet it

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 2fmax2 f_{\max}. 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.

Sources

  1. Nyquist-Shannon sampling theorem, Wikipedia
  2. Aliasing, Wikipedia

| All Computer Science formulas |

Published 2026-10-22. Plain-text copy for AI agents and readers: computer-science/nyquist-sampling-theorem.md.