Fourier Series Calculator
Calculate Fourier series coefficients for square, sawtooth, and triangle waves.
Find an and bn coefficients, partial sums, and convergence behavior.
What Is a Fourier Series? A Fourier series represents a periodic function as an infinite sum of sine and cosine waves: f(x) = a₀/2 + Σ[aₙcos(nπx/L) + bₙsin(nπx/L)] The idea is that ANY periodic function, no matter how irregular, can be built from pure sinusoids. Jean-Baptiste Joseph Fourier developed this in 1822 in France to solve the heat equation. His claim was initially controversial — Lagrange and Laplace doubted it — but it was ultimately proven correct.
Fourier Coefficients a₀ = (1/L) ∫₋L^L f(x) dx (twice the average value) aₙ = (1/L) ∫₋L^L f(x)cos(nπx/L) dx (cosine coefficients) bₙ = (1/L) ∫₋L^L f(x)sin(nπx/L) dx (sine coefficients) For even functions (f(−x) = f(x)): only aₙ coefficients (cosine series). For odd functions (f(−x) = −f(x)): only bₙ coefficients (sine series).
Common Fourier Series Square wave (period 2π, amplitude 1): f(x) = (4/π) × [sin(x) + sin(3x)/3 + sin(5x)/5 + …] = (4/π) × Σ sin((2k−1)x)/(2k−1) Only odd harmonics appear. Coefficients decay as 1/n.
Sawtooth wave (period 2π): f(x) = 2 × [sin(x) − sin(2x)/2 + sin(3x)/3 − …] = 2 × Σ (−1)^(n+1) sin(nx)/n All harmonics present. Coefficients decay as 1/n.
Triangle wave (period 2π): f(x) = (8/π²) × [sin(x) − sin(3x)/9 + sin(5x)/25 − …] = (8/π²) × Σ (−1)^k sin((2k+1)x)/(2k+1)² Only odd harmonics. Coefficients decay as 1/n².
Gibbs Phenomenon Near a jump discontinuity, the Fourier partial sum overshoots by about 9% of the jump height. This overshoot does NOT disappear as more terms are added — it narrows but stays at ~9%. Named after J. Willard Gibbs (1899 in the United States), though first noticed by Wilbraham in 1848. Gibbs phenomenon is a fundamental limitation of Fourier series at discontinuities.
Parseval’s Theorem The sum of squared coefficients equals the mean squared value of the function: (a₀/2)² + Σ(aₙ² + bₙ²)/2 = (1/2L) ∫₋L^L [f(x)]² dx This is an energy conservation law in frequency space — total power = sum of power in each harmonic. Famous use: Σ 1/n² = π²/6 (Basel problem) follows from Parseval applied to the sawtooth wave.
Applications Signal processing: any periodic signal decomposes into harmonics — the basis of spectrum analyzers. Audio: musical tones have fundamental + harmonics. A violin and a flute playing the same note differ by their harmonic content (timbre). Image compression: JPEG uses the discrete cosine transform (DCT), a close relative of the Fourier series. Heat equation: temperature distribution in a rod is a Fourier series in spatial coordinate.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.