MathLabs

Differential equations and dynamical systems

The heat equation

Describes how temperature diffuses over time, the prototypical parabolic PDE.

IntuitionDiffusion smooths out temperature differences

Drop a hot coin into a bowl of cold water: the sharp boundary between hot and cold does not stay sharp. Heat flows from warmer regions to colder ones, and within moments the temperature profile becomes a smooth curve instead of a jump. This is the defining behaviour the heat equation captures: it is a rule for how a temperature distribution u(x,t)u(x,t) evolves so that peaks flatten, valleys fill in, and information about the exact initial shape gradually blurs — but never reverses on its own.

Interactive Fourier series widget showing decaying sine modes that combine into the heat equation's solution.
The heat equation's solution is a sum of decaying Fourier modes, each shrinking as e−α(nπ/L)2te^{-\alpha (n\pi/L)^2 t}: raise nn (number of terms) to see a rough initial profile, then watch how the high-frequency ("wiggly") components die out first while the smooth fundamental mode survives longest.

UndergraduateThe heat equation and the Fourier sine series solution

Definition: The heat (diffusion) equation

Let u(x,t)u(x,t) denote the temperature at position xx on a rod of length LL at time t≥0t \ge 0. The heat equation states ut=αuxxu_t = \alpha u_{xx}, where α>0\alpha > 0 is the thermal diffusivity of the material: larger α\alpha means heat spreads faster. On a finite rod we impose boundary conditions, for instance u(0,t)=u(L,t)=0u(0,t) = u(L,t) = 0 (both ends held at zero temperature), and an initial condition u(x,0)=f(x)u(x,0) = f(x) describing the temperature profile at time zero.

ut=α uxx,0<x<L, t>0u_t = \alpha\, u_{xx}, \qquad 0 < x < L,\ t > 0

Because the equation and boundary conditions are linear, solutions can be built by superposition. Separating variables (u=X(x)T(t)u = X(x)T(t)) forces XX to be an eigenfunction of the second derivative satisfying the boundary conditions, namely sin⁡ ⁣(nπxL)\sin\!\left(\frac{n\pi x}{L}\right) for n=1,2,3,…n = 1, 2, 3, \dots, each paired with its own exponential decay in time e−α(nπ/L)2te^{-\alpha (n\pi/L)^2 t}. Summing all such modes with coefficients bnb_n chosen to match the initial data gives the general solution.

u(x,t)=∑n=1∞bnsin⁡ ⁣(nπxL)e−α(nπ/L)2t,bn=2L∫0Lf(x)sin⁡ ⁣(nπxL)dxu(x,t) = \sum_{n=1}^{\infty} b_n \sin\!\left(\frac{n\pi x}{L}\right) e^{-\alpha (n\pi/L)^2 t}, \qquad b_n = \frac{2}{L}\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx
The heat equation compared with the other two classical second-order PDEs
EquationFormulaType / behaviour
Heat equationut=αuxxu_t = \alpha u_{xx}Parabolic; irreversible smoothing, infinite propagation speed
Wave equationutt=c2uxxu_{tt} = c^2 u_{xx}Hyperbolic; oscillation, finite propagation speed, time-reversible
Laplace's equationuxx+uyy=0u_{xx} + u_{yy} = 0Elliptic; steady state (no time dependence), maximum principle

UndergraduateCore theorems: the series solution and the maximum principle

For the heat equation ut=αuxxu_t = \alpha u_{xx} on 0<x<L0<x<L with boundary conditions u(0,t)=u(L,t)=0u(0,t) = u(L,t) = 0 and initial condition u(x,0)=f(x)u(x,0) = f(x) where ff is piecewise continuous, the series u(x,t)=∑n=1∞bnsin⁡ ⁣(nπxL)e−α(nπ/L)2tu(x,t) = \displaystyle\sum_{n=1}^{\infty} b_n \sin\!\left(\frac{n\pi x}{L}\right) e^{-\alpha (n\pi/L)^2 t} with coefficients bn=2L∫0Lf(x)sin⁡ ⁣(nπxL)dxb_n = \dfrac{2}{L}\displaystyle\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx converges (for t>0t>0) to a solution satisfying all three conditions.

Why is it true?

Sine functions with these particular frequencies are exactly the shapes that keep zero temperature at both ends while decaying independently in time; since every reasonable initial shape can be written as a sum of such sine waves (a Fourier sine series), the same decomposition immediately produces the solution at all later times.

Proof

Seek a solution of the separated form u(x,t)=X(x)T(t)u(x,t)=X(x)T(t). Substituting into ut=αuxxu_t = \alpha u_{xx} gives X(x)T′(t)=αX′′(x)T(t)X(x)T'(t) = \alpha X''(x)T(t), and dividing by αX(x)T(t)\alpha X(x)T(t) separates the variables: T′(t)αT(t)=X′′(x)X(x)=−λ\dfrac{T'(t)}{\alpha T(t)} = \dfrac{X''(x)}{X(x)} = -\lambda, where λ\lambda must be a constant because the left side depends only on tt and the right side only on xx.

