4.7.12Partial Differential Equations

Solving wave equation — separation of variables

2,020 words9 min readdifficulty · medium

The problem we are solving

WHAT we want: a function u(x,t)u(x,t) satisfying the PDE + 2 BCs + 2 ICs. WHY separation works: the PDE is linear & homogeneous, and the BCs are homogeneous (=0=0), so sums of solutions are still solutions — that's the engine of superposition.


Step-by-step derivation FROM SCRATCH

Step 1 — Make the separation ansatz

Assume u(x,t)=X(x)T(t).u(x,t)=X(x)\,T(t). Plug into the PDE. Since utt=XTu_{tt}=X T'' and uxx=XTu_{xx}=X'' T: XT=c2XT.X\,T'' = c^2 X'' \,T.

Why this step? It converts derivatives of a 2-variable function into derivatives of 1-variable functions.

Step 2 — Separate the variables

Divide both sides by c2XTc^2 X T: Tc2T=XX.\frac{T''}{c^2 T} = \frac{X''}{X}.

Why this step? The left side depends only on tt, the right side only on xx. Two things equal for all x,tx,t can only happen if both equal the same constant. Call it λ-\lambda (minus chosen for convenience — we'll see we need oscillation): XX=Tc2T=λ.\frac{X''}{X}=\frac{T''}{c^2T}=-\lambda.

This gives two ODEs: X+λX=0,T+c2λT=0.X'' + \lambda X = 0, \qquad T'' + c^2\lambda\, T = 0.

Step 3 — Apply BCs to the spatial ODE (the eigenvalue problem)

The BCs u(0,t)=u(L,t)=0u(0,t)=u(L,t)=0 must hold for all tt, and T(t)≢0T(t)\not\equiv 0, so X(0)=0,X(L)=0.X(0)=0, \qquad X(L)=0.

We solve X+λX=0X''+\lambda X=0 and check three cases for λ\lambda (Steel-man each!):

  • λ<0\lambda<0 (say λ=μ2\lambda=-\mu^2): X=Aeμx+BeμxX=Ae^{\mu x}+Be^{-\mu x}. BCs force A=B=0A=B=0. Only trivial solution. Rejected.
  • λ=0\lambda=0: X=Ax+BX=Ax+B. BCs force A=B=0A=B=0. Trivial. Rejected.
  • λ>0\lambda>0 (say λ=k2\lambda=k^2): X=Acoskx+BsinkxX=A\cos kx + B\sin kx.

Apply BCs to the λ>0\lambda>0 case:

  • X(0)=A=0A=0X(0)=A=0 \Rightarrow A=0.
  • X(L)=BsinkL=0X(L)=B\sin kL =0. For a nontrivial B0B\ne0: sinkL=0kL=nπ\sin kL=0 \Rightarrow kL=n\pi.

So the eigenvalues and eigenfunctions are λn=(nπL)2,Xn(x)=sin ⁣nπxL,n=1,2,3,\lambda_n=\left(\frac{n\pi}{L}\right)^2,\qquad X_n(x)=\sin\!\frac{n\pi x}{L},\quad n=1,2,3,\dots

Step 4 — Solve the time ODE for each mode

With λn=(nπ/L)2\lambda_n=(n\pi/L)^2: Tn+c2λnTn=0Tn+ωn2Tn=0,ωn=nπcL.T_n''+c^2\lambda_n T_n=0 \Rightarrow T_n''+\omega_n^2 T_n=0,\quad \omega_n=\frac{n\pi c}{L}. This is simple harmonic motion: Tn(t)=ancosωnt+bnsinωnt.T_n(t)=a_n\cos\omega_n t + b_n\sin\omega_n t.

Why this step? ωn\omega_n are the natural frequencies of the string — the harmonics you hear from a guitar.

Step 5 — Superpose (build the general solution)

Why a sum? Each un=XnTnu_n=X_nT_n solves the (linear, homogeneous) PDE + BCs. By superposition, any sum does too. We use the freedom in an,bna_n,b_n to fit the ICs.

Step 6 — Use ICs to find the coefficients (Fourier!)

Position IC u(x,0)=f(x)u(x,0)=f(x): set t=0t=0 (cos0=1,sin0=0\cos0=1,\sin0=0): f(x)=n=1ansinnπxL.f(x)=\sum_{n=1}^\infty a_n\sin\frac{n\pi x}{L}. This is a Fourier sine series, so by orthogonality 0LsinmπxLsinnπxLdx=L2δmn\int_0^L \sin\frac{m\pi x}{L}\sin\frac{n\pi x}{L}dx=\frac{L}{2}\delta_{mn}: an=2L0Lf(x)sinnπxLdx\boxed{a_n=\frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}\,dx}

