6.3 Separation of variables

The d’Alembert picture from 6.2 is the right way to think about wave propagation on an unbounded domain — a single pulse, characteristics streaking off to infinity. But many of the systems we care about — a guitar string clamped at both ends, an organ pipe with closed bottom and open top, the acoustic field inside a rectangular room — live on bounded domains where characteristics reflect off the boundaries repeatedly. After a few bounces the d’Alembert picture becomes a tangle of overlapping left-going and right-going pieces, and a different decomposition becomes more useful.

The alternative is separation of variables, a technique that decomposes the solution into a product of functions, each of which depends on only one of the independent variables. The result is a factorised solution that turns one PDE into two (or more) ODEs — and on a bounded domain, the boundary conditions select a discrete family of allowed factorisations called modes. The mode catalogue is the subject of 6.5; the boundary-condition rules that select the catalogue are the subject of 6.4. This lesson is about the technique itself.

The technique in four steps

Given a linear PDE on a bounded domain with linear, homogeneous boundary conditions:

  1. Assume a product solution. Substitute the ansatz u(x,t)=X(x)T(t)u(x, t) = X(x)\, T(t) into the PDE and divide through by XTX\, T.
  2. Separate. Rearrange so one side depends only on xx and the other only on tt. Since the two sides depend on independent variables, both must equal a common constant — the separation constant. Calling it k2-k^2 (the sign and form are conventional, and we’ll see why below) produces an xx-ODE and a tt-ODE.
  3. Apply the spatial boundary conditions. They translate directly into boundary conditions on X(x)X(x). Only for a discrete set of separation constants k=knk = k_n does a non-trivial solution exist. Each knk_n comes paired with a spatial mode shape Xn(x)X_n(x).
  4. Build the general solution. Superpose all the allowed modes: u(x,t)=nXn(x)Tn(t)u(x, t) = \sum_n X_n(x)\, T_n(t), with each TnT_n a solution of its time ODE. Match initial conditions by projecting onto the XnX_n basis.

This is the entire algorithm. Below, we work it out on the canonical example.

Worked example: the clamped string

Worked example: every step, no shortcuts

The problem. A string of length LL is held fixed at both ends. Its transverse displacement u(x,t)u(x, t) obeys the 1-D wave equation

2ut2  =  c22ux2,0<x<L,t>0,\frac{\partial^2 u}{\partial t^2} \;=\; c^2\, \frac{\partial^2 u}{\partial x^2}, \qquad 0 < x < L, \quad t > 0,

with boundary conditions u(0,t)=u(L,t)=0u(0, t) = u(L, t) = 0 for all tt (the ends are clamped), and initial conditions u(x,0)=f(x)u(x, 0) = f(x) (the initial shape) and ut(x,0)=0u_t(x, 0) = 0 (the string starts at rest).

Step 1 — Substitute the product ansatz. Try

u(x,t)  =  X(x)T(t).u(x, t) \;=\; X(x)\, T(t).

The partial derivatives separate cleanly:

2ut2  =  X(x)T(t),2ux2  =  X(x)T(t).\frac{\partial^2 u}{\partial t^2} \;=\; X(x)\, T''(t), \qquad \frac{\partial^2 u}{\partial x^2} \;=\; X''(x)\, T(t).

Substituting into the wave equation:

X(x)T(t)  =  c2X(x)T(t).X(x)\, T''(t) \;=\; c^2\, X''(x)\, T(t).

Step 2 — Divide by X(x)T(t)X(x)\, T(t) and separate.

T(t)c2T(t)  =  X(x)X(x).\frac{T''(t)}{c^2\, T(t)} \;=\; \frac{X''(x)}{X(x)}.

The left side depends only on tt. The right side depends only on xx. For two functions of independent variables to be equal at all values of those variables, both must equal the same constant. Call that constant k2-k^2:

Tc2T  =  XX  =  k2.\frac{T''}{c^2 T} \;=\; \frac{X''}{X} \;=\; -k^2.

(The sign is a convention. Choosing k2-k^2 rather than +k2+k^2 anticipates that the bounded-domain problem will produce oscillating spatial solutions, not exponentially growing or decaying ones. If we got the sign wrong we would discover it later — the boundary conditions would force only the trivial solution. We will see that below.)

The PDE has decoupled into two ODEs:

X(x)  +  k2X(x)  =  0,T(t)  +  c2k2T(t)  =  0.X''(x) \;+\; k^2\, X(x) \;=\; 0, \qquad T''(t) \;+\; c^2 k^2\, T(t) \;=\; 0.

Both are second-order linear ODEs with constant coefficients — exactly the equations we learned to solve in 5.3.

Step 3 — Solve the spatial ODE with its boundary conditions. The spatial ODE X+k2X=0X'' + k^2 X = 0 has the general solution

X(x)  =  Asin(kx)+Bcos(kx).X(x) \;=\; A \sin(k x) + B \cos(k x).

Apply the left boundary condition X(0)=0X(0) = 0 (the value u(0,t)=0u(0, t) = 0 forces X(0)T(t)=0X(0)\, T(t) = 0 for all tt, so unless TT is identically zero we need X(0)=0X(0) = 0):

0  =  Asin(0)+Bcos(0)  =  B,0 \;=\; A \sin(0) + B \cos(0) \;=\; B,

so B=0B = 0 and X(x)=Asin(kx)X(x) = A \sin(k x). Apply the right boundary condition X(L)=0X(L) = 0:

0  =  Asin(kL).0 \;=\; A \sin(k L).

We don’t want A=0A = 0 (that gives the trivial X0X \equiv 0). So we need sin(kL)=0\sin(k L) = 0, which forces

