Articles & BlogBy Trapper W. Brown10 min read
Every digital recording starts with a small act of faith. A microphone produces a smooth, continuous wave. A computer cannot store a smooth wave. It can only store numbers. So the recorder measures the wave at regular moments, writes down each measurement and throws away everything in between. The Nyquist theorem, also called the Nyquist-Shannon sampling theorem, says when that is safe: if you measure often enough, the gaps contain nothing you cannot rebuild, and the original wave can be recovered exactly.
Why should you care? Because the rule sits underneath nearly everything digital that began as something in the real world: music, phone calls, photographs, video, a heart monitor, the thermometer on a smart thermostat. It explains why a CD uses the odd number 44,100, why old telephone calls sound thin, why a striped shirt shimmers on television and why wagon wheels in old Westerns sometimes roll backward.
On film, spoked wheels like these can seem to stand still or roll backward, the best-known everyday picture of aliasing. Photo by Hannah Schwalbe, National Park Service, public domain, via Wikimedia Commons.
What is sampling?
Sampling means measuring something that changes continuously at evenly spaced moments. Each measurement is a sample. The number of samples taken per second is the sampling rate, written in hertz (Hz), the same unit used for frequency. A thousand hertz is a kilohertz (kHz).
A film camera samples: it records still pictures, one after another, and your eye fills in the movement. A nurse who takes a patient's temperature every four hours is sampling.
Sound is the classic case. A sound is air pressure wobbling up and down, and the speed of the wobble is its frequency. A low note wobbles slowly, a high note quickly. A recorder samples the pressure tens of thousands of times a second and stores each reading as a number. To play it back, a converter turns the numbers into a smooth voltage again and sends it to a speaker.
The question the theorem answers is the obvious one: how often is often enough?
Why more than twice the highest frequency?
The whole theorem fits in one line:
sampling rate > 2 × highest frequency in the signal
Half the sampling rate has a name, the Nyquist frequency. Anything below it can be captured. Anything at or above it cannot.
Here is the reasoning without the mathematics. One cycle of a wave goes up once and down once. To know that it did both, you need at least one sample while it is high and one while it is low. That is two samples per cycle, as a bare minimum. Fewer than that and whole swings of the wave pass between your measurements unseen.
Why "more than" twice, and not exactly twice? Because exactly two samples per cycle can go wrong. Picture a wave sampled twice per cycle, with both samples landing at the instants it crosses zero. Every reading says zero. You have recorded silence from a sound that was plainly there. Sample a little faster than twice per cycle and the sample points drift along the wave, so they cannot hide in the same spot forever.
The surprising half of the theorem is the promise it makes in return. If the signal truly contains nothing above the limit, the samples pin it down completely, with no approximation involved. There is exactly one smooth wave, with no frequencies above the limit, that passes through all the sample points, and it is the original.
What happens if you sample too slowly?
The result is worse than a blurry version of the truth. It is a confident, clean lie. A frequency that is too high for the sampling rate does not vanish. It shows up disguised as a lower frequency that was never there. This is called aliasing, because the high frequency is traveling under a false name.
Sample often enough and the dots can only mean one wave. Sample too slowly and they describe a slower wave that does not exist.
In the lower graph, eight cycles of the real wave are sampled at only seven steps. The samples trace one slow cycle: eight minus seven. The same arithmetic works with real numbers. Sample a 7,000 Hz tone at 8,000 samples per second and what comes out is a 1,000 Hz tone. Nothing in the recording tells you it is false.
The everyday picture is the wagon wheel. The standard projection rate for motion picture film is 24 frames per second, so a film camera is a sampler running at 24 Hz. Take a wheel with 16 identical spokes. It looks the same every sixteenth of a turn. Suppose it spins at one and a half turns per second. That is 1.5 × 16 = 24 spokes passing the top each second, exactly one spoke per frame. In every frame, each spoke has moved precisely into the place of the one ahead of it. On screen the wheel stands still while the wagon races along.
Now slow the wagon a little. Each spoke falls just short of the next position by the time the shutter opens again. Your eye, connecting the nearest spokes from frame to frame, sees the wheel creeping backward. By the theorem, a 24 frame camera can only follow spoke motion faithfully below 12 spokes per second, which for this wheel is three quarters of a turn per second. Any faster and the film shows an alias.
Watch out
Aliasing cannot be repaired afterward. Once a false frequency is in the samples, it looks exactly like a real one. The only cure is to remove the too-high frequencies before sampling, or to sample faster.
That is why every well-made recorder puts a filter ahead of the sampler. It is called an anti-aliasing filter, and its one job is to strip out anything above the Nyquist frequency before the measuring starts.
Why do CDs use 44.1 kHz and phones 8 kHz?
Both numbers come straight from the rule. They differ because the two systems were built for different jobs.
| Compact disc | Classic telephone call | |
|---|---|---|
| Goal | Everything a person can hear | Speech that can be understood |
| Sampling rate | 44,100 per second | 8,000 per second |
| Highest frequency it can hold | Just under 22,050 Hz | Just under 4,000 Hz |
| Bits per sample | 16 | 8 |
The CD. A young person with normal hearing can hear from about 20 Hz to about 20,000 Hz, according to the U.S. Occupational Safety and Health Administration's technical manual, and the top of that range drops with age. Twice 20,000 is 40,000, so a system meant to capture all of it must sample faster than 40 kHz. The CD format samples at 44.1 kHz with 16 bits per sample. That puts the Nyquist frequency at 22,050 Hz and leaves a gap of 2,050 Hz above the edge of hearing. The gap is there for the anti-aliasing filter. No real filter can pass 20,000 Hz untouched and block 20,001 Hz completely. It needs some room to slope down, and the extra 4.1 kHz of sampling rate buys that room.
The phone. The international standard for digital telephone audio, ITU-T Recommendation G.711, calls for 8,000 samples per second with eight bits each. That is 64,000 bits per second for one call, and a ceiling just under 4,000 Hz. Speech stays understandable in that range, but music and the crispness of a voice do not survive, which is the familiar "telephone sound." The engineers were not careless. Every call had to fit in a small, fixed slice of a shared line, and halving the sampling rate halves the data that has to be carried. Many newer calling systems sample faster, which is why a call over an app can sound so much fuller than one over an old landline.
What does it mean for photos and sensors?
A camera sensor samples too, across space instead of time. Its pixels are the sample points, and "frequency" becomes how finely a pattern repeats: the weave of a shirt, the bricks of a distant wall, the slats of a fence.
The rule carries over unchanged. To record a pattern of light and dark stripes, the sensor needs more than two pixels for every stripe pair. A sensor 6,000 pixels wide can therefore hold at most 3,000 pairs of light and dark lines across the frame. Aim it at something finer and you get the spatial version of the wagon wheel: broad wavy bands and false colors that are not on the object, known as moiré. It is why people who appear on television are told to avoid finely striped shirts.
Camera makers fight it the same way audio engineers do. Many cameras put a thin filter over the sensor that blurs the image very slightly before the pixels sample it, an anti-aliasing filter made of glass. Others rely on packing in so many pixels that few real scenes exceed the limit.
The slow-moving version catches people who log data. Say a heater makes a room's temperature rise and fall once every 50 minutes, and a logger records the temperature once an hour. That is far fewer than two samples per cycle. The log will show a gentle swing that repeats every five hours. (The sum: 1/50 minus 1/60 is 1/300, one cycle per 300 minutes.) Someone will go looking for a five-hour cause that does not exist.
Who were Nyquist and Shannon?
The theorem carries two names because it arrived in stages.
In April 1928, Harry Nyquist published "Certain Topics in Telegraph Transmission Theory" in the Transactions of the American Institute of Electrical Engineers. He was working on telegraphy: how fast signals could be sent through a channel that passes only a limited band of frequencies.
In January 1949, Claude Shannon published "Communication in the Presence of Noise" in the Proceedings of the Institute of Radio Engineers. Its first theorem states the rule in the form used today: a signal containing no frequencies higher than W cycles per second is completely determined by its values at points spaced 1/(2W) seconds apart. Shannon did not claim to have discovered it. He called it "a fact which is common knowledge in the communication art," noted that mathematicians had given it earlier in other forms, credited Nyquist for showing the importance of that time spacing in telegraphy and named the spacing the Nyquist interval.
So the idea has several parents. What Shannon added was a clear statement and a proof.
Common misreadings
"Twice the frequency is enough." The rule is more than twice, for the zero-crossing reason above. Real systems leave a margin on top of that.
"Digital audio is a staircase, so a higher rate is smoother." The stored samples are points, and the playback converter rebuilds the one smooth wave that fits them. A higher sampling rate does not fill in missing detail below the limit, because nothing is missing there. What it does is raise the limit.
"44.1 kHz captures everything." It captures everything below 22,050 Hz, and only if everything above that was filtered out first. The theorem has a condition, and the condition matters as much as the conclusion.
"I only need twice the frequency I care about." The rule is about the highest frequency that is present, wanted or not. An unwanted high tone will alias down on top of the part you do care about unless it is filtered out.
"Sampling rate and bit depth are the same thing." They are separate. The sampling rate sets how high a frequency can be stored. The bit depth (16 bits on a CD, 8 on a classic phone call) sets how finely each sample's height is written down, which governs background noise.
What to remember
- Sampling means measuring a changing thing at regular moments and keeping only the measurements.
- Sample at more than twice the highest frequency present and the original can be rebuilt exactly.
- Sample too slowly and high frequencies reappear as false low ones. That is aliasing, and it cannot be undone afterward.
- Filter first, then sample. The filter is why practical rates sit a little above the bare minimum.
- 44.1 kHz covers human hearing with room for the filter. 8 kHz covers speech and little else.
- Pixels are samples too. Moiré on a striped shirt and a backward wagon wheel are the same effect.
For a quick look at the effect, watch a ceiling fan or a car's wheels in any video and look for the moment the spokes seem to stop. The article "Optical Audio: How TOSLINK Sends Sound as Light" in this set picks up where this one ends, with what happens to the samples once they leave the player.