Velocity IC ut(x,0)=g(x)u_t(x,0)=g(x): differentiate uu in tt, set t=0t=0 (ddtcosωnt0=0\frac{d}{dt}\cos\omega_n t|_0=0, ddtsinωnt0=ωn\frac{d}{dt}\sin\omega_n t|_0=\omega_n): g(x)=n=1bnωnsinnπxLbnωn=2L0Lg(x)sinnπxLdx.g(x)=\sum_{n=1}^\infty b_n\,\omega_n\,\sin\frac{n\pi x}{L}\Rightarrow b_n\omega_n=\frac{2}{L}\int_0^L g(x)\sin\frac{n\pi x}{L}dx. So bn=2nπc0Lg(x)sinnπxLdx(using ωn=nπcL).\boxed{b_n=\frac{2}{n\pi c}\int_0^L g(x)\sin\frac{n\pi x}{L}\,dx} \quad(\text{using }\omega_n=\tfrac{n\pi c}{L}).

Figure — Solving wave equation — separation of variables

Worked examples


Common mistakes (Steel-manned)


Recall Feynman: explain to a 12-year-old

Pluck a guitar string. It can only jiggle in special "shapes" — one big hump, two humps, three humps — because its ends are glued down and can't move. Each shape has its own musical note (faster wiggle = higher note). When you pluck, you start with some shape; the string is secretly adding up all these special humps in just the right amounts to make that shape, and then each hump bounces up and down at its own speed forever. Our math just figures out how much of each hump is in the starting shape (that's the "Fourier" part) and how fast each bounces (that's the frequency).


Active-recall flashcards

Why does separation of variables require the PDE to be linear and the BCs homogeneous?
So superposition holds — sums of product solutions are still solutions and still satisfy the zero BCs, letting us fit ICs.
In X=λXX''=-\lambda X with X(0)=X(L)=0X(0)=X(L)=0, why are λ0\lambda\le0 rejected?
They give only exponential/linear XX, which can't be zero at two distinct points without being identically zero (trivial solution).
What are the eigenvalues and eigenfunctions of the clamped string?
λn=(nπ/L)2\lambda_n=(n\pi/L)^2, Xn(x)=sin(nπx/L)X_n(x)=\sin(n\pi x/L), n=1,2,n=1,2,\dots
Why is the spatial part a sine and not a cosine?
BC u(0,t)=0u(0,t)=0 kills the cosine (cos0=1\cos0=1), leaving only sin\sin.
What are the natural frequencies ωn\omega_n?
ωn=nπc/L\omega_n=n\pi c/L, so the time part is ancosωnt+bnsinωnta_n\cos\omega_n t+b_n\sin\omega_n t.
Formula for ana_n from initial shape f(x)f(x)?
an=2L0Lf(x)sinnπxLdxa_n=\frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}dx.
Formula for bnb_n from initial velocity g(x)g(x), and why the extra factor?
bn=2nπc0Lg(x)sinnπxLdxb_n=\frac{2}{n\pi c}\int_0^L g(x)\sin\frac{n\pi x}{L}dx; differentiating TT in time pulls down ωn=nπc/L\omega_n=n\pi c/L, so divide by it.
If ut(x,0)=0u_t(x,0)=0, what happens to all bnb_n?
They are all zero; only cosωnt\cos\omega_n t terms remain.
General solution of clamped wave equation?
u=n(ancosnπctL+bnsinnπctL)sinnπxLu=\sum_n(a_n\cos\frac{n\pi ct}{L}+b_n\sin\frac{n\pi ct}{L})\sin\frac{n\pi x}{L}.
Orthogonality relation used to extract coefficients?
0LsinmπxLsinnπxLdx=L2δmn\int_0^L\sin\frac{m\pi x}{L}\sin\frac{n\pi x}{L}dx=\frac{L}{2}\delta_{mn}.

