4.7.5Partial Differential Equations

Full Fourier series — coefficients derivation

1,956 words9 min readdifficulty · medium1 backlinks

What we are trying to do

WHAT we want: formulas for a0,an,bna_0, a_n, b_n. WHY these basis functions: cosnπxL\cos\frac{n\pi x}{L} and sinnπxL\sin\frac{n\pi x}{L} all have period dividing 2L2L, so any sum of them is 2L2L-periodic — matching ff.


The key tool: Orthogonality (derive it first)

Everything rests on these integrals over a full period [L,L][-L, L]. Let m,nm, n be positive integers.

HOW to derive one (the cosine–cosine case). Use the product-to-sum identity cosAcosB=12[cos(AB)+cos(A+B)].\cos A\cos B = \tfrac{1}{2}\big[\cos(A-B)+\cos(A+B)\big]. So with A=mπxL,B=nπxLA=\frac{m\pi x}{L},\,B=\frac{n\pi x}{L}: LLcosmπxLcosnπxLdx=12LLcos(mn)πxLdx+12LLcos(m+n)πxLdx.\int_{-L}^{L}\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\,dx = \frac12\int_{-L}^{L}\cos\frac{(m-n)\pi x}{L}\,dx + \frac12\int_{-L}^{L}\cos\frac{(m+n)\pi x}{L}\,dx.

Why this step? Splitting the product into two simple cosines makes each integral trivial.

  • If mnm\neq n: both mnm-n and m+nm+n are nonzero integers kk, and LLcoskπxLdx=LkπsinkπxLLL=Lkπ[sinkπsin(kπ)]=0.\int_{-L}^{L}\cos\frac{k\pi x}{L}\,dx = \frac{L}{k\pi}\sin\frac{k\pi x}{L}\Big|_{-L}^{L} = \frac{L}{k\pi}\big[\sin k\pi - \sin(-k\pi)\big]=0. So the whole thing is 00.
  • If m=nm=n: the first integrand is cos0=1\cos 0 = 1 giving 122L=L\frac12\cdot 2L = L, and the second (k=2n0k=2n\neq0) gives 00. Total =L= L. ✔

The sine–sine and sine–cosine cases follow identically using sinAsinB=12[cos(AB)cos(A+B)]\sin A\sin B=\frac12[\cos(A-B)-\cos(A+B)] and sinAcosB=12[sin(A+B)+sin(AB)]\sin A\cos B=\frac12[\sin(A+B)+\sin(A-B)].


Deriving the coefficient formulas (from scratch)

Start by assuming the series converges to ff and that we may integrate term by term: f(x)=a02+n=1[ancosnπxL+bnsinnπxL].f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left[ a_n \cos\frac{n\pi x}{L} + b_n \sin\frac{n\pi x}{L}\right].

Step 1 — find a0a_0

Integrate both sides over [L,L][-L,L]: LLfdx=a02LL1dx2L+nanLLcosnπxLdx0+nbnLLsinnπxLdx0.\int_{-L}^{L} f\,dx = \frac{a_0}{2}\underbrace{\int_{-L}^{L}1\,dx}_{2L} + \sum_n a_n\underbrace{\int_{-L}^{L}\cos\frac{n\pi x}{L}dx}_{0} + \sum_n b_n\underbrace{\int_{-L}^{L}\sin\frac{n\pi x}{L}dx}_{0}. Why this step? Integrating kills every oscillating term (they have zero average over a full period), leaving only the constant. LLfdx=a0La0=1LLLf(x)dx.\Rightarrow \int_{-L}^{L} f\,dx = a_0 L \quad\Longrightarrow\quad \boxed{a_0 = \frac1L\int_{-L}^{L} f(x)\,dx.}

Step 2 — find ama_m (for m1m\ge 1)

Multiply both sides by cosmπxL\cos\frac{m\pi x}{L}, then integrate: LLfcosmπxLdx=a02cosmπxLdx0+nancosnπxLcosmπxLdx+nbnsinnπxLcosmπxLdx0.\int_{-L}^{L} f\cos\frac{m\pi x}{L}\,dx = \frac{a_0}{2}\underbrace{\int\cos\frac{m\pi x}{L}dx}_{0} + \sum_n a_n\int\cos\frac{n\pi x}{L}\cos\frac{m\pi x}{L}dx + \sum_n b_n\underbrace{\int\sin\frac{n\pi x}{L}\cos\frac{m\pi x}{L}dx}_{0}. Why this step? By orthogonality, in the ana_n sum only the n=mn=m term survives (equals LL); all others vanish, and every bnb_n term vanishes too. LLfcosmπxLdx=amLam=1LLLf(x)cosmπxLdx.\Rightarrow \int_{-L}^{L} f\cos\frac{m\pi x}{L}\,dx = a_m L \quad\Longrightarrow\quad \boxed{a_m = \frac1L\int_{-L}^{L} f(x)\cos\frac{m\pi x}{L}\,dx.}

Step 3 — find bmb_m (for m1m\ge 1)

Multiply by sinmπxL\sin\frac{m\pi x}{L} and integrate. Same reasoning: only the n=mn=m sine–sine term survives (=L=L): bm=1LLLf(x)sinmπxLdx.\boxed{b_m = \frac1L\int_{-L}^{L} f(x)\sin\frac{m\pi x}{L}\,dx.}