The boundary conditions u(0,t)=u(L,t)=0u(0,t) = u(L,t) = 0 force X(0)=X(L)=0X(0)=X(L)=0. The eigenvalue problem X′′+λX=0X'' + \lambda X = 0 with these boundary conditions has nontrivial solutions only for λn=(nπ/L)2\lambda_n = (n\pi/L)^2, n=1,2,3,…n=1,2,3,\dots, with eigenfunctions sin⁡ ⁣(nπxL)\sin\!\left(\frac{n\pi x}{L}\right); any other value of λ\lambda forces X≡0X \equiv 0. Solving T′(t)=−αλnT(t)T'(t) = -\alpha\lambda_n T(t) then gives Tn(t)=e−α(nπ/L)2tT_n(t) = e^{-\alpha (n\pi/L)^2 t}.

Each product un(x,t)=sin⁡ ⁣(nπxL)e−α(nπ/L)2tu_n(x,t) = \sin\!\left(\frac{n\pi x}{L}\right)e^{-\alpha (n\pi/L)^2 t} solves the equation and boundary conditions. By linearity, so does any finite or (under mild convergence conditions) infinite sum u(x,t)=∑n=1∞bnsin⁡ ⁣(nπxL)e−α(nπ/L)2tu(x,t) = \displaystyle\sum_{n=1}^{\infty} b_n \sin\!\left(\frac{n\pi x}{L}\right) e^{-\alpha (n\pi/L)^2 t}. Setting t=0t=0 and using the orthogonality relation ∫0Lsin⁡(nπxL)sin⁡(mπxL) dx=0\int_0^L \sin(\frac{n\pi x}{L})\sin(\frac{m\pi x}{L})\,dx = 0 for n≠mn \ne m (and =L/2=L/2 for n=mn=m) to project f(x)f(x) onto each mode yields exactly the coefficients bn=2L∫0Lf(x)sin⁡ ⁣(nπxL)dxb_n = \dfrac{2}{L}\displaystyle\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx, so the initial condition u(x,0)=f(x)u(x,0) = f(x) is matched termwise.

Let uu be continuous on [0,L]×[0,T][0,L]\times[0,T] and satisfy ut=αuxxu_t = \alpha u_{xx} on the open rectangle 0<x<L, 0<t≤T0<x<L,\ 0<t\le T. Then the maximum of uu over the whole closed rectangle is already attained on the "parabolic boundary" — the initial edge t=0t=0 or one of the two sides x=0x=0, x=Lx=L — never at an interior point with t>0t>0 unless uu is constant there.

Why is it true?

Heat has nowhere to come from except the initial data and the boundary temperatures: if a hidden interior point were the single hottest spot at some later time, heat would have to be spontaneously created there, which the diffusion process forbids — diffusion only ever moves heat from hot to cold, it never manufactures a new peak in empty space.

Proof

Fix ε>0\varepsilon>0 and define v(x,t)=u(x,t)−εtv(x,t) = u(x,t) - \varepsilon t, so vt−αvxx=ut−ε−αuxx=−ε<0v_t - \alpha v_{xx} = u_t - \varepsilon - \alpha u_{xx} = -\varepsilon < 0 everywhere on the open rectangle. Suppose, for contradiction, that vv attains its maximum over the closed rectangle at an interior point (x0,t0)(x_0,t_0) with 0<x0<L0<x_0<L and 0<t0≤T0<t_0\le T — i.e. off the parabolic boundary.

Because x0x_0 is an interior spatial maximum, the second-derivative test gives vxx(x0,t0)≤0v_{xx}(x_0,t_0)\le 0. Because t0t_0 is where the maximum over t∈[0,T]t\in[0,T] is reached (either an interior critical time, giving vt(x0,t0)=0v_t(x_0,t_0)=0, or the endpoint t0=Tt_0=T approached from the left, giving vt(x0,t0)≥0v_t(x_0,t_0)\ge 0), in either case vt(x0,t0)≥0v_t(x_0,t_0)\ge 0.

Combining the two inequalities, vt(x0,t0)−αvxx(x0,t0)≥0−α⋅0=0v_t(x_0,t_0) - \alpha v_{xx}(x_0,t_0) \ge 0 - \alpha\cdot 0 = 0, which contradicts vt−αvxx=−ε<0v_t-\alpha v_{xx}=-\varepsilon<0 at every point. Hence no such interior maximum exists, so vv's maximum lies on the parabolic boundary Γ\Gamma (the initial edge together with the two lateral edges), giving u(x,t)≤εt+max⁡Γuu(x,t) \le \varepsilon t + \max_{\Gamma} u everywhere. Letting ε→0+\varepsilon \to 0^+ proves the maximum principle for uu itself.

UndergraduateReal-World Applications and Worked Examples

