Math Methods · Learn

The Heat & Wave Equations

Two PDEs that look almost identical — one with a first time-derivative, one with a second — and that tiny difference gives them opposite souls: one diffuses and forgets, the other oscillates and remembers.

▶ Play the lab📖 Learn the theory

1Separation of variables

Both equations yield to the same idea: guess that the solution factors into a shape times a time,

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

Substitute, divide, and the PDE splits into two ordinary ODEs — one for the spatial shape $X$, one for the time evolution $T$ — linked by a separation constant.

2The boundary conditions pick the modes

Fixed ends, $u(0,t)=u(L,t)=0$, force the spatial part to be the eigenfunctions

$$ X_n(x) = \sin\frac{n\pi x}{L}, \qquad n=1,2,3,\dots $$

Any initial state is first broken into these modes — a Fourier sine series (see the Fourier page) — and then each mode evolves independently. All the difference between heat and waves lives in how that mode evolves in time.

3The heat equation forgets

$$ \frac{\partial u}{\partial t} = \alpha\frac{\partial^2 u}{\partial x^2} \;\Rightarrow\; T_n(t) = e^{-(n\pi/L)^2\alpha t} $$

Each mode decays, and the exponent grows with $n^2$ — so high-frequency wiggles vanish almost instantly while the smooth fundamental lingers. That's why diffusion smooths: a jagged initial profile melts to a gentle hump and fades to flat. The sharp detail is gone forever.

4The wave equation remembers

$$ \frac{\partial^2 u}{\partial t^2} = c^2\frac{\partial^2 u}{\partial x^2} \;\Rightarrow\; T_n(t) = \cos\frac{n\pi c t}{L} $$

Now each mode oscillates and never decays, so the high modes keep ringing alongside the low ones. Sharp corners survive, and the whole shape periodically reassembles itself — a plucked string returns to its starting form every period. (Equivalently, d'Alembert's solution is two copies of the initial shape traveling in opposite directions.)

▶ In the lab

Load a square pulse and run Heat — the corners melt as the spectrum collapses from the high end. Switch the same pulse to Wave — the corners persist and travel. Same modes, opposite fate. Open the lab →

Key takeaways

📄 Further reading

Bjorn Poonen's free MIT 18.03 lecture notes (PDF) derive the heat equation in §29 and the wave equation in §30, working through the same separation-of-variables steps this lab animates.

EngineeringCandy · Learn · the theory behind the playground