Separation of Variables
Separation of variables turns a PDE into ODEs. Learn the procedure (product solution, separation constant), eigenvalue problems from boundary conditions, superposition and Fourier series for initial conditions, and full solutions of the heat equation, wave equation (standing waves) and Laplace's equation on a rectangle — with a Python evaluation.
For simple geometries with linear PDEs and homogeneous BCs, separation of variables gives exact solutions as sums of modes — the same modes (sin nπx/L) that vibrate on a guitar string or decay in a heated rod.
An analogy
Separation of variables is like describing a chord as a sum of pure notes: each note (mode) evolves independently, and the initial chord fixes how loud each note is.
Procedure
Assume u = X(x)T(t); substitute; divide by XT; set each side equal to −λ; solve the spatial ODE with BCs (eigenvalue problem); solve the time ODE; superpose; match ICs with Fourier series.
Heat equation
Higher modes decay faster (∝ n²), so after a short time the lowest mode dominates — the basis of time-constant estimates in thermal design.
Wave equation
Each mode is a standing wave oscillating at fₙ = nc/2L: harmonics of strings, organ pipes and beams. Plucking position decides which harmonics are excited.
Extensions
Non-homogeneous BCs: subtract a steady-state solution first. Other geometries: Bessel (cylinders) and Legendre (spheres) modes. When separation fails, use numerical methods.
Formulas
- Heat equation, u(0) = u(L) = 0:
u = Σ Bₙ sin(nπx/L) e^(−α²(nπ/L)²t), Bₙ = (2/L)∫₀ᴸ f(x) sin(nπx/L) dx - Wave equation (fixed ends):
u = Σ sin(nπx/L)[Aₙ cos(nπct/L) + Bₙ sin(nπct/L)] - Natural frequencies:
fₙ = nc/(2L) - Laplace on a rectangle:
u = Σ Cₙ sin(nπx/a) sinh(nπy/a)
Worked example: Heat equation with a square initial profile
Given: u(x, 0) = 100 on (0, L), ends at 0
Find: Bₙ.
- Bₙ = (2/L)∫ 100 sin(nπx/L) dx = (200/nπ)(1 − cos nπ)
- Bₙ = 400/(nπ) for odd n, 0 for even n
Answer: u = Σ_odd (400/nπ) sin(nπx/L) e^(−α²(nπ/L)²t)
Worked example: String harmonics
Given: c = 264.6 m/s, L = 0.65 m
Find: First three frequencies.
- fₙ = n × 264.6/1.3
Answer: 203.5, 407.0, 610.6 Hz
Evaluate the heat-equation solution (Python)
import numpy as np
# 1D heat equation u_t = a u_xx on [0, L], u = 0 at both ends
# Separation of variables: u = 100 sin(pi x / L) exp(-a (pi/L)^2 t)
a, L = 1.11e-4, 0.5 # copper diffusivity (m^2/s), rod length (m)
x = np.linspace(0, L, 5)
for t in (0, 100, 228, 600):
u = 100 * np.sin(np.pi * x / L) * np.exp(-a * (np.pi / L) ** 2 * t)
print(f"t = {t:4d} s u(L/2) = {u[2]:6.2f} C profile = {np.round(u, 1)}")
# t = 0 s u(L/2) = 100.00 C profile = [ 0. 70.7 100. 70.7 0. ]
# t = 100 s u(L/2) = 64.52 C profile = [ 0. 45.6 64.5 45.6 0. ]
# t = 228 s u(L/2) = 36.82 C profile = [ 0. 26. 36.8 26. 0. ]
# t = 600 s u(L/2) = 7.21 C profile = [0. 5.1 7.2 5.1 0. ]With a single-mode initial condition, only B₁ is non-zero. After one time constant (≈ 228 s) the mode has decayed to e⁻¹ ≈ 36.8 % — exactly as the formula predicts.
Common mistakes
- Wrong: Choosing a positive separation constant for fixed-end BCs. — Right: Only negative constants give non-trivial sin solutions.
- Wrong: Using non-homogeneous BCs directly. — Right: Shift by a steady-state solution first.
Applications
- Thermal transients: Cooling of plates, rods and walls.
- Musical & structural vibration: Mode shapes and frequencies.
- Electrostatics: Potential in rectangular regions.
Key takeaways
- u = XT → two ODEs.
- BCs give eigenvalues and modes.
- ICs give Fourier coefficients.
- Heat modes decay; wave modes oscillate.
Going further
- Sturm–Liouville problems: General eigenfunction expansions (M24).
- Duhamel's principle: Time-dependent sources.
- Numerical PDEs: Finite differences when separation fails (M9).