The heat equation reaches far beyond thermodynamics. In engineering it models heat conduction through walls, engine parts, and electronic chips; in environmental science it models the diffusion of pollutants in air or water; in image processing, "Gaussian blur" is literally the heat kernel applied to pixel intensities; and in quantitative finance, the Black–Scholes equation for option pricing can be transformed by a change of variables into exactly this equation, which is why closed-form option pricing formulas exist at all.

Example: Cooling a rod with a mixed-frequency initial profile

A rod of length L=πL=\pi with diffusivity α=1\alpha=1 has both ends held at zero temperature and initial temperature u(x,0)=3sin⁡(x)−sin⁡(3x)u(x,0) = 3\sin(x) - \sin(3x). Find u(x,t)u(x,t) for t>0t>0.

Solution

The initial condition u(x,0)=3sin⁡(x)−sin⁡(3x)u(x,0) = 3\sin(x) - \sin(3x) on 0<x<π0<x<\pi with L=πL=\pi, α=1\alpha=1 is already written as a combination of the eigenfunctions sin⁡(nx)\sin(nx): it uses only n=1n=1 (coefficient 33) and n=3n=3 (coefficient −1-1), with every other bn=0b_n=0.

By the separation-of-variables theorem, each mode sin⁡(nx)\sin(nx) simply gets multiplied by its own decay factor e−n2te^{-n^2 t} (here α=1\alpha=1, L=πL=\pi so (nπ/L)2=n2(n\pi/L)^2=n^2). No integration is needed since the initial data is already a finite sine sum.

Substituting n=1n=1 and n=3n=3 into the series gives u(x,t)=3sin⁡(x)e−t−sin⁡(3x)e−9tu(x,t) = 3\sin(x)e^{-t} - \sin(3x)e^{-9t}. Note the n=3n=3 term decays nine times faster than the n=1n=1 term, so for large tt the temperature profile looks almost exactly like 3sin⁡(x)e−t3\sin(x)e^{-t}, a single smooth hump — a direct illustration of high-frequency modes dying out first.

Example: Fundamental solution: a pollutant plume in a still canal

A pollutant of total mass M=100M=100 (arbitrary units) is released instantaneously at x=0x=0 in a long still canal, diffusing with α=0.5 m2/s\alpha = 0.5\ \text{m}^2/\text{s}. Estimate the concentration u(2,10)u(2,10) at x=2 mx=2\ \text{m} downstream, t=10 st=10\ \text{s} later.

Solution

On an unbounded domain, a point release of mass MM at x=0x=0, t=0t=0 spreads according to the fundamental solution (heat kernel) u(x,t)=M4παt e−x2/(4αt)u(x,t) = \dfrac{M}{\sqrt{4\pi\alpha t}}\, e^{-x^2/(4\alpha t)}, which is exactly the n→∞n\to\infty, L→∞L\to\infty limit of the Fourier series construction: a Gaussian bump that starts as a spike and flattens out over time while its total area stays MM.

With M=100M=100 (arbitrary concentration units), α=0.5 m2/s\alpha = 0.5\ \text{m}^2/\text{s}, x=2 mx=2\ \text{m} and t=10 st=10\ \text{s}: compute the exponent first, x24αt=44(0.5)(10)=420=0.2\dfrac{x^2}{4\alpha t} = \dfrac{4}{4(0.5)(10)} = \dfrac{4}{20} = 0.2, so e−0.2≈0.819e^{-0.2} \approx 0.819.

Compute the prefactor: 4παt=4π(0.5)(10)=20π≈7.927\sqrt{4\pi\alpha t} = \sqrt{4\pi (0.5)(10)} = \sqrt{20\pi} \approx 7.927, so M4παt≈1007.927≈12.61\dfrac{M}{\sqrt{4\pi\alpha t}} \approx \dfrac{100}{7.927} \approx 12.61. Multiplying, u(2,10)≈12.61×0.819≈10.3u(2,10) \approx 12.61 \times 0.819 \approx 10.3: ten seconds after release, the concentration two metres downstream has dropped to about 10.310.3 units, and it keeps falling and spreading as tt grows, illustrating the smoothing property directly.

For the heat equation ut=αuxxu_t = \alpha u_{xx} on a rod of length L=2L=2 with α=3\alpha=3 and boundary condition u(0,t)=u(L,t)=0u(0,t) = u(L,t) = 0, what is the decay rate λn\lambda_n (so the nn-th mode decays like e−λnte^{-\lambda_n t}) for n=2n=2?

According to the weak maximum principle for the heat equation, where must the maximum temperature over a closed space-time rectangle occur?

In the pollutant-diffusion example using the fundamental solution u(x,t)=M4παte−x2/(4αt)u(x,t) = \frac{M}{\sqrt{4\pi\alpha t}}e^{-x^2/(4\alpha t)}, what happens to the concentration profile as t→∞t \to \infty?

Why does the Black–Scholes option-pricing equation from quantitative finance have a closed-form solution?

References

  1. Lawrence C. Evans (2010). Partial Differential Equations
  2. James Ward Brown, Ruel V. Churchill (2011). Fourier Series and Boundary Value Problems