Free~25 min · AP Physics 1

Fourier: Making Waves

Build any wave by adding sine components

Key equationf(x) = \sum_{n=1}^{\infty} a_n \sin(nx) + b_n \cos(nx)

Fourier's theorem states that any periodic function can be decomposed into a sum of sine and cosine waves of different frequencies and amplitudes. The fundamental frequency sets the pitch; harmonics add complexity. Square waves require infinitely many odd harmonics; more harmonics = sharper corners. This decomposition is foundational to signal processing, acoustics, and quantum mechanics.

ProPremium experiment

Unlock Fourier: Making Waves

Plus 148+ other Pro labs covering AP Physics, Biology, Chemistry, Earth Science, and Math — with unlimited simulation time, advanced parameters, and detailed analytics.

Start 7-day free trial$4.99 / month · cancel anytime
No credit card for trial Cancel in one click Student discount available

What is Fourier: Making Waves?

Hold down a single key on a piano and what reaches your ear is not a pure sine wave — it is a rich, slightly buzzy tone with character. That character comes from harmonics: integer multiples of a fundamental frequency, stacked on top of one another with specific amplitudes. Joseph Fourier proved in the early 1800s that any periodic vibration, no matter how spiky or jagged, can be built up by adding pure sine waves of the right frequencies and sizes. This lab lets you do exactly that. Pick a target shape — square, triangle, or sawtooth — then add harmonics one at a time and watch the composite waveform creep toward the target. The spectrum panel shows you the recipe: which harmonics matter, and how much of each.

Parameters explained

Number of Harmonics
How many sine components you stack into the sum, from 1 up to 11. With one harmonic you see a pure sine; as you add more, the composite gets closer to the target shape — and corners get sharper.
Target Wave Shape
Picks the periodic shape you are trying to synthesize: pure sine, square, triangle, or sawtooth. Each shape has its own harmonic recipe — square waves use only odd harmonics, sawtooths use every integer harmonic, and so on.
A₁ (fundamental)
The amplitude of the fundamental (n = 1) harmonic, the first sine in the series. Scaling a₁ scales the overall size of the composite wave because every other harmonic amplitude is set by the formula for the chosen target shape.

Common misconceptions

  • MisconceptionFourier series is a math trick people invented to approximate ugly functions — it is not real physics.

    CorrectEvery periodic vibration in nature literally is a sum of sines. A vibrating guitar string really is oscillating in the fundamental plus all its harmonics simultaneously, and you can detect each component with a microphone and an FFT. The math reflects the physics, not the other way around.

  • MisconceptionIf you add enough harmonics, you eventually get a perfect square wave with infinitely sharp corners.

    CorrectWith any finite number of harmonics there is always a small overshoot near each corner — the Gibbs phenomenon. Adding more terms shrinks the wiggle in width but the overshoot height stays around 9 percent. A perfect square only emerges in the infinite-harmonic limit.

  • MisconceptionEven and odd harmonics are interchangeable — you can build any shape from any harmonics.

    CorrectSymmetry decides the recipe. A square wave's symmetry forces all even-numbered harmonics to be zero, so it uses only the 1st, 3rd, 5th, and so on. A triangle wave is also odd-only. A sawtooth, which lacks that symmetry, uses every harmonic.

  • MisconceptionTwo musical instruments playing the same pitch produce identical waveforms.

    CorrectSame pitch means same fundamental frequency, but the harmonic mix — the timbre — is different. A violin and a flute on the same A4 have different Fourier coefficients, and that is exactly why they sound like different instruments.

How teachers use this lab

  1. Build-a-square challenge: ask students to predict how the waveform will look with 1, 3, 5, and 7 odd harmonics before they slide the control. Have them sketch the predictions on paper, then compare to the live simulation.
  2. Data collection — Gibbs overshoot: students measure the height of the overshoot near a square-wave corner at n = 5, 7, 9, 11 harmonics, then discuss why it stays roughly constant instead of shrinking to zero.
  3. Symmetry argument: pause on a square wave and ask why the second harmonic is zero. Use the graphical symmetry of an odd function on each half-period to derive the answer collaboratively at the board.
  4. Misconception probe: open the lab with target_wave = sawtooth and n = 1. Ask 'what does the spectrum look like?' before revealing it; many students will guess 'just one bar' even after meeting Fourier — the resolution forces them to confront superposition.
  5. Music timbre lab: pair this with a tone-generator app. Have students record a flute and a clarinet playing the same note, run an FFT, compare the harmonic profiles, and explain timbre using the harmonic recipe shown in this simulation.

Frequently asked questions

Why does a square wave only need odd harmonics — what happens to the even ones?

A square wave has a special symmetry: its second half is the negation of its first half. Even-numbered harmonics do not share that symmetry, so when you integrate to find their Fourier coefficients you get exactly zero. Odd-numbered sines (1, 3, 5, …) match the square's symmetry, so they survive with amplitudes proportional to 1/n. You can verify this in the spectrum panel — every even bar stays empty.

What is the Gibbs phenomenon and will adding more harmonics fix it?

Gibbs phenomenon is the persistent ~9% overshoot you see near each corner of a square or sawtooth wave. Adding more harmonics narrows the wiggle in horizontal extent but the peak height does not shrink — it converges to a fixed value tied to the integral of sin(x)/x. So the overshoot is real, mathematical, and unavoidable with any finite sum, even though the energy in the overshoot region goes to zero in the limit.

How does Fourier analysis explain why a flute and a violin sound different on the same note?

Both instruments produce the same fundamental frequency, so your brain hears the same pitch. But each instrument excites a different mix of harmonics — different a_n values — so their composite waveforms have different shapes. The flute is dominated by the fundamental with weak upper harmonics (close to a sine), while the violin has rich, comparable amplitudes well above the fundamental. That harmonic recipe is timbre.

Where does this connect to AP Physics 1 standard GO-5.A?

GO-5.A covers superposition of waves: students must show that two or more waves passing through the same region add point-by-point in displacement. Fourier synthesis is superposition taken to its logical end — instead of just two interfering waves, you superpose dozens of carefully chosen sines to construct any periodic shape. The lab makes that abstract claim concrete and visual.

Is Fourier series limited to physics, or does it show up in other places?

It shows up almost everywhere periodic things appear: audio compression in MP3 files, JPEG image compression (a 2D cousin called the discrete cosine transform), MRI image reconstruction, quantum mechanical wavefunctions, and digital filters in your phone. The reason: any periodic signal has a Fourier representation, and many operations (filtering, denoising, compression) are far easier in the frequency domain than the time domain.

Why can my one-harmonic approximation already look pretty close to a triangle wave?

Triangle waves have Fourier coefficients that fall off as 1/n² — much faster than square waves, which fall off as 1/n. That means almost all the 'energy' of a triangle is in the fundamental, with the upper harmonics making only small refinements. A square wave, by contrast, needs many harmonics to look square because each one still contributes a meaningful amount.