DSP from Scratch · Lesson 3
Why Wheels Spin Backwards on Video: Spectrum, Aliasing and Nyquist
Why a computer, like a camera, can be fooled by a fast wave, and the one rule that stops it.

Press play: it starts at
Chapters18 parts, tap one to jump there
In one sentence
Measure at more than twice the highest frequency, or the dots will lie.
Watch first, then read. The video shows every idea moving. These notes write out each step so you can check the maths at your own pace. Press any ▶ time button to jump the video to that moment.
Have you ever watched a video of a moving car and noticed the wheels spinning backwards? The car is clearly going forwards. So what is going on?
A camera does not film smoothly. It takes separate pictures, about thirty every second. If the wheel turns almost a full circle between two pictures, it looks as if it moved back a little.
A computer measuring a signal can be fooled in exactly the same way: a fast wave can disguise itself as a slow one. That is called aliasing, and by the end of this lesson you will know how to stop it, and why the music on a CD is measured 44,100 times every second.
Quick recap
- A digital signal is a list of measurements, taken at regular moments. The number of measurements each second is the sample rate (lesson 1).
- A sine wave is the smooth up-and-down shape. Its amplitude is how tall it is; its frequency is how many cycles it completes each second, in hertz (Hz) (lesson 2).
Build a signal from two sine waves
Real signals rarely look like one clean sine wave. Here is a wobbly one. It looks messy, but it is hiding something simple: it is just two sine waves added together, a big slow one at 10 Hz and a small fast one at 60 Hz.
How do you add two waves? Pick a moment in time. Take the height of the slow wave, then stack the height of the fast wave on top: where it lands is the total. Do that at every moment. Where both waves are up, the total goes higher; where one is up and the other down, they partly cancel.
Turn the fast wave down and the ripples fade away; turn it back up and they return. The slow wave never changed.
The spectrum: a list of ingredients
This suggests a completely different way to describe a signal. Instead of drawing its height over time, list its ingredients: which sine waves are inside, and how big each one is.
Each sine wave becomes a single bar. The bar’s position shows its frequency; its height shows its amplitude. The big slow wave becomes a tall bar at 10 Hz, and the small fast wave a short bar at 60 Hz. This picture is called a spectrum.
Spectra in real life
You have probably seen a spectrum before. The bouncing bars in a music app are a live spectrum of the song: bars on the left are low sounds like a bass drum, bars on the right high sounds like cymbals.
Spectra also explain why instruments sound different. A flute and a guitar can play the same note, with the same main frequency. But the guitar adds stronger extra waves at two and three times that frequency, called harmonics. Same note, different ingredients, so a different sound. Your ears are reading the spectrum all the time.
Two bars, and nothing else: a tall bar of height 2 at 50 Hz, and a short bar of height ½ at 200 Hz.
The spectrum of the practice signal: one bar per sine wave.
Measuring too slowly
Back to measuring. The computer only ever sees the dots. Measure the 60 Hz wave 360 times a second and the dots follow it closely. Now measure only 80 times a second.
Join these dots with the smoothest curve you can, and you get a slow wave of only 20 cycles a second. The dots are telling a lie. And here is the problem: both waves pass through every single dot. Looking only at the dots, the computer cannot tell which wave was really there.
This is aliasing: a fast wave pretending to be a slower one. An alias is a false name, and that is exactly what our 60 Hz wave is using.
The spinning wheel, explained
Think of the 60 Hz wave as a wheel making 60 turns a second. Measuring 80 times a second is like a flash going off 80 times a second. Between flashes the wheel turns
But three quarters of a turn forwards lands in the same place as a quarter turn backwards. So the wheel seems to creep backwards: a quarter turn per flash, 80 flashes a second, turns a second. That is why the false 20 Hz wave starts by going down instead of up: it is running backwards.
The rule, and the Nyquist frequency
So how fast must we measure? Raise the sample rate slowly and see what the dots say. At 80 measurements a second they say 20 Hz; at 100 they say 40 Hz, still wrong. Only once we pass 120 a second do the dots finally show the true 60 Hz. And 120 is exactly twice 60.
That is the rule. To capture a wave properly you need more than two measurements in every cycle, so
where is the sample rate and is the highest frequency in the signal.
Half the sample rate has a special name, the Nyquist frequency, after the engineer Harry Nyquist:
Frequencies below it are captured safely. Anything above it turns into an alias: it folds back like a mirror image. At 80 measurements a second the Nyquist frequency is 40 Hz. Our 60 Hz bar is 20 Hz above the line, so it folds back and lands 20 Hz below it, at 20 Hz: exactly the false wave we saw.
For a frequency between the Nyquist frequency and the sample rate, the alias is simply . Here, Hz.
Why exactly twice is not enough
Why more than twice, and not exactly twice? Measure our 60 Hz wave exactly 120 times a second and you might catch it only as it crosses zero: every dot is zero, and the wave vanishes. Shift the timing a little and you would catch the peaks instead. At exactly twice, the result depends on luck, which is why engineers always leave extra room.
Unlucky timing
Every dot lands on a zero crossing. The wave vanishes.
Lucky timing
Shift the timing a little and the dots catch the peaks.
Anti-aliasing filters
There is one more danger. Real signals can carry fast ingredients you never wanted, like hiss or electrical interference. If they are above the Nyquist frequency, they fold back and land right among the frequencies you care about. Once that happens it cannot be undone: the measurements are already mixed up, and no later calculation can separate them.
So the signal first goes through an anti-aliasing filter. A filter is a circuit that lets some frequencies through and blocks others; this one removes anything too fast before the measurements are taken.
Real life: CDs and phone calls
Now we can answer the question from the start. Human hearing goes up to about 20,000 Hz. Twice that is 40,000 measurements a second.
| Sample rate | Nyquist frequency | Highest sound needed | |
|---|---|---|---|
| Music on a CD | 44,100 a second | 22,050 Hz | about 20,000 Hz (hearing) |
| Traditional phone calls | 8,000 a second | 4,000 Hz | about 3,400 Hz (clear speech) |
In both cases the Nyquist frequency sits a little above the highest sound needed. The gap in between gives the filter room to work.
More than measurements a second. In practice, use a bit more, with an anti-aliasing filter in front.
Three common mistakes
Recap
- Any signal can be built from sine waves.
- A spectrum lists those ingredients: frequency along the bottom, amplitude as the height of each bar.
- Measure too slowly and a fast ingredient takes a false name: aliasing.
- The Nyquist frequency is half the sample rate; anything above it folds back.
- To prevent aliasing, measure at more than twice the highest frequency, and filter out anything faster first.
Say the main idea aloud once: measure at more than twice the highest frequency, or the dots will lie.
Interactive lab
Fool the computer
Choose how fast a wave really wiggles and how often you measure it. Watch the dots tell the truth, then lie, and see a wheel lit by the same flashes turn the wrong way.
Sign in to open the lab
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Check yourself
Did it stick?
Work each one out on paper first. Every question has a full worked answer.
- 1
A spectrum has three bars, at 50, 150 and 250 Hz. How many sine waves are in the signal?
Worked answer
Each bar in a spectrum is one sine wave: its position is the wave’s frequency and its height is the wave’s amplitude. Three bars means three sine waves, at 50 Hz, 150 Hz and 250 Hz.
- 2
A recorder takes 48,000 samples a second. What is its Nyquist frequency?
Worked answer
The Nyquist frequency is half the sample rate:
Sounds below 24,000 Hz are captured safely; anything above would fold back.
- 3
Is 500 samples a second enough to capture a 300 Hz wave?
Worked answer
The sample rate must be more than twice the highest frequency: more than samples a second. 500 is not enough.
Another way to see it: at 500 a second the Nyquist frequency is 250 Hz, and 300 Hz is above it, so the wave would fold back to Hz. A filter after the measuring cannot help, because by then the alias is already mixed in. And exactly 600 is not enough either: at exactly twice, the result depends on luck.
- 4
A 70 Hz wave is measured 100 times a second. What frequency do the dots suggest?
Worked answer
The Nyquist frequency is Hz. The wave, at 70 Hz, is 20 Hz above it, so it folds back and lands 20 Hz below it:
Or directly, for a frequency between the Nyquist frequency and the sample rate: Hz.
- 5
You want to record sounds up to 12,000 Hz. Which plan works?
Worked answer
The sample rate must be more than twice the highest frequency: more than samples a second. Exactly 24,000 is not enough, because at exactly twice the result depends on luck.
And the anti-aliasing filter must come before the measuring. Any unwanted sound above the Nyquist frequency would otherwise fold back among the real sounds, and once mixed in it cannot be separated.
Sign in to open the checks
It is free. Signing in with Google also keeps your progress and your scores.
Sign in with GoogleLesson 1 of every course is open without signing in.
Was this lesson clear?
Free weekly email
Get the next lesson by email.
The week's new lessons, the daily facts in one place, one thing to try in the lab and one puzzle. Free.
No spam. One click to leave.