Fourier Series — Building Any Wave from Sines
How any repeating signal is secretly just a sum of sine waves
This concept builds on Sine on the Unit Circle and in a Right Triangle, Cosine — The Other Side. Consider exploring them first for the best experience.
One Harmonic: The Fundamental
Slide the 'Harmonics' slider down to 1. The PHASORS panel shows a single spinning arrow, and the WAVE panel traces the plain sine wave it casts. This lowest-frequency term is the fundamental: its period matches the square wave you are building, and its peak already reaches a little past the +1 mark.
Add the Third Harmonic
At the default of 2 harmonics, a second, shorter arrow rides on the tip of the first and spins three times as fast. Their sum in the WAVE panel flattens on top with a small dip in the middle, and the SPECTRUM panel now shows two bars, labelled 1 and 3.
Worked Example: Square-Wave Amplitudes
Set the 'Harmonics' slider to 3. A square wave of height 1 uses only odd harmonics, with amplitudes 4/π · (1, 1/3, 1/5, …). So the fundamental is 4/π ≈ 1.27 tall, the 3rd harmonic is 1.27 ÷ 3 ≈ 0.42 (a third as tall) and the 5th is 1.27 ÷ 5 ≈ 0.25. The three SPECTRUM bars shrink in exactly that ratio.
Watch the Corners Sharpen
Drag the 'Harmonics' slider up toward 8. Each new arrow in the PHASORS panel is shorter and faster than the one before, adding the 7th, 9th, 11th harmonics and so on. In the WAVE panel the edges grow steeper and the flat tops fill in, while each new SPECTRUM bar is shorter than the last.
Convergence and the Overshoot
Move the 'Harmonics' slider to 10 or more. With 10 odd terms the sum already looks remarkably square, and every extra term squeezes the ripples closer to each jump. One feature never disappears: a narrow spike beside each edge peaks near 1.18, about 9% of the jump past the +1 mark. This lasting overshoot is called the Gibbs phenomenon.
Switch the Wave Shape
Choose 'Triangle' or 'Sawtooth' in the 'Wave' menu. The triangle wave also uses only odd harmonics, but its amplitudes fall as 1/n², so its 3rd harmonic is just a ninth as tall and a few terms already look smooth. The sawtooth uses every harmonic, 1, 2, 3, …, each 1/n as tall. A different spectrum builds a different shape.
How It Works — Step by Step
-
1
One Harmonic: The Fundamental
Slide the 'Harmonics' slider down to 1. The PHASORS panel shows a single spinning arrow, and the WAVE panel traces the plain sine wave it casts. This lowest-frequency term is the fundamental: its period matches the square wave you are building, and its peak already reaches a little past the +1 mark.
-
2
Add the Third Harmonic
At the default of 2 harmonics, a second, shorter arrow rides on the tip of the first and spins three times as fast. Their sum in the WAVE panel flattens on top with a small dip in the middle, and the SPECTRUM panel now shows two bars, labelled 1 and 3.
-
3
Worked Example: Square-Wave Amplitudes
Set the 'Harmonics' slider to 3. A square wave of height 1 uses only odd harmonics, with amplitudes 4/π · (1, 1/3, 1/5, …). So the fundamental is 4/π ≈ 1.27 tall, the 3rd harmonic is 1.27 ÷ 3 ≈ 0.42 (a third as tall) and the 5th is 1.27 ÷ 5 ≈ 0.25. The three SPECTRUM bars shrink in exactly that ratio.
-
4
Watch the Corners Sharpen
Drag the 'Harmonics' slider up toward 8. Each new arrow in the PHASORS panel is shorter and faster than the one before, adding the 7th, 9th, 11th harmonics and so on. In the WAVE panel the edges grow steeper and the flat tops fill in, while each new SPECTRUM bar is shorter than the last.
-
5
Convergence and the Overshoot
Move the 'Harmonics' slider to 10 or more. With 10 odd terms the sum already looks remarkably square, and every extra term squeezes the ripples closer to each jump. One feature never disappears: a narrow spike beside each edge peaks near 1.18, about 9% of the jump past the +1 mark. This lasting overshoot is called the Gibbs phenomenon.
-
6
Switch the Wave Shape
Choose 'Triangle' or 'Sawtooth' in the 'Wave' menu. The triangle wave also uses only odd harmonics, but its amplitudes fall as 1/n², so its 3rd harmonic is just a ninth as tall and a few terms already look smooth. The sawtooth uses every harmonic, 1, 2, 3, …, each 1/n as tall. A different spectrum builds a different shape.
Key Takeaways
Any shape = sines
This is not an approximation trick — it is a mathematical theorem (Fourier, 1807). A well-behaved periodic function is exactly the sum of its sines and cosines; at a sudden jump the series lands on the midpoint.
Amplitudes set the shape
A square wave of height 1 is 4/π · (sin t + sin 3t/3 + sin 5t/5 + …): odd harmonics only, each 1/n as tall. The list of frequencies and amplitudes, the frequency spectrum, is another complete description of the same signal.
Why it matters
MP3, JPEG, WiFi, MRI, and noise-canceling headphones all rely on Fourier decomposition. It is possibly the most practically useful mathematical idea ever discovered.
Connected Concepts
Sine
Every Fourier term is a sine wave with different frequency.
Cosine
Cosine terms set the phase of each harmonic.
Sound Waves
Musical timbre is the Fourier decomposition of sound.
Wave Interference
Superposition is what Fourier addition relies on.
Uncertainty Principle
Summing sines to localize a wave is exactly how quantum uncertainty arises.
Updated
- — Six slider-keyed steps, a worked square-wave amplitude example (1.27, 0.42, 0.25) and two new quiz questions.