Mathwords logoMathwords

Fourier Series — Definition, Formula & Examples

A Fourier series is a way to represent a periodic function as an infinite sum of sine and cosine terms. Each term captures a specific frequency component of the original function, allowing complex waveforms to be broken into simple oscillations.

Let f(x)f(x) be a periodic function with period 2L2L that is piecewise continuous on [L,L][-L, L]. The Fourier series of ff is a02+n=1[ancos ⁣(nπxL)+bnsin ⁣(nπxL)]\frac{a_0}{2} + \sum_{n=1}^{\infty}\left[a_n \cos\!\left(\frac{n\pi x}{L}\right) + b_n \sin\!\left(\frac{n\pi x}{L}\right)\right], where the coefficients ana_n and bnb_n are determined by integrating ff against the corresponding trigonometric basis functions over one full period.

Key Formula

f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left[a_n \cos\!\left(\frac{n\pi x}{L}\right) + b_n \sin\!\left(\frac{n\pi x}{L}\right)\right]$$ $$a_0 = \frac{1}{L}\int_{-L}^{L} f(x)\,dx, \quad a_n = \frac{1}{L}\int_{-L}^{L} f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx, \quad b_n = \frac{1}{L}\int_{-L}^{L} f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx
Where:
  • f(x)f(x) = The periodic function being represented
  • LL = Half the period of f(x), so the full period is 2L
  • a0a_0 = The zeroth coefficient, related to the average value of f
  • ana_n = Cosine coefficients for n = 1, 2, 3, ...
  • bnb_n = Sine coefficients for n = 1, 2, 3, ...
  • nn = Positive integer index for each harmonic term

How It Works

To build a Fourier series, you compute three sets of coefficients: a0a_0, ana_n, and bnb_n. Each coefficient is found by multiplying the original function by the matching sine or cosine and integrating over one period. The result is an infinite series that, under mild conditions (Dirichlet conditions), converges to f(x)f(x) at points of continuity and to the average of the left- and right-hand limits at jump discontinuities. Adding more terms improves the approximation, with each successive harmonic refining finer details of the waveform.

Worked Example

Problem: Find the Fourier series of the square wave defined by f(x) = −1 for −π < x < 0 and f(x) = 1 for 0 < x < π, with period 2π.
Identify the period: The period is 2π, so L = π.
L=πL = \pi
Compute a₀: Since f is an odd function (f(−x) = −f(x)), its integral over a symmetric interval is zero.
a0=1πππf(x)dx=0a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\,dx = 0
Compute aₙ: The product of an odd function f(x) and an even function cos(nx) is odd, so the integral vanishes.
an=1πππf(x)cos(nx)dx=0a_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos(nx)\,dx = 0
Compute bₙ: Since f is odd, only sine terms survive. We integrate over the half-period where f(x) = 1 and double the result.
bn=2π0π(1)sin(nx)dx=2π[cos(nx)n]0π=2nπ(1cos(nπ))b_n = \frac{2}{\pi}\int_{0}^{\pi}(1)\sin(nx)\,dx = \frac{2}{\pi}\left[-\frac{\cos(nx)}{n}\right]_0^{\pi} = \frac{2}{n\pi}\left(1 - \cos(n\pi)\right)
Simplify bₙ: Note that cos(nπ) = (−1)ⁿ. When n is even, bₙ = 0. When n is odd, bₙ = 4/(nπ).
bn={4nπn odd0n evenb_n = \begin{cases} \dfrac{4}{n\pi} & n \text{ odd} \\ 0 & n \text{ even} \end{cases}
Write the series: Substitute back into the Fourier series formula.
f(x)=4π(sinx+sin3x3+sin5x5+)=4πk=0sin ⁣((2k+1)x)2k+1f(x) = \frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \frac{\sin 5x}{5} + \cdots\right) = \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\sin\!\big((2k+1)x\big)}{2k+1}
Answer: The Fourier series is f(x)=4πk=0sin ⁣((2k+1)x)2k+1f(x) = \dfrac{4}{\pi}\displaystyle\sum_{k=0}^{\infty}\dfrac{\sin\!\big((2k+1)x\big)}{2k+1}.

Visualization

Why It Matters

Fourier series are central to courses in differential equations, signal processing, and mathematical physics. Engineers use them to analyze vibrations, heat conduction, and audio signals by decomposing complex waveforms into manageable frequency components. Mastering Fourier series also lays the groundwork for the Fourier transform, which extends the same idea to non-periodic functions.

Common Mistakes

Mistake: Forgetting the factor of ½ on the a₀ term
Correction: The constant term is a₀/2, not a₀. Writing just a₀ doubles the average-value contribution and shifts the entire series vertically.
Mistake: Using odd/even symmetry shortcuts without verifying the function's symmetry
Correction: Only set all aₙ = 0 if f is truly odd, and only set all bₙ = 0 if f is truly even. Check f(−x) = −f(x) or f(−x) = f(x) before skipping integrals.

Related Terms