Preview

Fourier: Making Waves

Build any wave by adding sine components

Every sound you have ever heard — a violin's long note, a slamming door, your own name called across a crowd — is secretly a committee. In 1822 Joseph Fourier made the outrageous claim that any periodic wave, no matter how jagged, is just a sum of smooth sine waves: a fundamental humming at f₁, plus its harmonics at 2f₁, 3f₁, 4f₁, each with its own amplitude. This lab hands you the first four seats of that committee. Four sliders set four harmonic amplitudes, the white line shows the committee's verdict — the point-by-point sum — and the spectrum bars show who is voting and how loudly. Start with the pure sine: one voice, one smooth arch, peak exactly 1.000. Then press Square Wave and watch something that should bother you: we ADD a third harmonic at amplitude 1/3, and the wave's peak FALLS to 0.943. Adding made it smaller. The committee members do not take turns being loudest — at the exact moment the fundamental crests, the third harmonic sits in a trough, voting against it. That is superposition: the sum is taken point by point, never peak by peak. The sawtooth preset shows the opposite conspiracy — four voices whose crests nearly align, piling up to 1.527. Keep one eye on the spectrum bars and one on the waveform: the same information in two languages. Your prediction before you touch anything: from the pure sine, press Square Wave — what does the Peak amplitude row do?

