Fourier Series Calculator

Calculate Fourier series coefficients (a₀, aₙ, bₙ) for square, sawtooth, and triangle waves using numerical integration. Includes Parseval's identity, complex exponential form, and reconstruction error.

a₀ (DC component)
Coefficients aₙ, bₙ (n=1..5)
Partial Sum at x
Extended More scenarios, charts & detailed breakdown
a₀
Coefficients
Partial Sum
Professional Full parameters & maximum detail

Complex Exponential Form

Complex |cₙ| (n=0..5)

Parseval's Identity

Parseval Sum (energy, n terms)
True Signal Energy ∫f²dx
Reconstruction Error %

How to Use This Calculator

  1. Select a Function Preset (Square Wave, Sawtooth, or Triangle).
  2. Enter the Half-Period L (full period = 2L; default π gives period 2π).
  3. Set the Number of Terms n (up to 20).
  4. Enter x to evaluate the partial sum at that point.
  5. The Professional tab shows complex coefficients |cₙ| and Parseval energy error.

Formula

a₀ = (1/2L)∫f(x)dx  |  aₙ = (1/L)∫f(x)cos(nπx/L)dx  |  bₙ = (1/L)∫f(x)sin(nπx/L)dx

Example

Square wave, L=π, n=5: a₀=0, b₁=4/π≈1.273, b₃=4/(3π)≈0.424, b₅=4/(5π)≈0.255 (all aₙ=0).

Frequently Asked Questions

  • A Fourier series decomposes a periodic function into a sum of sine and cosine waves. Any periodic function f(x) with period 2L can be written as a₀ + Σ[aₙcos(nπx/L) + bₙsin(nπx/L)].
  • a₀ = (1/2L)∫f(x)dx (DC offset); aₙ = (1/L)∫f(x)cos(nπx/L)dx; bₙ = (1/L)∫f(x)sin(nπx/L)dx — each integral over one full period.
  • The square wave has only odd harmonics: f(x) = (4/π)[sin(πx/L) + sin(3πx/L)/3 + sin(5πx/L)/5 + ...]. All cosine terms (aₙ) are zero due to odd symmetry.
  • Parseval's theorem states that the total energy in a signal equals the sum of squared Fourier coefficients: (1/L)∫|f|²dx = 2a₀² + Σ(aₙ²+bₙ²)/2. It connects signal energy to spectral energy.
  • f(x) = Σcₙe^(inπx/L) where cₙ = (1/2L)∫f(x)e^(-inπx/L)dx. The magnitude |cₙ| gives the amplitude of the nth harmonic.

Related Calculators

Sources & References (5)
  1. Fourier Series — MIT OCW 18.03 — MIT OpenCourseWare
  2. Fourier Series — Wolfram MathWorld — Wolfram MathWorld
  3. NIST DLMF Ch. 1.8 — Fourier Series — NIST
  4. Boyce & DiPrima — Elementary Differential Equations Ch. 10 — Wiley
  5. Fourier Series — Khan Academy — Khan Academy