Fourier Series Visualizer

See how square, triangle, and sawtooth waves decompose into harmonic sine components. Add terms one by one and watch the waveform converge.

Viewer Electronics Updated Apr 18, 2026
How to Use
  1. Pick a target waveform: square, triangle, or sawtooth.
  2. Adjust the number of harmonics with the slider.
  3. Watch the partial sum converge to the ideal waveform.
  4. The spectrum chart shows the individual harmonic amplitudes.
Input
5
Presets
Waveform Synthesis
Harmonics
Gibbs Overshoot
Harmonic Type
Decay Rate

Harmonic Breakdown

Pick a waveform.

Formulas

Square Wave
Σ (4/π) · sin(nωt)/n
Odd n only (1, 3, 5, ...).
Triangle Wave
Σ (8/π²) · (−1)^((n−1)/2) sin(nωt)/n²
Odd n only, faster 1/n² decay.
Sawtooth
Σ (−1)^(n+1) · 2 sin(nωt) / (πn)
All integer n.
Gibbs Overshoot
~8.95% of step height
Peak overshoot at discontinuities.
Parseval
Energy = Σ|aₙ|²
Time-domain and frequency-domain energies are equal.
Harmonic Frequency
fn = n × f0
nth harmonic at n × fundamental.

History of the Fourier Series

Joseph Fourier introduced the decomposition of periodic functions into infinite sums of sines and cosines in his 1807 manuscript on heat conduction, later published in the landmark 1822 treatise Théorie analytique de la chaleur. The mathematical establishment of the day was deeply skeptical — Lagrange himself criticized Fourier\'s claim that any periodic function, even one with discontinuities, could be represented this way — but by the 1830s Dirichlet and others had proven the necessary convergence conditions, and Fourier analysis became a cornerstone of mathematical physics.

The Gibbs phenomenon — the ~9% overshoot near discontinuities in partial-sum Fourier series — was first observed experimentally by Albert Michelson around 1898 while building a mechanical harmonic analyzer. He was convinced his instrument was faulty until J. Willard Gibbs proved theoretically in 1899 that the overshoot is an intrinsic property of Fourier series, not a measurement error. It persists regardless of how many harmonics you add — only the width of the overshoot narrows, not its height.

Today, Fourier analysis is essential to virtually every engineering discipline: audio synthesis (additive synthesizers literally implement Fourier series in real time), EMI analysis (square-wave clocks radiate at every odd harmonic), image compression (JPEG uses DCT, a Fourier cousin), MRI reconstruction, quantum mechanics (momentum-space wavefunctions), and signal-processing theory. This visualizer demonstrates the core principle that took 100 years to gain full mathematical acceptance.

About This Calculator

Pick square, triangle, or sawtooth and move the harmonic-count slider. The visualizer draws the partial sum alongside the ideal waveform, showing both convergence and the Gibbs overshoot at discontinuities. Accompanying readouts report harmonic type (odd-only for square/triangle; all for sawtooth) and amplitude decay rate (1/n for square/sawtooth; 1/n² for triangle, hence faster convergence).

Useful for: understanding the harmonic content of digital clock signals (EMI analysis), seeing why triangle waves sound smoother than squares (faster spectral decay), and building intuition for how windowing reduces spectral leakage. Everything runs client-side; no values leave your browser.

Frequently Asked Questions

What is Fourier series?

Any periodic waveform can be decomposed as a sum of sine (and cosine) harmonics at integer multiples of the fundamental frequency. Used in audio synthesis, signal analysis, filter design, and countless other areas.

Why does the sum ring at discontinuities?

Gibbs phenomenon: near a step, the partial sum overshoots by ~9% regardless of how many harmonics you add. Fixable with windowing or smoothing but never zeroed out.

Square vs triangle harmonics?

Square: odd harmonics only (1, 3, 5, ...) with 1/n amplitude. Triangle: odd harmonics with 1/n² amplitude (converges faster). Sawtooth: all harmonics (1, 2, 3, ...) with 1/n amplitude.

Common Use Cases

Audio Synthesis

Additive synthesizers build waveforms from sine components.

EMI Analysis

Square-wave clock signals have harmonics at all odd multiples — radiate at those frequencies.

Filter Design

Understand what frequencies you need to pass/reject based on harmonic content.

Last updated: