49  Fourier series

Every periodic signal is a sum of pure frequencies

The Fourier series starts from a single observation: the simplest periodic functions are sines and cosines. They oscillate at a fixed frequency, they never change shape, and their behaviour is completely described by amplitude and phase. Every other periodic function — however jagged, however asymmetric — can be built from them by superposition. The question is: how do you find the right mix?

The answer is integration. Multiply the function by each candidate sine or cosine and integrate over one period. The result, as we will show, is exactly the amplitude of that frequency component. Everything else cancels out.


49.1 What this chapter helps you do

Symbols to keep handy

These are the bits of notation you'll see a lot. If a line of symbols feels like a fence, read it out loud once, then keep going.

  • a_n, b_n: Fourier coefficients a-n and b-n

  • c_n: complex Fourier coefficient c-n

Definitions to keep handy

These are the words we keep coming back to. If one feels slippery, come back here and steady it before you push on.

  • Fourier series: A way to write a periodic function as a sum of sines and cosines at different harmonics.

  • Fourier coefficients: Numbers that tell you how much of each frequency is present in the signal.

  • harmonic: A frequency that is an integer multiple of the fundamental frequency.

  • orthogonality: A cancellation property: different sine/cosine modes don’t overlap when you integrate over a full period.

  • Gibbs phenomenon: The characteristic overshoot near a jump discontinuity that doesn’t disappear, even as you add more terms.

This chapter teaches you how to decompose a periodic function into pure frequencies and compute how much of each frequency is present. You will learn to:

  • recognise when a function is periodic and choose a convenient interval for one period
  • write the Fourier series as a sum of sine/cosine modes
  • compute the coefficients a_n and b_n by integration (using orthogonality)
  • interpret what the coefficients mean: which harmonics are strong, which are absent
  • understand what convergence means near jumps (Gibbs phenomenon) without being surprised by it

Watch for this

  • The series is infinite. In practice you use partial sums: “first N modes.”
  • Symmetry (even/odd) is free power: it can make half the coefficients exactly zero.
  • A Fourier series approximates discontinuities in a specific way: more terms improves the fit everywhere except at the jump itself, where the overshoot persists but squeezes into a smaller region.

49.2 Periodic functions

A function f is periodic with period T if f(x + T) = f(x) for all x. The smallest such T > 0 is called the fundamental period.

We often write T = 2L, which places one full period over the symmetric interval [-L, L]. That symmetry is why the coefficient integrals run from -L to L and why the modes appear as \cos(n\pi x/L) and \sin(n\pi x/L): the scaling makes each mode complete an integer number of half-waves over the interval.

Familiar examples: \sin(nx) and \cos(nx) have period 2\pi/n; the square wave (defined below) has the same period as the fundamental sine used to construct it.

The idea geometrically. A periodic function is completely determined by its values on any interval of length T. Knowing one period is knowing everything. The Fourier series asks: which sum of sines and cosines, with the same period, most accurately represents f?


49.3 The Fourier series

For a function f of period 2L, the Fourier series is:

How to read the Fourier series notation

  • Symbol: \displaystyle 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]

  • Reads as: “f equals a constant plus a sum of cosine and sine modes”

  • Means: each term is one pure frequency; the coefficients tell you how strong that frequency is

  • Use when: you need frequency content of a periodic signal or an initial condition for a PDE

  • Common misread: n is an index (1,2,3,…) not a variable; L sets the period (2L)

  • Symbol: a_n, b_n

  • Reads as: “a-sub-n, b-sub-n”

  • Means: cosine and sine amplitudes of the nth harmonic

  • Use when: reconstructing the signal from its modes

  • Common misread: the coefficients are found by integrals over one period; they are not chosen by guesswork

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]

The Fourier coefficients are:

a_0 = \frac{1}{L}\int_{-L}^{L} f(x)\,dx

a_n = \frac{1}{L}\int_{-L}^{L} f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx \qquad (n = 1, 2, 3, \ldots)

b_n = \frac{1}{L}\int_{-L}^{L} f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx \qquad (n = 1, 2, 3, \ldots)

The term a_0/2 is the mean value of f over one period. The a_n terms give the amplitudes of the cosine components; the b_n terms give the amplitudes of the sine components.

49.3.1 Why these formulas: orthogonality

The formulas above are not guessed — they follow from a single property of the trigonometric functions: orthogonality.

Over the interval [-L, L]:

\int_{-L}^{L}\cos\!\left(\frac{m\pi x}{L}\right)\cos\!\left(\frac{n\pi x}{L}\right)dx = \begin{cases} 0 & m \neq n \\ L & m = n \geq 1 \\ 2L & m = n = 0 \end{cases}

\int_{-L}^{L}\sin\!\left(\frac{m\pi x}{L}\right)\sin\!\left(\frac{n\pi x}{L}\right)dx = \begin{cases} 0 & m \neq n \\ L & m = n \geq 1 \end{cases}

\int_{-L}^{L}\cos\!\left(\frac{m\pi x}{L}\right)\sin\!\left(\frac{n\pi x}{L}\right)dx = 0 \qquad \text{for all } m, n

These follow from the product-to-sum identities. Take the m \neq n case of the cosine integral as an example: the identity \cos A \cos B = \tfrac{1}{2}[\cos(A-B)+\cos(A+B)] turns the product into a sum of two cosines at frequencies (m-n)\pi/L and (m+n)\pi/L. Integrating either of those over exactly one complete period gives zero — the positive and negative half-cycles cancel. When m = n the first term becomes \cos(0) = 1, which integrates to 2L, accounting for the factor of L in the diagonal case. The sine-sine and cosine-sine cases follow by the same argument with the analogous identities.

They mean that multiplying the Fourier series by \cos(m\pi x/L) and integrating over [-L, L] kills every term except the one with n = m — which is exactly how a_m is isolated. This means orthogonality is the filtering mechanism behind the coefficient formulas: integration keeps the matching frequency and cancels the rest.

Optional viewpoint: a dot product for functions

If you know dot products, you can treat integration as a dot product for functions:

\langle f, g\rangle = \frac{1}{L}\int_{-L}^{L} f(x)\,g(x)\,dx.

Then “orthogonal” means \langle \cos(m\pi x/L), \cos(n\pi x/L)\rangle = 0 when m\neq n, and the coefficient formulas are exactly “projection” formulas: a_n = \langle f, \cos(n\pi x/L)\rangle and b_n = \langle f, \sin(n\pi x/L)\rangle.


49.4 Worked example: the square wave

Define the square wave with period 2\pi as:

f(x) = \begin{cases} 1 & 0 < x < \pi \\ -1 & -\pi < x < 0 \end{cases}

extended periodically to all x.

Step 1: compute a_0.

a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\,dx = \frac{1}{\pi}\left[\int_{-\pi}^{0}(-1)\,dx + \int_{0}^{\pi}(1)\,dx\right] = \frac{1}{\pi}[-\pi + \pi] = 0

The mean value is zero — the positive and negative halves cancel.

Step 2: compute a_n.

f(x) is an odd function: f(-x) = -f(x). The cosines \cos(nx) are even functions. An odd function times an even function is odd, and the integral of an odd function over a symmetric interval is zero:

a_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos(nx)\,dx = 0 \quad \text{for all } n \geq 1

Step 3: compute b_n.

\sin(nx) is odd; f is odd; their product is even:

b_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin(nx)\,dx = \frac{2}{\pi}\int_{0}^{\pi}\sin(nx)\,dx

= \frac{2}{\pi}\left[-\frac{\cos(nx)}{n}\right]_{0}^{\pi} = \frac{2}{n\pi}\left[1 - \cos(n\pi)\right] = \frac{2}{n\pi}\left[1 - (-1)^n\right]

Here \cos(n\pi) = (-1)^n for any integer n: the cosine alternates between -1 and 1 at multiples of \pi. When n is even, \cos(n\pi) = 1, so b_n = 0. When n is odd, \cos(n\pi) = -1, so b_n = 4/(n\pi).

Result:

f(x) = \frac{4}{\pi}\left[\sin(x) + \frac{\sin(3x)}{3} + \frac{\sin(5x)}{5} + \frac{\sin(7x)}{7} + \cdots\right]

The partial sums progressively sharpen toward the square wave, with the edges becoming steeper as more terms are included.


49.5 Convergence and the Gibbs phenomenon

The Fourier series of a well-behaved periodic function converges in the following sense.

Dirichlet conditions. If f is periodic, bounded, and piecewise continuous (at most finitely many jump discontinuities per period, and finitely many maxima and minima per period), then:

  • At points where f is continuous, the Fourier series converges to f(x).
  • At a jump discontinuity x_0, the Fourier series converges to the average of the left and right limits: \frac{1}{2}\left[f(x_0^-) + f(x_0^+)\right].

