A Fourier series breaks any periodic waveform into a sum of sine and cosine waves at integer multiples of a fundamental frequency. This calculator makes that decomposition visible — showing which harmonics carry the most energy, how quickly the approximation converges, and what the coefficients look like.
Why Fourier series matter
Fourier analysis is the mathematical foundation of audio compression (MP3), image encoding (JPEG), wireless communications, and seismic analysis. Every time your phone processes a voice call, it applies a fast version of this decomposition to convert a sound wave into frequency components that can be compressed and transmitted efficiently.
The key insight — that any periodic signal can be exactly represented as a sum of pure tones — was not obvious when Fourier proposed it in 1807. Today it is one of the most important results in applied mathematics.
How each wave shape behaves
Square wave: Its abrupt on/off transitions require infinitely many harmonics to represent perfectly. The coefficients decay slowly as 1/n, and the Gibbs phenomenon causes a ≈8.9% overshoot near each edge that never disappears — it just gets narrower as N increases.
Sawtooth wave: Similar to the square: all harmonics contribute, coefficients decay as 1/n, and Gibbs phenomenon appears at the reset point. It is used in synthesizers to produce bright, buzzy tones because of its rich harmonic content.
Triangle wave: Because the triangle is continuous (only its derivative has jumps), its coefficients decay as 1/n² — much faster. A handful of harmonics produce an excellent approximation with no Gibbs effect. Triangle waves are used for softer synthesizer tones.
Reading the coefficients table
The table shows aₙ (cosine coefficient) and bₙ (sine coefficient) for each harmonic. The amplitude column — √(aₙ² + bₙ²) — tells you how much energy that harmonic contributes to the signal; the phase column tells you when within the period that component peaks.
For square and triangle waves you will notice that all even-n rows are zero. This is because both waves are odd-symmetric (square) or even-symmetric (triangle) with respect to the half-period, which cancels every other harmonic by symmetry.