Connections

  • Fourier sine series — how ana_n, bnb_n are computed; the same orthogonality engine.
  • Sturm–Liouville theory — the spatial problem X+λX=0X''+\lambda X=0 is a special eigenvalue problem; guarantees real eigenvalues and orthogonal eigenfunctions.
  • Heat equation — separation of variables — same spatial ODE, but time ODE is first order (T=c2λTT'=-c^2\lambda T) → decay instead of oscillation.
  • d'Alembert solution of the wave equation — alternative method (u=F(xct)+G(x+ct)u=F(x-ct)+G(x+ct)); equivalent to summing the modes.
  • Standing waves and harmonics — physics of ωn=nπc/L\omega_n=n\pi c/L, overtones, timbre.
  • Superposition principle — why summing modes is legal.

Concept Map

is

makes

enables

plug into PDE

gives

gives

imposed on

only nontrivial for

yields

amplitude wiggle for

combined via

fitted by

Wave equation u_tt = c^2 u_xx

Homogeneous BCs pinned ends

Initial shape f and velocity g

Linear homogeneous problem

Ansatz u = X x T t

Two ODEs with constant -lambda

Spatial ODE X'' + lambda X

Eigenvalues lambda greater than 0

Sine modes standing waves

Time ODE oscillation

Superposition of modes

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Socho ek guitar ki string dono ends pe fixed hai. Wo string kaise bhi hil nahi sakti — kyunki ends pinned hain. Isliye nature solution ko chhote-chhote "standing wave modes" se banata hai: har mode ka shape fix rehta hai (ek hump, do hump, teen hump...) aur sirf uski height time ke saath up-down breathe karti hai. Yahi physical intuition separation of variables ke peeche hai.

Maths mein hum guess karte hain u(x,t)=X(x)T(t)u(x,t)=X(x)T(t) — yaani shape in xx multiply by wiggle in tt. PDE mein daalne se ek hard equation do easy ODE ban jaati hai, ek constant λ-\lambda ke saath. Boundary conditions (u=0u=0 dono ends pe) lagao to sirf Xn=sin(nπx/L)X_n=\sin(n\pi x/L) survive karte hain, with λn=(nπ/L)2\lambda_n=(n\pi/L)^2. Time part SHM nikalta hai: cos(ωnt)\cos(\omega_n t) aur sin(ωnt)\sin(\omega_n t) with ωn=nπc/L\omega_n=n\pi c/L — yahi natural frequencies hain jo aapko guitar ki notes sunaati hain.

Phir saare modes ko superpose (add) karke general solution banta hai. Initial shape f(x)f(x) aur initial velocity g(x)g(x) ko match karne ke liye Fourier sine series use karte hain: an=2Lfsina_n=\frac{2}{L}\int f\sin, aur bn=2nπcgsinb_n=\frac{2}{n\pi c}\int g\sin. Yaad rakho — bnb_n mein ωn\omega_n se divide karna padta hai kyunki time derivative ek ωn\omega_n neeche le aata hai. Yeh chhoti si galti exams mein bahut hoti hai!

Importance: yahi method heat equation, electromagnetic waves, quantum mechanics (Schrodinger box) — sab mein same hai. Ek baar logic clear ho gaya, to bas ODE aur Fourier coefficients ka kaam reh jaata hai. 80/20 tip: agar ff ya gg already sine ke terms mein diya hai, integral mat karo — directly coefficients read off karo.

Test yourself — Partial Differential Equations

Connections