Gibbs phenomenon. Near a jump discontinuity, the partial sums overshoot the true value by approximately 8.9\% of the jump height, regardless of how many terms are included. Adding more terms moves the overshoot closer to the discontinuity but does not reduce its size. This is not an error in the method — it is a fundamental property of Fourier partial sums near discontinuities. It appears in real systems as ringing — the ripple artefact you see in a sharply filtered audio signal or a steeply edge-enhanced image.

The important nuance is that the approximation is getting better almost everywhere: the mismatch away from the jump shrinks as you add modes. The stubborn overshoot survives only in a small neighbourhood that gets narrower as N increases.

For the square wave with a jump of magnitude 2, the Gibbs overshoot is approximately 2 \times 0.089 \approx 0.18.


49.6 Even and odd functions

Identifying the symmetry of f before computing is practical, not just elegant: it cuts the integration work in half.

Even function (f(-x) = f(x), symmetric about the y-axis): odd-function integrands vanish, so b_n = 0 for all n. The Fourier series is a cosine series:

f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n\cos\!\left(\frac{n\pi x}{L}\right)

Odd function (f(-x) = -f(x), antisymmetric about the y-axis): even-function integrands vanish, so a_n = 0 for all n. The Fourier series is a sine series:

f(x) = \sum_{n=1}^{\infty} b_n\sin\!\left(\frac{n\pi x}{L}\right)

The square wave example above was odd, which is why we only needed to compute b_n.


49.7 Half-range series

Often f is defined only on [0, L] — for example, the initial temperature profile in a rod. We cannot compute a full Fourier series without knowing f on [-L, 0], but we can choose how to extend it:

  • Even extension: define f(-x) = f(x) on [-L, 0]. This produces a Fourier cosine series with only a_n terms: f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n\cos\!\left(\frac{n\pi x}{L}\right), \quad a_n = \frac{2}{L}\int_0^L f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx

  • Odd extension: define f(-x) = -f(x) on [-L, 0]. This produces a Fourier sine series with only b_n terms: f(x) = \sum_{n=1}^{\infty} b_n\sin\!\left(\frac{n\pi x}{L}\right), \quad b_n = \frac{2}{L}\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx

Which to choose? The boundary conditions of the physical problem decide: if f(0) = f(L) = 0 is required (as in a fixed-end vibrating string or a rod with fixed-temperature endpoints), use the sine extension. If the derivative f'(0) = f'(L) = 0 is required (insulated endpoints), use the cosine extension.

For heat problems, “insulated” means no heat flux through the boundary. Because heat flux is proportional to the temperature gradient, that gives the condition u_x = 0 at the endpoints.


49.8 Complex Fourier series

Using Euler’s formula e^{i\theta} = \cos\theta + i\sin\theta, the Fourier series can be written in complex exponential form:

f(x) = \sum_{n=-\infty}^{\infty} c_n\,e^{in\pi x/L}

where the complex Fourier coefficients are:

c_n = \frac{1}{2L}\int_{-L}^{L} f(x)\,e^{-in\pi x/L}\,dx

The relationship to the real coefficients: c_0 = a_0/2, c_n = (a_n - ib_n)/2, c_{-n} = (a_n + ib_n)/2 = \overline{c_n} for n \geq 1.

This means the complex form does not introduce new information. It repackages the sine and cosine coefficients into a single symmetric sequence.

To see the c_n formula in one line, expand the exponential: e^{-in\pi x/L}=\cos(n\pi x/L)-i\sin(n\pi x/L). Then

c_n=\frac{1}{2L}\int_{-L}^{L} f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx - \frac{i}{2L}\int_{-L}^{L} f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx = \frac{a_n-ib_n}{2}.

The complex form is more compact and connects directly to the Fourier transform: letting L \to \infty (so the period grows without bound) turns the discrete sum into an integral — the subject of the next chapter.


49.9 Parseval’s theorem

The total energy of a periodic signal is distributed across its frequency components. Parseval’s theorem makes this precise:

\frac{1}{L}\int_{-L}^{L}|f(x)|^2\,dx = \frac{a_0^2}{2} + \sum_{n=1}^{\infty}(a_n^2 + b_n^2)

