4.7.3Partial Differential Equations

Fourier series — motivation from periodic functions

1,951 words9 min readdifficulty · medium6 backlinks

WHY do we even want this?

WHAT is a periodic function?

The simplest periodic functions are cos(nωx)\cos(n\omega x) and sin(nωx)\sin(n\omega x). All of them share the period TT (they fit a whole number nn of cycles inside one period). So they are perfect Lego bricks for anything of period TT.


HOW do we build the series? (Derivation from scratch)

We claim that a periodic function ff of period 2L2L (so ω=π/L\omega = \pi/L) can be written:

f(x)=a02+n=1(ancosnπxL+bnsinnπxL)f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\Big( a_n\cos\tfrac{n\pi x}{L} + b_n\sin\tfrac{n\pi x}{L}\Big)

The whole problem is: what are the numbers an,bna_n, b_n? We derive them, we don't memorise them.

Step 1 — The orthogonality trick (WHY it works)

The integrals we need (all over L-L to LL):

LLcosnπxLcosmπxLdx={0nmLn=m02Ln=m=0\int_{-L}^{L}\cos\tfrac{n\pi x}{L}\cos\tfrac{m\pi x}{L}\,dx = \begin{cases}0 & n\neq m\\ L & n=m\neq0\\ 2L & n=m=0\end{cases}

LLsinnπxLsinmπxLdx={0nmLn=m\int_{-L}^{L}\sin\tfrac{n\pi x}{L}\sin\tfrac{m\pi x}{L}\,dx = \begin{cases}0 & n\neq m\\ L & n=m\end{cases}

LLsinnπxLcosmπxLdx=0(always)\int_{-L}^{L}\sin\tfrac{n\pi x}{L}\cos\tfrac{m\pi x}{L}\,dx = 0 \quad\text{(always)}

Why are these true? Use product-to-sum, e.g. cosAcosB=12[cos(AB)+cos(A+B)]\cos A\cos B = \tfrac12[\cos(A-B)+\cos(A+B)]. Each piece is cos(kπx/L)\cos(k\pi x/L) with integer kk; integrating a full number of cycles over [L,L][-L,L] gives 00, unless k=0k=0 (a constant), which survives.

Step 2 — Extract ama_m (HOW)

Multiply the series by cos(mπx/L)\cos(m\pi x/L) and integrate L-L to LL:

LLf(x)cosmπxLdx=a02cosmπxLdx=0 (m1)+nan ⁣ ⁣cosnπxLcosmπxLdx=L only if n=m+nbn()=0\int_{-L}^{L} f(x)\cos\tfrac{m\pi x}{L}\,dx = \underbrace{\frac{a_0}{2}\int\cos\tfrac{m\pi x}{L}dx}_{=0\ (m\geq1)} + \sum_n a_n\!\!\underbrace{\int\cos\tfrac{n\pi x}{L}\cos\tfrac{m\pi x}{L}dx}_{=L\ \text{only if }n=m} + \sum_n b_n\underbrace{(\dots)}_{=0}

Why this step? Orthogonality kills every term except the single n=mn=m cosine term, leaving amLa_m \cdot L. So:

am=1LLLf(x)cosmπxLdx\boxed{\,a_m = \frac{1}{L}\int_{-L}^{L} f(x)\cos\tfrac{m\pi x}{L}\,dx\,}

The a0/2a_0/2 choice makes a0=1LLLfdxa_0 = \frac1L\int_{-L}^L f\,dx = twice the average, so a0/2a_0/2 = the average value. Neat.

Step 3 — Extract bmb_m

Same trick with sin(mπx/L)\sin(m\pi x/L):

bm=1LLLf(x)sinmπxLdx\boxed{\,b_m = \frac{1}{L}\int_{-L}^{L} f(x)\sin\tfrac{m\pi x}{L}\,dx\,}

Figure — Fourier series — motivation from periodic functions

Symmetry shortcut (the 80/20 win)


Worked Examples


Forecast-then-Verify

Recall Forecast before reading on

Q: For an even triangle wave, before computing — which coefficients are zero, and why?

A: All bn=0b_n=0, because the function is even and sines are odd; only cosines (which match even symmetry) appear. Verified by the symmetry rule.


Common Mistakes (Steel-manned)


Flashcards

What does it mean for ff to be periodic with period TT?
f(x+T)=f(x)f(x+T)=f(x) for all xx; smallest such T>0T>0 is the fundamental period.
What single property of sines/cosines lets us extract Fourier coefficients?
Orthogonality: integrals of products of distinct sines/cosines over one period are zero.
Formula for ana_n (period 2L2L)?
an=1LLLf(x)cosnπxLdxa_n=\frac1L\int_{-L}^{L} f(x)\cos\frac{n\pi x}{L}\,dx.
Formula for bnb_n (period 2L2L)?
bn=1LLLf(x)sinnπxLdxb_n=\frac1L\int_{-L}^{L} f(x)\sin\frac{n\pi x}{L}\,dx.
Why is the constant term written a0/2a_0/2?
So that a0a_0 uses the same 1L\frac1L formula as other ana_n; then a0/2a_0/2 equals the average of ff.
If ff is even, which coefficients vanish?
All bn=0b_n=0 (only cosines survive).
If ff is odd, which coefficients vanish?
All an=0a_n=0 (only sines survive).
What does the Fourier series converge to at a jump discontinuity?
The midpoint 12[f(x+)+f(x)]\frac12[f(x^+)+f(x^-)].
What is the Gibbs phenomenon?
Persistent ~9% overshoot of the partial sums near a jump that doesn't vanish as terms increase.
Fourier series of the square wave (±1, period 2π2\pi)?
4πodd nsinnxn\frac4\pi\sum_{\text{odd }n}\frac{\sin nx}{n} — odd harmonics only.
Why do PDE solvers need Fourier series?
Separation of variables gives sine/cosine modes; matching an arbitrary initial condition requires expanding it in those modes.

Recall Feynman: explain to a 12-year-old

Imagine you have a weird wiggly line that repeats forever, like a heartbeat monitor. You also have a box of "pure musical notes," each a smooth wave. Fourier's amazing discovery: you can recreate that weird wiggle perfectly by playing the right mix of those pure notes — some loud, some soft, some high-pitched, some low. The "recipe card" for the mix is found by a clever sliding-and-adding trick (integration) that asks "how much of this note is hiding in my wiggle?" Because the notes never get confused with each other (orthogonality), each question gives one clean answer.


Connections

  • Separation of Variables — produces the sine/cosine modes Fourier series assembles.
  • Heat Equation — initial temperature profile expanded as a Fourier (sine) series.
  • Wave Equation — plucked-string shape decomposed into harmonics.
  • Orthogonality of Functions — the inner-product structure f,g=fg\langle f,g\rangle=\int fg.
  • Even and Odd Functions — symmetry shortcuts for coefficients.
  • Fourier Transform — limit of Fourier series as period \to\infty.
  • Gibbs Phenomenon — convergence behaviour at jumps.

Concept Map

separation of variables

must match

needs

expresses

defined by

stacks

share

coefficients a_n b_n

found via

integrate product over period

proven by

multiply and integrate

Solve PDEs on interval

Solutions are sines and cosines

Arbitrary initial condition f x

Fourier series

Periodic function period 2L

f x+T = f x

Pure waves cos and sin

Unknown numbers

Orthogonality trick

Different waves give 0

Product-to-sum identities

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Socho tumhare paas koi bhi repeating (periodic) function hai — jaise square wave ya heartbeat pattern. Fourier ka kamaal yeh hai ki is tedhe-medhe shape ko tum pure waves yaani sin\sin aur cos\cos ko mila-jhula ke banaa sakte ho. Har wave ka apna "kitna chahiye" amount hota hai — usi ko hum coefficient ana_n aur bnb_n bolte hain. Yeh waves Lego blocks ki tarah hain, aur Fourier series unka recipe card hai.

Coefficients nikalne ka raaz hai orthogonality. Matlab agar tum do alag waves ko multiply karke ek period par integrate karo, answer zero aata hai. Isi wajah se jab hum poori series ko cos(mπx/L)\cos(m\pi x/L) se multiply karke integrate karte hain, toh saare terms gayab ho jaate hain, sirf ek bachta hai — aur wahi humein ama_m de deta hai. Bilkul vectors mein i^j^=0\hat i\cdot\hat j=0 jaisa funda hai.

Yeh PDEs mein kyun zaroori hai? Jab hum heat ya wave equation ko separation of variables se solve karte hain, solutions sin(nπx/L)\sin(n\pi x/L) wale forms mein aate hain. Lekin initial condition f(x)f(x) koi bhi shape ho sakta hai. Toh us shape ko inhi sine/cosine ke sum mein todna padta hai — yahi Fourier series karti hai. Bina iske PDE ka initial condition match hi nahi hoga.

Do shortcuts yaad rakho: agar function even hai toh sirf cosines (bn=0b_n=0), aur odd hai toh sirf sines (an=0a_n=0) — aadha kaam bach gaya. Aur ek warning: jahan function mein sudden jump hai, wahan series exact value nahi, balki midpoint deti hai, aur thoda overshoot karti hai jise Gibbs phenomenon bolte hain. Yeh galti exam mein bahut log karte hain, toh dhyan rakhna.

Go deeper — visual, from zero

Test yourself — Partial Differential Equations

Connections