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)simdfraca_02+displaystylesum_n=1inftybigl(a_ncos(nx)+b_nsin(nx)bigr)f(x) \\sim \\dfrac{a\_0}{2} + \\displaystyle\\sum\_{n=1}^{\\infty} \\bigl(a\_n \\cos(nx) + b\_n \\sin(nx)\\bigr)

where the Fourier coefficients are computed by:

a_n=dfrac1pidisplaystyleint_pipif(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, \\ldots b_n=dfrac1pidisplaystyleint_pipif(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, \\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=int_pipif(x)g(x),dx\\langle f, g \\rangle = \\int\_{-\\pi}^{\\pi} f(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 a_ma\_m, 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 a_mcdotpia\_m \\cdot \\pi. Solving gives the formula a_m=(1/pi)intfcos(mx),dxa\_m = (1/\\pi) \\int f \\cos(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 b_n=0b\_n = 0 for an even ff. Symmetrically, odd ff has every a_n=0a\_n = 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 u_t=u_xxu\_t = u\_{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 a_n=0a\_n = 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 a_0a\_0 for f(x)=x2f(x) = x^2 on \[-\\pi, \\pi\]. Use the formula a_0=(1/pi)int_pipix2,dxa\_0 = (1/\\pi) \\int\_{-\\pi}^{\\pi} x^2 \\, 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: int_pipisin(2x)cos(3x),dx=0\\int\_{-\\pi}^{\\pi} \\sin(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 sum_n=1,3,5,ldotsN(4/(pin))sin(nx)\\sum\_{n=1,3,5,\\ldots}^{N} (4/(\\pi n)) \\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 a_0/2a\_0/2 (not a_0a\_0) is the average value of ff over \[-\\pi, \\pi\]. Students routinely write the Fourier series as a_0+sum(a_ncosnx+b_nsinnx)a\_0 + \\sum (a\_n \\cos nx + b\_n \\sin nx), 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.