Fourier Series Expansions

Part 13, Chapter 13: Fourier Series and Transforms

Learning objectives

  • Write the Fourier series of a 2π2\pi-periodic function
  • Compute ana_n and bnb_n via integral formulas
  • Use orthogonality of {1,cos(nx),sin(nx)}\{1, \cos(nx), \sin(nx)\} to derive the coefficient formulas
  • Exploit even/odd symmetry to predict which coefficients vanish

If every reasonable 2pi2\pi-periodic function is a sum of sines and cosines, how do you find the coefficients? The answer is one of the most elegant constructions in mathematics: the trigonometric system is orthogonal in the integral inner product, so each coefficient is recovered by a single integration. The Fourier-coefficient formula is just the inner product of ff with the basis function, divided by the basis function's norm. Once you internalize that one idea, every special-symmetry rule (odd functions have no cosines, even functions have no sines) becomes obvious.

The Fourier series

Let ff be a 2pi2\pi-periodic function on [-\pi, \pi]. Its Fourier series is the formal sum

f(x)simdfraca02+displaystylesumn=1inftybigl(ancos(nx)+bnsin(nx)bigr)f(x) \sim \dfrac{a_0}{2} + \displaystyle\sum_{n=1}^{\infty} \bigl(a_n \cos(nx) + b_n \sin(nx)\bigr)n=1inftybigl(ancos(nx)+bnsin(nx)bigr)

where the Fourier coefficients are computed by:

an=dfrac1pidisplaystyleintpipif(x)cos(nx),dx,quadn=0,1,2,ldotsa_n = \dfrac{1}{\pi} \displaystyle\int_{-\pi}^{\pi} f(x) \cos(nx) \, dx, \quad n = 0, 1, 2, \ldotspipif(x)cos(nx),dx,quadn=0,1,2,ldots

bn=dfrac1pidisplaystyleintpipif(x)sin(nx),dx,quadn=1,2,3,ldotsb_n = \dfrac{1}{\pi} \displaystyle\int_{-\pi}^{\pi} f(x) \sin(nx) \, dx, \quad n = 1, 2, 3, \ldotspipif(x)sin(nx),dx,quadn=1,2,3,ldots

The factor of 1/pi1/\pi comes from the inner-product norm, and the constant term gets a factor of a_0/2a_0 / 2 for tidiness. The sim\sim symbol (instead of ==) is a reminder that convergence of the right side to ff is a separate question, taken up in section 13.3.

Why the formula works: orthogonality

Equip the space of square-integrable functions on [-\pi, \pi] with the inner product langlef,grangle=intpipif(x)g(x),dx\langle f, g \rangle = \int_{-\pi}^{\pi} f(x) g(x) \, dxpipif(x)g(x),dx. The system 1,cos(x),sin(x),cos(2x),sin(2x),ldots\{1, \cos(x), \sin(x), \cos(2x), \sin(2x), \ldots\} is orthogonal: any two distinct basis functions integrate to zero against each other. The product-to-sum identities give

\displaystyle\int_{-\pi}^{\pi} \cos(mx) \cos(nx) \, dx = \begin{cases} 0, & m \neq n \\ \pi, & m = n \geq 1 \\ 2\pi, & m = n = 0 \end{cases}

and analogous formulas for sine-sine and sine-cosine products. To find ama_mm, multiply the Fourier series by cos(mx)\cos(mx) and integrate term by term: all terms vanish except the mm-th cosine term, which contributes amcdotpia_m \cdot \pimcdotpi. Solving gives the formula am=(1/pi)intfcos(mx),dxa_m = (1/\pi) \int f \cos(mx) \, dxm=(1/pi)intfcos(mx),dx.

The series summer lets you stack partial sums of a Fourier series. Try the square wave f(x)=textsign(x)f(x) = \text{sign}(x) on [-\pi, \pi], the first few odd harmonics with coefficients 4/(pin)4/(\pi n) already give a recognisable square shape. The amplitude of each new term decays as 1/n1/n, so adding terms rapidly diminishes the visible error away from the jumps.

Even/odd shortcuts

The integrand f(x)cos(nx)f(x) \cos(nx) is even if ff is even (even times even). Its integral over [-\pi, \pi] equals twice the integral over [0, \pi], you save half the work. The integrand f(x)sin(nx)f(x) \sin(nx) is odd if ff is even (even times odd), so it integrates to zero: every bn=0b_n = 0n=0 for an even ff. Symmetrically, odd ff has every an=0a_n = 0n=0 and only sine terms appear. Always check the symmetry of ff before computing any integral.

