Turning a wave into a sum of circles
In 1822 Joseph Fourier made a claim that scandalised the mathematicians of his day: any periodic function, however jagged, can be written as a sum of ordinary sines and cosines. A square wave, a sawtooth, the pressure trace of a plucked guitar string — all of them decompose into a fundamental frequency plus a ladder of harmonics at integer multiples of it. The cleanest way to see why is to stop thinking about sines and cosines separately and instead picture each harmonic as a little arrow — a phasor — spinning at constant speed around the origin of the complex plane. Add up the tips of enough spinning arrows, nested end to end, and the sum traces out the original waveform over time.
The coefficients: how much of each harmonic
For a function f(t) with period T, the amplitude of each harmonic is found by projecting f onto that harmonic's sine or cosine — an inner product that measures how much the two shapes overlap. Using Euler's identity e^{iθ} = cos θ + i sin θ, the whole series collapses into one compact complex-exponential form, where a single complex number cₙ carries both the amplitude and phase of harmonic n:
f(t) = Σ_{n=-∞}^{∞} c_n · e^{i·2πnt/T}
c_n = (1/T) ∫₀ᵀ f(t) · e^{-i·2πnt/T} dt // project f onto harmonic n
|c_n| = amplitude of the n-th phasor
arg(c_n) = its starting angle (phase)
Each term c_n·e^{i2πnt/T} is a phasor spinning n times as fast as the fundamental. Chain them tip-to-tail — the second phasor's centre riding on the first's tip, the third on the second's, and so on — and at every instant t the position of the last arrow's tip is exactly f(t). This is precisely how the classic "Fourier epicycle" drawings work: enough nested circles can trace a square wave, a star, or a portrait.
Building a square wave, one harmonic at a time
A square wave contains only odd harmonics, each shrinking as 1/n of the fundamental's amplitude: adding sin(t), then sin(3t)/3, then sin(5t)/5, and so on, gradually squares off the rounded single sine into flatter tops and steeper edges. A sawtooth wave uses every harmonic (odd and even) with amplitude 1/n and alternating sign, while a triangle wave uses only odd harmonics that fall off much faster, as 1/n², which is why triangle waves sound "purer" than square or sawtooth waves — their higher harmonics are far quieter.
The Gibbs phenomenon: the overshoot that never dies
Watch the square-wave reconstruction closely near the vertical jump and something odd happens: the partial sum doesn't just approach the jump, it overshoots past the top and undershoots past the bottom, ringing before settling down elsewhere. Adding more harmonics squeezes this ripple closer and closer to the discontinuity — but the height of the very first overshoot stubbornly stays at about 9% of the jump size, no matter how many terms you add. This is the Gibbs phenomenon, rigorously explained by Josiah Willard Gibbs in 1899: a continuous sum of smooth sinusoids can approximate a jump arbitrarily well in an averaged (least-squares) sense, but it can never eliminate the ringing right at the edge. It's the mathematical root of the "ringing" artefacts you see around sharp edges in JPEG-compressed images and hear as pre-echo in aggressively compressed audio.
From series to transform: letting the period go to infinity
A Fourier series only makes sense for a periodic signal — one that repeats forever with period T. Most interesting signals (a single clap, a photograph, a stock price) never repeat. To handle them, imagine stretching T toward infinity: the spacing between adjacent harmonics, 1/T, shrinks toward zero, and the discrete ladder of coefficients c_n merges into a continuous curve. The sum becomes an integral, and the discrete coefficients c_n become a continuous function F(ω) — the Fourier transform:
F(ω) = ∫_{-∞}^{∞} f(t) · e^{-iωt} dt // forward transform (T → ∞)
f(t) = (1/2π) ∫_{-∞}^{∞} F(ω) · e^{iωt} dω // inverse transform
Where the Fourier series gives you a spectrum made of discrete spikes at 0, ±1/T, ±2/T…, the Fourier transform gives a continuous spectral density — every frequency can appear, with an infinitesimal amount of energy at each one. In practice, computers can only ever store a finite number of samples, so real software uses the Discrete Fourier Transform (DFT) and its fast implementation, the FFT — a sampled, periodic-by-construction cousin of the continuous transform that brings the same phasor idea to arrays of numbers in O(N log N) time.
Frequently asked questions
What is the Gibbs phenomenon and why doesn't it go away?
Near a jump discontinuity, a truncated Fourier series overshoots the true value by about 9% of the jump height, no matter how many harmonics you add. Adding more terms narrows the overshoot toward the discontinuity but never shrinks its height — it is a permanent artefact of approximating a discontinuous function with continuous sinusoids, first explained rigorously by Josiah Willard Gibbs in 1899.
What's the difference between a Fourier series and the Fourier transform?
A Fourier series applies to periodic signals and produces a discrete set of harmonic coefficients spaced at multiples of the fundamental frequency 1/T. The Fourier transform applies to aperiodic (non-repeating) signals and produces a continuous spectrum, obtained formally by letting the period T go to infinity so the harmonic spacing shrinks to zero and the sum becomes an integral.
Why do we use complex exponentials instead of just sines and cosines?
Euler's formula e^{iθ} = cos θ + i sin θ lets a single rotating phasor encode both amplitude and phase of a harmonic, replacing a pair of sine and cosine coefficients with one complex number. This compact form also makes properties like the convolution theorem and frequency shifting simple algebraic statements instead of trigonometric identities, which is why virtually all modern signal-processing derivations use the complex form.
Try it live
Every phasor, harmonic and overshoot above runs live in Fourier Series — Interactive Phasor & Harmonic Decomposition Simulator. Add harmonics one at a time, watch the epicycles spin, and see the Gibbs overshoot appear right where the theory predicts it.
▶ Open Fourier Series simulation