Figure — Full Fourier series — coefficients derivation

Worked examples


Common mistakes


Recall Feynman: explain to a 12-year-old

Imagine a song made by mixing many tuning forks, each humming a steady note. If you're handed the finished song, how do you find out how loud each fork was? You play one matching fork next to the song and "average" — only that fork's note adds up, every other note cancels out because over a full beat they go up as much as down. The Fourier coefficient is exactly "how loud was this fork." Multiplying ff by cosnπxL\cos\frac{n\pi x}{L} and integrating is "listening with the nn-th fork."


Active recall

What is the full Fourier series of ff on [L,L][-L,L]?
f=a02+n1[ancosnπxL+bnsinnπxL]f=\frac{a_0}{2}+\sum_{n\ge1}\big[a_n\cos\frac{n\pi x}{L}+b_n\sin\frac{n\pi x}{L}\big]
Why is the constant written a0/2a_0/2 and not a0a_0?
So the single formula an=1LLLfcosnπxLdxa_n=\frac1L\int_{-L}^L f\cos\frac{n\pi x}{L}dx also gives a0a_0 correctly at n=0n=0.
State the formula for ana_n (n0n\ge0).
an=1LLLf(x)cosnπxLdxa_n=\frac1L\int_{-L}^L f(x)\cos\frac{n\pi x}{L}\,dx
State the formula for bnb_n.
bn=1LLLf(x)sinnπxLdxb_n=\frac1L\int_{-L}^L f(x)\sin\frac{n\pi x}{L}\,dx
What property of the basis functions makes the derivation work?
Orthogonality over [L,L][-L,L]: integrals of different sine/cosine products vanish.
Value of LLcosnπxLcosmπxLdx\int_{-L}^L\cos\frac{n\pi x}{L}\cos\frac{m\pi x}{L}dx for m=n1m=n\ge1?
LL
Value of LLsinmπxLcosnπxLdx\int_{-L}^L\sin\frac{m\pi x}{L}\cos\frac{n\pi x}{L}dx?
00 for all m,nm,n.
How do you isolate ama_m from the series?
Multiply both sides by cosmπxL\cos\frac{m\pi x}{L} and integrate over [L,L][-L,L]; only the n=mn=m term survives.
If ff is odd, which coefficients vanish?
All ana_n (including a0a_0); only bnb_n remain.
If ff is even, which coefficients vanish?
All bnb_n; only a0,ana_0,a_n remain.
Fourier bmb_m of the square wave on [L,L][-L,L]?
4mπ\frac{4}{m\pi} for odd mm, 00 for even mm.
Identity used to derive cos–cos orthogonality?
cosAcosB=12[cos(AB)+cos(A+B)]\cos A\cos B=\frac12[\cos(A-B)+\cos(A+B)].

Connections

Concept Map

expanded as

contains

contains

contains

period divides 2L

used to prove

basis waves are perpendicular

project f onto one wave

isolates each coefficient

isolates each coefficient

isolates each coefficient

other waves give zero

Periodic f on -L to L

Full Fourier series

Cosine terms a_n

Sine terms b_n

Constant a0 over 2

Basis waves cos and sin

Product-to-sum identities

Orthogonality relations

Function as vector view

Multiply and integrate

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, full Fourier series ka idea simple hai: koi bhi periodic function f(x)f(x) jo [L,L][-L,L] pe defined hai, usko hum sine aur cosine waves ke mixture ki tarah likh sakte hain. Jaise ek complex sound bahut saari pure notes ka sum hota hai, waise hi ff ek constant plus cosnπxL\cos\frac{n\pi x}{L} aur sinnπxL\sin\frac{n\pi x}{L} ka sum hai. Coefficients a0,an,bna_0, a_n, b_n batate hain ki har wave kitni "loud" hai.

Ab sabse important cheez hai orthogonality. Matlab agar aap do alag-alag frequency ke waves ko multiply karke [L,L][-L,L] pe integrate karo, to answer zero aata hai; aur agar same wave ko apne saath multiply karke integrate karo to LL aata hai. Yahi trick poori derivation chalati hai — functions ko vectors ki tarah socho aur integral ko dot product ki tarah. Perpendicular vectors ka dot product zero hota hai, bas wahi ho raha hai.

To coefficient nikalne ka method "project karo" hai: bmb_m chahiye? ff ko sinmπxL\sin\frac{m\pi x}{L} se multiply karo aur integrate karo. Orthogonality ki wajah se sirf mm-wala term bachta hai (woh LL deta hai), baaki sab cancel. Isse turant bm=1LLLfsinmπxLdxb_m=\frac1L\int_{-L}^L f\sin\frac{m\pi x}{L}dx mil jaata hai. Same logic se ama_m ke liye cos\cos se multiply, aur a0a_0 ke liye sirf integrate (kyunki sab oscillating terms ka average zero hota hai).

Exam tip: pehle symmetry check karo. Agar ff odd hai to saare an=0a_n=0, sirf bnb_n bachenge; agar even hai to ulta. Isse aadha kaam khatam. Aur dhyaan rakho — full interval [L,L][-L,L]

Go deeper — visual, from zero

Test yourself — Partial Differential Equations

Connections