Where this shows up
  • MP3, AAC, Opus audio: Modern audio codecs apply a windowed Fourier-like transform (modified DCT) to short frames of a recording, quantise the coefficients aggressively, and store only the perceptually significant ones. The "frequency-domain compression" the standards talk about is exactly Fourier coefficient quantisation.
  • JPEG image compression: JPEG splits an image into 8x8 pixel blocks and computes a 2D discrete cosine transform of each block. Cosine basis functions are chosen because images tend to be smooth (the highest-frequency cosine coefficient is usually tiny), and the few large coefficients suffice to reconstruct the block.
  • Heat equation solutions: When you separate variables on the heat equation ut=uxxu_t = u_{xx}xx on [0, L] with zero boundary, the solution is a Fourier sine series in xx with time-dependent coefficients. Section 14.4 makes this explicit.
  • Music synthesis: Additive synthesisers build a tone by summing sinusoids at integer multiples of the fundamental, each with its own amplitude envelope. This is literally constructing a sound from its Fourier coefficients in real time.

Pause and think: Suppose you compute an=0a_n = 0n=0 for every nn. Does that force fequiv0f \equiv 0? (Hint: think about what happens if ff is odd. Cosine coefficients vanish, but the function is non-zero.)

Try it

  • Compute a0a_0 for f(x)=x2f(x) = x^2 on [-\pi, \pi]. Use the formula a0=(1/pi)intpipix2,dxa_0 = (1/\pi) \int_{-\pi}^{\pi} x^2 \, dxpipix2,dx and the symmetry of x2x^2.
  • Before integrating: which Fourier coefficients of f(x)=x3f(x) = x^3 on [-\pi, \pi] vanish, and why?
  • Verify directly: intpipisin(2x)cos(3x),dx=0\int_{-\pi}^{\pi} \sin(2x) \cos(3x) \, dx = 0pipisin(2x)cos(3x),dx=0. (Use the product-to-sum identity \sin a \cos b = \tfrac{1}{2}[\sin(a+b) + \sin(a-b)].)
  • On the series-summer widget, build sumn=1,3,5,ldotsN(4/(pin))sin(nx)\sum_{n=1,3,5,\ldots}^{N} (4/(\pi n)) \sin(nx)n=1,3,5,ldotsN(4/(pin))sin(nx) for N=1,3,5,9N = 1, 3, 5, 9. Each partial sum is the Fourier series of the square wave truncated at NN terms. Sketch how the graph evolves.
  • Find the Fourier coefficients of the constant function f(x)=7f(x) = 7 on [-\pi, \pi].
  • A trap to watch for

    The constant term a0/2a_0/2 (not a0a_0) is the average value of ff over [-\pi, \pi]. Students routinely write the Fourier series as a0+sum(ancosnx+bnsinnx)a_0 + \sum (a_n \cos nx + b_n \sin nx)ncosnx+bnsinnx), dropping the factor of 1/21/2. That extra factor exists because the cosine of 0x0x is the constant 11, and the inner-product norm of 11 is 2pi2\pi rather than pi\pi, without the 1/21/2, the formula for a_0a_0 would double-count the constant. The convention is annoying but universal; always include the 1/21/2.

    What you now know

    You can compute Fourier coefficients of a 2pi2\pi-periodic function, use even/odd symmetry to predict which integrals vanish, and explain why the formulas come from inner-product projection onto an orthogonal basis. The next section asks the convergence question: does the Fourier series actually reconstruct ff, and in what sense?

    Mark section complete →

    References

    • Garrity, T. (2002). All the Mathematics You Missed: But Need to Know for Graduate School. Cambridge University Press, ch. 13.
    • Stein, E. M., Shakarchi, R. (2003). Fourier Analysis: An Introduction. Princeton University Press, ch. 2.
    • Folland, G. B. (1992). Fourier Analysis and Its Applications. Wadsworth & Brooks/Cole, ch. 2.
    • Bracewell, R. N. (1999). The Fourier Transform and Its Applications (3rd ed.). McGraw-Hill, ch. 2.
    • Korner, T. W. (1989). Fourier Analysis. Cambridge University Press, ch. 2 (orthogonality and Fourier coefficients).

    This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.