kL  =  nπ,n=1,2,3,k L \;=\; n \pi, \qquad n = 1, 2, 3, \ldots

This is the quantisation condition. The boundary conditions have selected a discrete set of allowed kk values:

kn  =  nπL,n=1,2,3,k_n \;=\; \frac{n \pi}{L}, \qquad n = 1, 2, 3, \ldots

with corresponding mode shapes

Xn(x)  =  sin ⁣(nπxL).X_n(x) \;=\; \sin\!\left(\frac{n \pi x}{L}\right).

The amplitude AA is absorbed into the time-dependent coefficient at the end. Each integer nn labels one mode: n=1n = 1 is the half-wavelength fundamental, n=2n = 2 has a node at the centre, and so on. We get infinitely many modes, indexed by nn.

Quick check on the sign of the separation constant. If we had chosen +k2+k^2 instead of k2-k^2, the spatial ODE would be Xk2X=0X'' - k^2 X = 0 with solution Aekx+BekxA e^{kx} + B e^{-kx} — exponentials, not sinusoids. The boundary conditions X(0)=X(L)=0X(0) = X(L) = 0 would force A=B=0A = B = 0. Only the sign that gives sinusoids produces non-trivial modes. The boundary conditions chose the sign for us.

Step 4 — Solve the time ODE for each mode. For each knk_n the time ODE is

T(t)  +  c2kn2T(t)  =  0,T''(t) \;+\; c^2 k_n^2\, T(t) \;=\; 0,

with ωnckn=nπc/L\omega_n \equiv c k_n = n \pi c / L. The general solution is the simple-harmonic motion we know from 5.3:

Tn(t)  =  Ancos(ωnt)+Bnsin(ωnt).T_n(t) \;=\; A_n \cos(\omega_n t) + B_n \sin(\omega_n t).

Step 5 — Build the general solution. Each Xn(x)Tn(t)X_n(x)\, T_n(t) solves the PDE and the boundary conditions. By linearity, any sum of them also solves the PDE and the boundary conditions. The general solution is the superposition:

u(x,t)  =  n=1sin ⁣(nπxL)[Ancos(ωnt)+Bnsin(ωnt)].u(x, t) \;=\; \sum_{n=1}^{\infty} \sin\!\left(\frac{n \pi x}{L}\right) \bigl[\, A_n \cos(\omega_n t) + B_n \sin(\omega_n t) \,\bigr].

We have two coefficient sets, {An}\{A_n\} and {Bn}\{B_n\} — one set per piece of initial data, just as a second-order ODE in time needs two initial pieces.

Step 6 — Apply the initial conditions. From u(x,0)=f(x)u(x, 0) = f(x):

f(x)  =  n=1Ansin ⁣(nπxL).f(x) \;=\; \sum_{n=1}^{\infty} A_n \sin\!\left(\frac{n \pi x}{L}\right).

This is a Fourier sine series expansion of ff on [0,L][0, L]. The coefficients AnA_n are extracted by projection onto the mode basis, a step we develop properly in 6.5 — Modes once we have the orthogonality relations in hand.

From ut(x,0)=0u_t(x, 0) = 0:

0  =  n=1ωnBnsin ⁣(nπxL)    Bn=0 for all n.0 \;=\; \sum_{n=1}^{\infty} \omega_n\, B_n\, \sin\!\left(\frac{n \pi x}{L}\right) \;\Longrightarrow\; B_n = 0 \text{ for all } n.

Step 7 — Final answer.

  u(x,t)  =  n=1Ansin ⁣(nπxL)cos ⁣(nπctL),  \boxed{\;u(x, t) \;=\; \sum_{n=1}^{\infty} A_n \sin\!\left(\frac{n \pi x}{L}\right) \cos\!\left(\frac{n \pi c\, t}{L}\right),\;}

with {An}\{A_n\} the Fourier sine-series coefficients of the initial shape f(x)f(x).

Step 8 — Sanity-check.

  1. Boundary conditions. Every term has sin(nπx/L)\sin(n \pi x / L), which vanishes at x=0x = 0 and x=Lx = L. ✓
  2. Initial shape. At t=0t = 0, every cosine is 1 and the formula reduces to u(x,0)=Ansin(nπx/L)u(x, 0) = \sum A_n \sin(n\pi x / L), the Fourier series of ff. ✓
  3. Initial velocity. Differentiate in tt and evaluate at t=0t = 0. Every term picks up a factor of ωnsin(ωn0)=0\omega_n \sin(\omega_n \cdot 0) = 0. So ut(x,0)=0u_t(x, 0) = 0. ✓
  4. PDE. For each nn, t2[cos(ωnt)]=ωn2cos(ωnt)\partial_t^2 [\cos(\omega_n t)] = -\omega_n^2 \cos(\omega_n t) and x2[sin(knx)]=kn2sin(knx)\partial_x^2 [\sin(k_n x)] = -k_n^2 \sin(k_n x). Since ωn=ckn\omega_n = c k_n, the term satisfies utt=c2uxxu_{tt} = c^2 u_{xx}. ✓

What just happened, in two sentences

The PDE separated cleanly into two second-order ODEs because the wave equation is linear and the unknown’s xx-dependence and tt-dependence enter through different terms. Bounded-domain boundary conditions on XX then quantised the separation constant, producing a discrete ladder of modes whose superposition is the general solution.

The technique is mechanical, but two things in the algorithm carry real physical content and deserve to be unpacked: how the boundary conditions are chosen (next lesson, 6.4), and what the resulting modes really are — their orthogonality, completeness, and how to project initial data onto them (6.5).