In the complex form: \frac{1}{2L}\int_{-L}^{L}|f|^2\,dx = \sum_{n=-\infty}^{\infty}|c_n|^2.

The right side is the sum of squared amplitudes of each Fourier mode — the power spectrum. Parseval’s theorem says that power is conserved: the total power in the time domain equals the total power in the frequency domain. It also provides a shortcut for evaluating certain series (see Exercise 5).


49.10 Applications

49.10.1 Signal analysis and filtering

A microphone converts a sound wave into a voltage signal f(t). To apply an equaliser (boost bass, cut treble), you compute the Fourier coefficients, multiply each b_n by the desired gain at frequency n, and reconstruct. In practice this is done with the Fast Fourier Transform (FFT), which computes all N Fourier coefficients in O(N \log N) operations instead of O(N^2). The Fast Fourier Transform (FFT) is an algorithm that computes all N discrete Fourier coefficients in O(N \log N) arithmetic operations rather than the O(N^2) operations needed by direct summation. For N = 1024 this is roughly a hundredfold speedup; for N = 10^6 the gap is enormous. The FFT is what makes real-time frequency analysis practical — a direct calculation would be too slow for audio, video, and communications applications.

49.10.2 Heat equation initial conditions

The heat equation on a rod of length L with zero-temperature endpoints:

\frac{\partial u}{\partial t} = \alpha^2\frac{\partial^2 u}{\partial x^2}, \qquad u(0,t) = u(L,t) = 0

has general solution u(x,t) = \sum_{n=1}^{\infty} B_n\sin(n\pi x/L)\,e^{-\alpha^2 n^2\pi^2 t/L^2}.

The coefficients B_n are exactly the Fourier sine coefficients of the initial temperature profile u(x,0) = f(x). Higher-frequency modes (large n) decay exponentially faster — this is why sharp temperature gradients smooth out quickly while broad gradients persist. The Fourier series is not just a tool for computing the answer: it explains the physics.


49.11 Where this goes

Fourier series is the prerequisite for two next steps in this volume.

Fourier transforms (next chapter). Fourier series decomposes periodic signals into discrete frequencies. Fourier transforms extend the same idea to non-periodic signals, giving a continuous frequency spectrum. The computational tools (FFT, filtering, spectrum analysis) make more sense once the series picture is secure.

Partial differential equations (later in this block). Separation of variables turns many PDEs into independent Fourier mode problems. Each sine/cosine mode evolves on its own, and the Fourier coefficients encode the initial condition.

Complex analysis enriches both: the complex-exponential form of the series is a first encounter with exponentials as the natural language of oscillation, and it points toward contour-integral interpretations later.

49.12 What you can do now

You can now take a periodic function, compute its Fourier coefficients, and build an approximation from the first few modes. You can use symmetry to simplify the computation, interpret coefficients as frequency content, and understand what convergence does near discontinuities (Gibbs phenomenon).

49.13 Exercises


49.13.1 Exercise 1: Fourier coefficients of the square wave

Compute all Fourier coefficients for f(x) = 1 for 0 < x < \pi and f(x) = -1 for -\pi < x < 0, period 2\pi. Write out the first four nonzero terms of the series.


49.13.2 Exercise 2: Sawtooth wave Fourier coefficients

The function f(x) = x for -\pi < x < \pi, extended with period 2\pi, is the sawtooth wave. Compute its Fourier series.


49.13.3 Exercise 3: Half-range cosine series for f(x) = x

Find the half-range Fourier cosine series of f(x) = x on 0 < x < \pi.


49.13.4 Exercise 4: Half-range sine series for f(x) = 1

Find the half-range Fourier sine series of f(x) = 1 on 0 < x < L. Interpret the result.


49.13.5 Exercise 5: Parseval’s theorem and a series sum

Apply Parseval’s theorem to the square wave result from Exercise 1 to evaluate \displaystyle\sum_{k=0}^{\infty}\frac{1}{(2k+1)^2}.


49.13.6 Exercise 6: Heat equation — reading off the solution from a Fourier series

A rod of length L = \pi has initial temperature u(x,0) = 3\sin(x) - \sin(2x) for 0 < x < \pi. The endpoints are held at zero: u(0,t) = u(\pi,t) = 0. The heat equation is u_t = \alpha^2 u_{xx}.

Write down the complete solution u(x,t) and identify which component decays faster.