Intuition The Big Picture
When you solve a PDE (like the heat or wave equation) on a finite rod 0 ≤ x ≤ L 0 \le x \le L 0 ≤ x ≤ L , the
boundary conditions only tell you what happens on that interval . But Fourier series are
built for periodic functions on ( − L , L ) (-L, L) ( − L , L ) . So we play a trick: we take our function defined
only on [ 0 , L ] [0, L] [ 0 , L ] and invent values on [ − L , 0 ] [-L, 0] [ − L , 0 ] to make it either odd (giving a pure
sine series) or even (giving a pure cosine series). We are free to choose because
nobody told us what happens at x < 0 x<0 x < 0 — it's our half range.
Definition Half-range expansion
A function f ( x ) f(x) f ( x ) defined only on [ 0 , L ] [0, L] [ 0 , L ] can be represented by a Fourier series in two ways:
Half-range sine series : extend f f f as an odd function ⇒ \Rightarrow ⇒ only sin \sin sin terms.
Half-range cosine series : extend f f f as an even function ⇒ \Rightarrow ⇒ only cos \cos cos terms.
"Half-range" = we only know half of a full period ( − L , L ) (-L, L) ( − L , L ) , namely [ 0 , L ] [0,L] [ 0 , L ] .
WHY two choices? Because the PDE's boundary conditions decide which one is useful:
Dirichlet BC (u = 0 u=0 u = 0 at the ends) → \to → needs functions that vanish at x = 0 , L x=0,L x = 0 , L → \to → sine .
Neumann BC (zero derivative / insulated ends) → \to → needs zero slope at ends → \to → cosine .
Start from the full Fourier series of a function with period 2 L 2L 2 L on ( − L , L ) (-L, L) ( − L , L ) :
f ( x ) = a 0 2 + ∑ n = 1 ∞ [ a n cos n π x L + b n sin n π x L ] 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] f ( x ) = 2 a 0 + n = 1 ∑ ∞ [ a n cos L nπ x + b n sin L nπ x ]
with
a n = 1 L ∫ − L L f ( x ) cos n π x L d x , b n = 1 L ∫ − L L f ( x ) sin n π x L d x . a_n = \frac1L\int_{-L}^{L} f(x)\cos\frac{n\pi x}{L}\,dx,\qquad
b_n = \frac1L\int_{-L}^{L} f(x)\sin\frac{n\pi x}{L}\,dx. a n = L 1 ∫ − L L f ( x ) cos L nπ x d x , b n = L 1 ∫ − L L f ( x ) sin L nπ x d x .
Intuition Why odd kills the cosines
cos \cos cos is an even function; sin \sin sin is odd . If we force f f f to be odd , then
f ( x ) cos ( ⋅ ) f(x)\cos(\cdot) f ( x ) cos ( ⋅ ) is (odd)(even) = odd , and the integral of an odd function over a symmetric
interval [ − L , L ] [-L,L] [ − L , L ] is zero . So every a n = 0 a_n = 0 a n = 0 . Only sines survive — and they naturally
vanish at x = 0 x=0 x = 0 and x = L x=L x = L , perfect for fixed-end problems.
For an odd f f f : f ( x ) sin n π x L f(x)\sin\frac{n\pi x}{L} f ( x ) sin L nπ x is (odd)(odd) = even , so
b n = 1 L ∫ − L L f sin n π x L d x = 2 L ∫ 0 L f ( x ) sin n π x L d x . b_n = \frac1L\int_{-L}^{L} f\sin\frac{n\pi x}{L}\,dx = \frac{2}{L}\int_{0}^{L} f(x)\sin\frac{n\pi x}{L}\,dx. b n = L 1 ∫ − L L f sin L nπ x d x = L 2 ∫ 0 L f ( x ) sin L nπ x d x .
For an even f f f : f ( x ) sin ( ⋅ ) f(x)\sin(\cdot) f ( x ) sin ( ⋅ ) is (even)(odd)=odd ⇒ b n = 0 \Rightarrow b_n=0 ⇒ b n = 0 .
And f ( x ) cos ( ⋅ ) f(x)\cos(\cdot) f ( x ) cos ( ⋅ ) is (even)(even)=even , so we double the half-integral:
a n = 2 L ∫ 0 L f ( x ) cos n π x L d x , a 0 = 2 L ∫ 0 L f ( x ) d x . a_n = \frac{2}{L}\int_0^L f(x)\cos\frac{n\pi x}{L}\,dx,\qquad
a_0 = \frac{2}{L}\int_0^L f(x)\,dx. a n = L 2 ∫ 0 L f ( x ) cos L nπ x d x , a 0 = L 2 ∫ 0 L f ( x ) d x .
Worked example Example 1 —
f ( x ) = x f(x)=x f ( x ) = x on [ 0 , π ] [0,\pi] [ 0 , π ] , sine series
Here L = π L=\pi L = π . We need b n = 2 π ∫ 0 π x sin ( n x ) d x b_n = \dfrac{2}{\pi}\displaystyle\int_0^\pi x\sin(nx)\,dx b n = π 2 ∫ 0 π x sin ( n x ) d x .
Step — integrate by parts. Why? Product of polynomial × trig; IBP reduces the polynomial power.
∫ 0 π x sin ( n x ) d x = [ − x cos n x n ] 0 π + 1 n ∫ 0 π cos n x d x = − π cos n π n + 0. \int_0^\pi x\sin(nx)\,dx = \left[-\frac{x\cos nx}{n}\right]_0^\pi + \frac1n\int_0^\pi \cos nx\,dx = -\frac{\pi\cos n\pi}{n} + 0. ∫ 0 π x sin ( n x ) d x = [ − n x c o s n x ] 0 π + n 1 ∫ 0 π cos n x d x = − n π c o s nπ + 0.
Why the second term vanishes? ∫ 0 π cos n x d x = sin n π n = 0 \int_0^\pi \cos nx\,dx = \frac{\sin n\pi}{n}=0 ∫ 0 π cos n x d x = n s i n nπ = 0 for integer n n n .
Since cos n π = ( − 1 ) n \cos n\pi = (-1)^n cos nπ = ( − 1 ) n :
b n = 2 π ⋅ ( − π ( − 1 ) n n ) = − 2 ( − 1 ) n n = 2 ( − 1 ) n + 1 n . b_n = \frac{2}{\pi}\cdot\left(-\frac{\pi(-1)^n}{n}\right) = \frac{-2(-1)^n}{n} = \frac{2(-1)^{n+1}}{n}. b n = π 2 ⋅ ( − n π ( − 1 ) n ) = n − 2 ( − 1 ) n = n 2 ( − 1 ) n + 1 .
x = 2 ∑ n = 1 ∞ ( − 1 ) n + 1 n sin ( n x ) , 0 < x < π . \boxed{\,x = 2\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}\sin(nx), \quad 0<x<\pi.} x = 2 n = 1 ∑ ∞ n ( − 1 ) n + 1 sin ( n x ) , 0 < x < π .
Forecast-then-verify: plug x = π / 2 x=\pi/2 x = π /2 : RHS = 2 ( 1 − 1 3 + 1 5 − ⋯ ) = 2 ⋅ π 4 = π 2 =2(1 - \tfrac13 + \tfrac15-\cdots)=2\cdot\frac\pi4=\frac\pi2 = 2 ( 1 − 3 1 + 5 1 − ⋯ ) = 2 ⋅ 4 π = 2 π . ✓ Matches f ( π / 2 ) = π / 2 f(\pi/2)=\pi/2 f ( π /2 ) = π /2 .
Worked example Example 2 —
f ( x ) = x f(x)=x f ( x ) = x on [ 0 , π ] [0,\pi] [ 0 , π ] , cosine series
a 0 = 2 π ∫ 0 π x d x = 2 π ⋅ π 2 2 = π . a_0 = \frac{2}{\pi}\int_0^\pi x\,dx = \frac{2}{\pi}\cdot\frac{\pi^2}{2}=\pi. a 0 = π 2 ∫ 0 π x d x = π 2 ⋅ 2 π 2 = π . So a 0 2 = π 2 \tfrac{a_0}{2}=\tfrac\pi2 2 a 0 = 2 π (the average of x x x on [ 0 , π ] [0,\pi] [ 0 , π ] — sanity check ✓).
a n = 2 π ∫ 0 π x cos ( n x ) d x a_n = \frac{2}{\pi}\int_0^\pi x\cos(nx)\,dx a n = π 2 ∫ 0 π x cos ( n x ) d x . IBP (why? same reason as before) :
∫ 0 π x cos n x d x = [ x sin n x n ] 0 π − 1 n ∫ 0 π sin n x d x = 0 + 1 n 2 [ cos n x ] 0 π = ( − 1 ) n − 1 n 2 . \int_0^\pi x\cos nx\,dx = \left[\frac{x\sin nx}{n}\right]_0^\pi - \frac1n\int_0^\pi \sin nx\,dx = 0 + \frac{1}{n^2}[\cos nx]_0^\pi = \frac{(-1)^n-1}{n^2}. ∫ 0 π x cos n x d x = [ n x s i n n x ] 0 π − n 1 ∫ 0 π sin n x d x = 0 + n 2 1 [ cos n x ] 0 π = n 2 ( − 1 ) n − 1 .
Why first bracket is 0? sin n π = 0 \sin n\pi=0 sin nπ = 0 . So a n = 2 π ⋅ ( − 1 ) n − 1 n 2 a_n=\frac{2}{\pi}\cdot\frac{(-1)^n-1}{n^2} a n = π 2 ⋅ n 2 ( − 1 ) n − 1 , which is 0 0 0 for even n n n and − 4 π n 2 -\frac{4}{\pi n^2} − π n 2 4 for odd n n n .
x = π 2 − 4 π ∑ k = 0 ∞ cos ( ( 2 k + 1 ) x ) ( 2 k + 1 ) 2 , 0 < x < π . \boxed{\,x = \frac{\pi}{2} - \frac{4}{\pi}\sum_{k=0}^\infty \frac{\cos((2k+1)x)}{(2k+1)^2}, \quad 0<x<\pi.} x = 2 π − π 4 k = 0 ∑ ∞ ( 2 k + 1 ) 2 cos (( 2 k + 1 ) x ) , 0 < x < π .
Verify at x = 0 x=0 x = 0 : RHS = π 2 − 4 π ∑ 1 ( 2 k + 1 ) 2 = π 2 − 4 π ⋅ π 2 8 = 0 = f ( 0 ) =\frac\pi2 - \frac4\pi\sum\frac1{(2k+1)^2} = \frac\pi2 - \frac4\pi\cdot\frac{\pi^2}{8}=0=f(0) = 2 π − π 4 ∑ ( 2 k + 1 ) 2 1 = 2 π − π 4 ⋅ 8 π 2 = 0 = f ( 0 ) . ✓
Worked example Example 3 — Why cosine converges faster
The sine coefficients above ∼ 1 n \sim \frac1n ∼ n 1 ; the cosine coefficients ∼ 1 n 2 \sim \frac1{n^2} ∼ n 2 1 .
Why? The even extension of f ( x ) = x f(x)=x f ( x ) = x is continuous (a "V" tent, ∣ x ∣ |x| ∣ x ∣ ), while the odd extension
has a jump at x = π x=\pi x = π (sawtooth). Smoother extension ⇒ \Rightarrow ⇒ faster-decaying coefficients.
Take-away: match BCs first, but note cosine series often converge better when f f f doesn't vanish at ends.
Common mistake "I'll just use the standard Fourier formula with
∫ − L L \int_{-L}^L ∫ − L L ."
Why it feels right: that's the formula you memorised. The trap: f f f is only defined on
[ 0 , L ] [0,L] [ 0 , L ] ; you have nothing to integrate over [ − L , 0 ] [-L,0] [ − L , 0 ] unless you choose an extension.
Fix: the choice is encoded by the factor 2 L \frac2L L 2 and the half integral ∫ 0 L \int_0^L ∫ 0 L .
Common mistake Forgetting the
a 0 2 \frac{a_0}{2} 2 a 0 term in the cosine series.
Why it feels right: the sine series has no constant term, by symmetry. The trap: even
functions generally have a nonzero average , captured by a 0 / 2 = 1 L ∫ 0 L f a_0/2 = \frac1L\int_0^L f a 0 /2 = L 1 ∫ 0 L f .
Fix: always compute a 0 a_0 a 0 separately; check it equals the mean value.
Common mistake Believing the series equals
f f f at the endpoints .
Why it feels right: the formula "f ( x ) = ∑ … f(x)=\sum\dots f ( x ) = ∑ … " looks exact everywhere. The trap: at a
jump of the periodic extension, the series converges to the midpoint (Dirichlet's theorem).
E.g. the sine series of x x x at x = π x=\pi x = π gives 0 0 0 , not π \pi π .
Fix: write the equality for 0 < x < L 0<x<L 0 < x < L (open interval) and check endpoints via the midpoint rule.
Recall Quick self-test (hide and answer)
Which extension gives only sine terms, and why?
What's the formula for b n b_n b n in a half-range sine series of period... wait, what's the period?
Why does a n = 0 a_n=0 a n = 0 for an odd function?
Which BC type pairs with cosine series?
Answers: 1. Odd extension; cos \cos cos is even so f cos f\cos f cos is odd, integral = 0 =0 = 0 . 2. b n = 2 L ∫ 0 L f sin n π x L d x b_n=\frac2L\int_0^L f\sin\frac{n\pi x}{L}dx b n = L 2 ∫ 0 L f sin L nπ x d x ; extended period is 2 L 2L 2 L . 3. f cos f\cos f cos becomes odd, integrates to 0 0 0 over [ − L , L ] [-L,L] [ − L , L ] . 4. Neumann (insulated/zero-slope) ends.
Recall Feynman: explain to a 12-year-old
Imagine you have a song recorded only for the first half of a tape. To play it on a machine that
needs a full loop, you record the second half yourself. You can copy the first half backwards
and flipped upside-down (odd → makes it perfectly "wave-like," only smooth wiggly sine sounds),
or just mirror it (even → only cosine sounds, and it can have a steady background hum = the
average). Both give you a full song; you pick whichever matches the rules of your machine.
Mnemonic Remember the pairing
"S ine = S lay zeros at the S ides (function = 0 at ends, odd, fixed walls).
C osine = C alm slope, C onstant term, C losed/insulated ends (even)."
And: O dd → \to → sine, E ven → \to → cosine ("O S/E C": O-Sine, E-Cosine).
Half-range expansion represents a function defined on which interval? Only on
[ 0 , L ] [0,L] [ 0 , L ] (half of a full period
2 L 2L 2 L ).
Odd extension of f f f produces which type of series? Pure sine series (all
a n = 0 a_n=0 a n = 0 ).
Even extension of f f f produces which type of series? Pure cosine series (all
b n = 0 b_n=0 b n = 0 ), including the
a 0 / 2 a_0/2 a 0 /2 term.
Why do cosine terms vanish for an odd function? f ( x ) cos n π x L f(x)\cos\frac{n\pi x}{L} f ( x ) cos L nπ x is (odd)(even)=odd; integral over symmetric
[ − L , L ] [-L,L] [ − L , L ] is
0 0 0 .
Half-range sine coefficient formula b n = 2 L ∫ 0 L f ( x ) sin n π x L d x b_n=\dfrac{2}{L}\displaystyle\int_0^L f(x)\sin\dfrac{n\pi x}{L}\,dx b n = L 2 ∫ 0 L f ( x ) sin L nπ x d x .
Half-range cosine coefficient formula a n = 2 L ∫ 0 L f ( x ) cos n π x L d x a_n=\dfrac{2}{L}\displaystyle\int_0^L f(x)\cos\dfrac{n\pi x}{L}\,dx a n = L 2 ∫ 0 L f ( x ) cos L nπ x d x , with
a 0 = 2 L ∫ 0 L f d x a_0=\dfrac2L\int_0^L f\,dx a 0 = L 2 ∫ 0 L f d x .
What does a 0 / 2 a_0/2 a 0 /2 physically represent? The average (mean) value of
f f f over
[ 0 , L ] [0,L] [ 0 , L ] .
Which boundary condition pairs with a sine series? Dirichlet (function = 0 at the ends).
Which boundary condition pairs with a cosine series? Neumann (zero derivative / insulated ends).
At a jump discontinuity of the periodic extension, the series converges to...? The midpoint (average) of the left and right limits (Dirichlet's theorem).
Sine series of x x x on [ 0 , π ] [0,\pi] [ 0 , π ] x = 2 ∑ n = 1 ∞ ( − 1 ) n + 1 n sin n x x=2\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}\sin nx x = 2 ∑ n = 1 ∞ n ( − 1 ) n + 1 sin n x .
Cosine series of x x x on [ 0 , π ] [0,\pi] [ 0 , π ] x = π 2 − 4 π ∑ k = 0 ∞ cos ( ( 2 k + 1 ) x ) ( 2 k + 1 ) 2 x=\frac\pi2 - \frac4\pi\sum_{k=0}^\infty \frac{\cos((2k+1)x)}{(2k+1)^2} x = 2 π − π 4 ∑ k = 0 ∞ ( 2 k + 1 ) 2 c o s (( 2 k + 1 ) x ) .
Full Fourier series period 2L
Neumann BC insulated ends
Intuition Hinglish mein samjho
Dekho, jab hum PDE solve karte hain ek finite rod par, say 0 0 0 se L L L tak, tab function sirf is
chhote interval par defined hota hai. Lekin Fourier series ko chahiye periodic function jo
( − L , L ) (-L, L) ( − L , L ) par defined ho. To hum ek jugaad lagate hain: jo half hume nahi pata (− L -L − L se 0 0 0 tak),
usko hum khud banate hain . Do tarike: ya to function ko odd bana do (mirror + flip), ya
even bana do (sirf mirror). Yahi "half-range" ka matlab hai — sirf aadha period pata hai.
Ab magic yeh hai: agar extension odd banaya, to saare cosine terms apne aap zero ho jaate
hain, kyunki cosine even hai aur odd × even = odd, aur odd function ka integral symmetric interval
par hamesha zero. Bachte hain sirf sine terms — aur sine x = 0 x=0 x = 0 aur x = L x=L x = L par zero hota hai, jo
fixed-wall (Dirichlet) boundary conditions ke liye perfect hai. Ulta, agar even extension liya,
to sirf cosine terms bachte hain, plus ek a 0 / 2 a_0/2 a 0 /2 wala constant jo function ki average value
hai. Yeh insulated ends (Neumann BC) ke liye fit baithta hai.
Formula yaad rakhna easy hai: dono mein factor 2 L \frac{2}{L} L 2 aata hai aur integral sirf ∫ 0 L \int_0^L ∫ 0 L
tak, kyunki hum half range hi jaante hain. Sine ke liye b n = 2 L ∫ 0 L f sin n π x L d x b_n=\frac{2}{L}\int_0^L f\sin\frac{n\pi x}{L}dx b n = L 2 ∫ 0 L f sin L nπ x d x ,
cosine ke liye a n = 2 L ∫ 0 L f cos n π x L d x a_n=\frac{2}{L}\int_0^L f\cos\frac{n\pi x}{L}dx a n = L 2 ∫ 0 L f cos L nπ x d x . Ek important baat: endpoints par
agar periodic extension mein jump hai, to series exact value nahi, balki midpoint (average) deti
hai — yeh Dirichlet theorem hai, exam mein bahut puchte hain. Mnemonic: O dd→S ine, E ven→C osine.