What you'll be able to do

  • Run the harmonic-synthesis accounts with the panel's own rows: at the factory state (A1=1, A2–A4=0) the sum is a pure unit sine — Peak 1.000, RMS 0.706 (the engine's 256-sample account of the physics value 1/√2 = 0.7071), Type 'Pure Sine', one active harmonic; price all three presets against f(t) = Σ Aₙ sin(2π n f₁ t) — Pure (1.000 / 0.706), Square [1, 0, 1/3, 0] (Peak 0.943 = 2√2/3 exactly, RMS 0.744 ≈ √(5/9) = 0.7454, 'Square-like (odd H)'), Sawtooth [1, 0.5, 1/3, 0.25] (Peak 1.527, RMS 0.842 ≈ √0.71181 = 0.8437, 'Sawtooth-like') — and read the spectrum bars as the same information in the frequency language (bar height = 3×Aₙ, the H3 bar at exactly 1/3 the H1 height on the square preset)
  • Explain WHY a square wave is built from odd harmonics with 1/n decay and why sharp edges cost high frequencies: the square preset's two-term sketch [1, 0, 1/3, 0] already bends the sine toward a flat top, the sidebar's series card (4/π)Σ sin((2k+1)ωt)/(2k+1) carries only odd terms, and the odd-multiples structure is a physics family, not a sim convention — 'A closed tube has only odd multiples' (§17.5, verified); each added high harmonic sharpens features (the engine's own quiz Q3 lineage: 'It develops sharper edges and features'), which is why the Gibbs caveat on the sidebar (~9% overshoot regardless of term count) belongs to the honest narrative even though this four-harmonic engine never reaches the Gibbs regime
  • Keep three ledgers separate — component amplitudes (the sliders), the sum's peak (point-by-point superposition, where crest alignment decides everything: square crests misalign and Peak FALLS 1.000 → 0.943 while sawtooth crests conspire and Peak piles to 1.527 > 1), and the energy ledger RMS = √(Σ Aₙ²/2), which NEVER falls when a harmonic joins (0.706 → 0.744 → 0.842 across the presets; 'the height of resulting wave is the sum of the heights of the individual waves, taken point by point', §16.5 verified) — and read the Type row honestly as a parity classifier, not a shape oracle (a lone H3 is a pure sine wearing a 'Square-like (odd H)' badge, registered quirk b)

Formulas

f(x)=n=1ansin(nx)+bncos(nx)f(x) = \sum_{n=1}^{\infty} a_n \sin(nx) + b_n \cos(nx)
Fourier series
Square: an=4nπ (odd n only)\text{Square: } a_n = \frac{4}{n\pi} \text{ (odd n only)}
Square wave coefficients

Make a prediction

Default state: A1 = 1, A2–A4 = 0 — a pure sine, Peak 1.000, RMS 0.706. You press the Square Wave preset, which adds the third harmonic at amplitude 1/3 (A1 = 1, A3 = 1/3). What happens to the Peak amplitude row?

No grading here — commit to a guess, then scroll down and test it yourself.

This is a Pro experiment

Upgrade to Pro to access this experiment — or keep learning with one of our free labs.

Scroll for the debrief ↓

Check

Did the lab agree with you?

Your prediction

You skipped the prediction — jump back to the preview and commit to a guess first; the comparison is the whole point.

Answer: It falls to 0.943 — lower than the pure sine's peak. At the fundamental's crest the third harmonic sits at its own trough and pulls the sum down to 0.667 there; the real maximum migrates to a shoulder at 2√2/3 ≈ 0.943

The panel falls to 0.943 — node-verified against the engine's own math. Mechanism: with A1 = 1 and A3 = 1/3 the sum is s(θ) = sin θ + (1/3)·sin 3θ. Using sin 3θ = 3 sin θ − 4 sin³θ this collapses to s = 2u − (4/3)u³ with u = sin θ — a one-variable function whose maximum sits at u = 1/√2, giving s_max = 2√2/3 = 0.9428 → displayed 0.943. The killer detail is crest misalignment: at the fundamental's own crest (θ = π/2) the third harmonic sits at 3π/2 — its TROUGH — and votes −1/3, so the sum at that point reads only 1 − 1/3 = 0.667. The true maximum migrates to a shoulder on either side. This is the superposition principle rendered literally: the resultant is 'the algebraic sum of the position due to the individual waves' — 'taken point by point' (OpenStax UP1 §16.5 and Figure 16.22 caption, both verified) — point by point, never peak by peak. Option B is the amplitude-addition instinct this gate targets (the mechanical-wave reasoning family documented by Wittmann et al. 1999, registered paywalled): 1 + 1/3 = 1.333 would be right only if both crests coincided — and for an odd harmonic at the fundamental's crest, they never do. Option C confuses a component's amplitude with the sum's peak: the fundamental still SWINGS amplitude 1, but the row displays the peak of the sum, and at the crest position the sum reads 0.667. Meanwhile the RMS row climbs 0.706 → 0.744: adding a harmonic always adds energy (RMS = √(ΣA²/2) = √(5/9) = 0.745) even as the peak falls — peak and power are different ledgers.

Quiz (0/3)

Why does a square wave require odd harmonics only (1st, 3rd, 5th...)?

What happens to the approximation as you add more harmonics?

How does Fourier analysis relate to the timbre of a musical instrument?

You can now

  • Run the harmonic-synthesis accounts with the panel's own rows: at the factory state (A1=1, A2–A4=0) the sum is a pure unit sine — Peak 1.000, RMS 0.706 (the engine's 256-sample account of the physics value 1/√2 = 0.7071), Type 'Pure Sine', one active harmonic; price all three presets against f(t) = Σ Aₙ sin(2π n f₁ t) — Pure (1.000 / 0.706), Square [1, 0, 1/3, 0] (Peak 0.943 = 2√2/3 exactly, RMS 0.744 ≈ √(5/9) = 0.7454, 'Square-like (odd H)'), Sawtooth [1, 0.5, 1/3, 0.25] (Peak 1.527, RMS 0.842 ≈ √0.71181 = 0.8437, 'Sawtooth-like') — and read the spectrum bars as the same information in the frequency language (bar height = 3×Aₙ, the H3 bar at exactly 1/3 the H1 height on the square preset)
  • Explain WHY a square wave is built from odd harmonics with 1/n decay and why sharp edges cost high frequencies: the square preset's two-term sketch [1, 0, 1/3, 0] already bends the sine toward a flat top, the sidebar's series card (4/π)Σ sin((2k+1)ωt)/(2k+1) carries only odd terms, and the odd-multiples structure is a physics family, not a sim convention — 'A closed tube has only odd multiples' (§17.5, verified); each added high harmonic sharpens features (the engine's own quiz Q3 lineage: 'It develops sharper edges and features'), which is why the Gibbs caveat on the sidebar (~9% overshoot regardless of term count) belongs to the honest narrative even though this four-harmonic engine never reaches the Gibbs regime
  • Keep three ledgers separate — component amplitudes (the sliders), the sum's peak (point-by-point superposition, where crest alignment decides everything: square crests misalign and Peak FALLS 1.000 → 0.943 while sawtooth crests conspire and Peak piles to 1.527 > 1), and the energy ledger RMS = √(Σ Aₙ²/2), which NEVER falls when a harmonic joins (0.706 → 0.744 → 0.842 across the presets; 'the height of resulting wave is the sum of the heights of the individual waves, taken point by point', §16.5 verified) — and read the Type row honestly as a parity classifier, not a shape oracle (a lone H3 is a pure sine wearing a 'Square-like (odd H)' badge, registered quirk b)

Step-by-step

  1. Drag the four amplitude sliders H1–H4 (each 0–1) and watch every layer respond at once: colored component waves, the white sum wave, 3D spectrum bars, and the amplitude-spectrum and square-construction panels.
  2. The data panel prices your wave live — fundamental f₁ (fixed at 1.00 Hz), active harmonics, a waveform-type label, peak and RMS amplitude.
  3. Use the presets to jump to a Pure Sine [1,0,0,0], a two-term Square approximation [1,0,⅓,0], or a four-term Sawtooth [1,½,⅓,¼] — then perturb them and watch the peak and RMS ledgers move.
  4. Speed and Pause only drive the phase clock; sliders stay live while paused.

Key formulas

  • f(x)=n=1ansin(nx)+bncos(nx)f(x) = \sum_{n=1}^{\infty} a_n \sin(nx) + b_n \cos(nx)Fourier series
  • Square: an=4nπ (odd n only)\text{Square: } a_n = \frac{4}{n\pi} \text{ (odd n only)}Square wave coefficients

Frequently asked questions

Why does a square wave require odd harmonics only (1st, 3rd, 5th...)?
The symmetry of a square wave means even harmonics cancel out.
What happens to the approximation as you add more harmonics?
The waveform gets closer to the target — but never perfectly matches with finite terms.
How does Fourier analysis relate to the timbre of a musical instrument?
Different instruments have different harmonic profiles — same pitch, different Fourier coefficients.