The Heated Rod

This exact setup — a rod, both ends clamped at a fixed temperature, some lumpy initial heat profile in between — is the single most-worked example in the whole history of partial differential equations. It is the problem that separation of variables and the Fourier sine series were invented, in tandem, specifically to crack. Every technique invented for harder PDEs later gets tried out here first — if a method can't handle this rod, it can't handle anything harder. This page puts the whole toolkit together, for the first time, on one genuinely complete example.

Now the full problem: a rod of length L, its ends held at 0^\circ, starting from a known temperature profile f(x). We solve

u_t = \alpha\,u_{xx}, \qquad u(0, t) = u(L, t) = 0, \qquad u(x, 0) = f(x),

by separation of variables. Each product mode e^{-\alpha\lambda_n t}\sin\frac{n\pi x}{L} solves the equation and the boundary conditions; the superposition of them all is the general solution.

Fitting the start, then letting it decay

The eigenvalues are \lambda_n = (n\pi/L)^2, so the solution is

u(x, t) = \sum_{n=1}^{\infty} b_n\, e^{-\alpha (n\pi/L)^2 t}\,\sin\frac{n\pi x}{L}.

At t = 0 every exponential is 1, so the sum must equal f(x) — meaning the b_n are exactly the Fourier sine coefficients of the initial profile:

b_n = \frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}\,dx.

After that, each mode simply decays at its own rate \alpha(n\pi/L)^2 \propto n^2. High modes (sharp features) vanish fastest, which is why a jagged start rounds off almost immediately and the whole rod drifts smoothly to 0^\circ.

All roads lead to one smooth hump

Imagine starting the rod off with a jagged, spiky profile — several sharp peaks and dips jammed together, needing dozens of sine modes just to describe accurately at t = 0. Because each mode's own decay rate is \propto n^2, the high-numbered modes that carry the jagged detail (n = 10, 20, \dots) evaporate almost immediately, while the fundamental mode n = 1 lingers far longer than all the rest.

So a little while after the rod starts cooling, essentially every trace of the original jaggedness is gone, and what is left is just b_1\,e^{-\alpha(\pi/L)^2 t}\sin(\pi x/L) — a single smooth arch, no matter how wild the starting shape was. The rod spends its final stretch of life shrinking that one gentle hump down toward zero everywhere. However complicated the start, the ending is always the same simple shape.

Cool the rod

The initial profile is a tent (a triangular heat pulse) on [0, \pi], with \alpha = 1. Slide N to add Fourier sine modes until the bold curve matches the faint tent at t = 0; then advance time t and watch the corner round off and the heat drain away to zero.

It's tempting to think sines were picked because they're a nice, familiar family of functions. They weren't — they were forced on us by the boundary conditions. We chose ends held at 0^\circ (Dirichlet conditions), and \sin(n\pi x/L) is exactly the family of functions that is zero at both x = 0 and x = L while still solving the separated spatial equation. Change the boundary conditions and the whole basis changes with it.

Insulate the ends instead — no heat allowed to escape, so the slope is zero there (Neumann conditions) — and sines no longer fit: \sin(n\pi x/L) has a nonzero slope at the ends. The right basis for insulated ends turns out to be cosines, \cos(n\pi x/L), which have zero slope exactly where it's needed. Same rod, same equation, same method — a different boundary condition hands you a completely different toolkit.

Joseph Fourier worked out this very rod problem in full, well over 200 years ago, while trying to understand how heat spreads through solid bodies (he was, by all accounts, more or less obsessed with warmth — he kept his rooms uncomfortably hot and wrapped himself in blankets even in summer). His method was so bizarre to his contemporaries — claiming that any function could be built from sines and cosines — that it took years for other mathematicians to accept it.

Two centuries on, Fourier's rod is still the very first fully worked example in essentially every course on partial differential equations, anywhere in the world — a genuine "hello world" of mathematical physics, still teaching newcomers the exact same lesson it taught in 1822.

See it explained