Learning Objectives
By the end of this section, you will be able to:
- Derive Laplace's equation as the long-time limit of the heat equation.
- Explain the relaxation rule and why averaging neighbours encodes the Laplacian.
- State and use the mean-value property and the maximum principle to predict, without computation, whether an interior point can ever be hotter than the boundary.
- Solve a steady-state heat problem by hand on a small grid and on a large grid with Python / PyTorch.
- Recognise where steady-state heat models appear in engineering — chip cooling, building insulation, planetary temperatures, image inpainting.
From Time Evolution to Equilibrium
"Wait long enough, and every temperature settles down. What remains is a frozen portrait of how heat balances itself."
Heat does not stand still. Pour hot coffee into a cold mug and the temperature changes everywhere in the system — the mug warms, the coffee cools, the air carries energy away. The transient stage of this story is told by the heat equation, . But in many practical situations we do not care about the transient at all. We care about what the temperature looks like once nothing is changing any more: the engine block has been running for hours, the heat sink has reached its operating temperature, the planet has been receiving sunlight for billions of years.
When nothing changes any more, . Plug that into the heat equation and the time derivative on the left collapses to zero, leaving
This is Laplace's equation. Every problem in this chapter — electrostatic potential, incompressible flow, gravitational potential in empty space — reduces to the same PDE because they all describe equilibrium states. Steady-state heat is simply the most physically intuitive entry point.
Warm-Up: The 1D Rod
Before going to two dimensions, settle the intuition in one. Take a thin uniform rod of length , perfectly insulated along its sides, held at temperature on the left end and on the right. Heat flows from hot to cold along the rod until the temperature stops changing.
In 1D the Laplacian is just , so the steady-state equation becomes
Integrate twice. The first integration gives , a constant slope. The second gives , a straight line. The two boundary conditions pin and , so
The 1D moral. "Steady state" means "the second derivative vanishes." In 1D that forces the profile to be a straight line — there is just one shape it can take. The heat flux is also constant: just as much heat enters from the left as leaves from the right, every second.
Two dimensions are richer. The constraint still forces smoothness, but the field has room to bend — it can be steep in one direction and shallow in the perpendicular one. The rest of this section explores how that extra freedom unfolds.
Why Laplace's Equation Governs Steady-State Heat
Let us be slightly more careful. The 2D heat equation is
Here is the temperature at point at time , and is the thermal diffusivity — large for copper, small for wood, ridiculous for ice cream.
Suppose the boundary temperatures are held constant in time (a heater on one side, an ice bath on the other). Intuitively the interior temperature should approach a unique equilibrium — and it does. As , , and the limit obeys
with the same boundary data. This is a boundary value problem: no initial condition is needed because all memory of the past has decayed away.
There is also a direct, time-independent derivation that is worth carrying in your head. In equilibrium, the net heat flux into any small region must be zero (otherwise its temperature would change and we would not be in equilibrium). Fourier's law says the flux is . The divergence theorem turns "net flux through the boundary" into , which equals . Setting this to zero for every region forces pointwise. The Laplacian is just the "net flow out minus flow in" per unit area.
The Relaxation Rule and Why It Works
Discretise the plane on a square grid of spacing . The standard second-order finite differences give
Add them and set the sum to zero. The cancels, and we are left with
which rearranges into the celebrated five-point stencil:
The intuition in one sentence: at equilibrium, every cell is the average of its four neighbours. The heat flowing in from above-plus-below must equal the heat flowing out to left-plus-right, otherwise the cell would be heating or cooling.
That algebraic identity is also an algorithm. Pick any initial guess. Sweep through every interior cell and overwrite it with the average of its four current neighbours. Repeat. The field relaxes to the unique steady state. This is called Jacobi iteration, and it is the cousin of gradient descent on the energy functional .
The Mean-Value Property
The discrete rule above is a finite-difference shadow of an exact continuous statement called the mean-value property of harmonic functions:
for every disk of radius centred at that fits inside the domain. In words: the value at the centre equals the average of the values on the circle around it.
This is one of the most elegant facts in calculus. It says that harmonic functions are perfectly smooth and democratic: no single point can defy its neighbours, because it is forced to be their average. Slide the circle around the field below and watch the equality hold no matter where you put it.
Notice that the equality is exact — the slight numerical difference you see is purely discretisation error from sampling the continuous field on a finite grid.
The Maximum Principle: No Bumps Inside
From the mean-value property, an immediate corollary falls out that engineers rely on every day: the maximum principle.
Maximum principle (heat version). Suppose is harmonic on a domain . Then the maximum and minimum of are both attained on the boundary , not in the interior.
Why? If had an interior local maximum at some point , then would be strictly greater than every nearby value — but the mean-value property forces to equal the average of those nearby values. Contradiction. The same argument rules out interior local minima.
Physically: no interior point can be hotter than every single point on the boundary. If your chip is dissipating heat purely through its boundary, and the package surface is at 80°C, then nowhere in the silicon can exceed 80°C in steady state. The only way to get an interior hotspot is to add an internal heat source, which turns Laplace into Poisson's equation — the subject of Chapter 33.
Worked Example: 3×3 Grid by Hand
Before letting the computer iterate ten thousand times, do two passes by hand on a tiny grid. This builds enormous intuition for what the solver is actually doing.
Walk through Jacobi iteration on a 5×5 grid (3×3 interior)
Setup. We use a 5×5 grid: a 3×3 interior of unknowns plus a one-cell-thick boundary on all sides. Boundary conditions: top = 100°, bottom = left = right = 0°. Seed the interior with the boundary average .
Initial field: 100 100 100 100 100 0 25 25 25 0 0 25 25 25 0 0 25 25 25 0 0 0 0 0 0
Iteration 1. Apply using the values from the previous field. For example, the top-left interior cell at position (1, 1):
The top-middle cell at (1, 2):
Filling all nine interior cells the same way gives:
After iteration 1: 100 100 100 100 100 0 37.50 43.75 37.50 0 0 18.75 25.00 18.75 0 0 12.50 18.75 12.50 0 0 0 0 0 0
Iteration 2. Repeat using the iteration-1 field. For example,
After iteration 2: 100 100 100 100 100 0 40.625 50.000 40.625 0 0 18.750 25.000 18.750 0 0 9.375 12.500 9.375 0 0 0 0 0 0
The centre. Notice that the centre cell stays at exactly 25.0 in every iteration. This is not a coincidence — it is the exact analytic value for this geometry. Here is why:
By symmetry, the centre temperature for the "top hot, others cold" problem equals some number . By rotating the box, the same number is the centre value for "bottom hot", "left hot", and "right hot" problems. By linearity of Laplace's equation, the sum of those four solutions solves the all-sides-at-100° problem, whose answer is the constant 100°. Therefore , so .
After 20 Jacobi iterations the rest of the field still has not quite converged (the cells nearest the hot edge are still climbing toward their true values around 43° and 52°), but the centre is already exact. The mean-value property is doing real work here.
Interactive Solver
Here is the same algorithm scaled up to a 60×60 grid. Drag the four boundary sliders, press Play to watch the field relax, or step one iteration at a time. Click anywhere on the field to read off the temperature at that point.
A few experiments to do with this visualiser:
- Set the four sides to 100, 0, 100, 0. The diagonal symmetry forces the centre to be exactly 50 — confirm by clicking the middle.
- Set three sides to 0 and the fourth to 100. The centre converges to 25 (the rotation-symmetry argument from the worked example).
- Make all four sides equal. The solution is a constant equal to that value — the only harmonic function with constant Dirichlet data on a closed boundary.
- Watch the residual. It decays roughly geometrically, which reflects the slow eigenvalue of the Jacobi iteration matrix on a square grid (about ).
Python: Solving with Jacobi Iteration
Now let us write the same algorithm explicitly. Plain Python with NumPy makes every step transparent. Read every line carefully — the entire body of the function is just average your neighbours, repeated until nothing changes.
Running this for converges in about iterations to a residual of . The reported centre temperature is 25.0000 to four decimals — exactly the symmetry prediction.
PyTorch: The Same Idea, Tensorized
The five-point stencil is a tiny convolution. That observation makes the GPU port absurdly short — we describe the averaging rule as a 3×3 kernel and let torch.nn.functional.conv2d do the work. The boundary still needs to be re-imposed by hand because conv2d does not know it is special.
For the PyTorch version finishes in seconds on a consumer GPU while NumPy takes minutes. The algorithm is identical — the only thing that changed is who is doing the arithmetic.
Why this matters for ML practitioners. The same averaging kernel appears in image processing as a blur, in graph neural networks as a diffusion step, and in diffusion models as the score-matching denoiser. They are all discrete approximations of solutions to Laplace-like PDEs. Recognising the structure in one place teaches you the others.
Where This Shows Up in the Real World
Steady-state heat models are everywhere. A few representative examples:
| Setting | Quantity | Boundary data |
|---|---|---|
| CPU / GPU die cooling | Silicon temperature in steady operation | Heat-sink contact temperature, ambient |
| Building thermal design | Wall and ceiling temperatures in winter | Indoor 20°C / outdoor −5°C |
| Geothermal gradient | Crust temperature with depth | Surface ≈ 15°C / Moho ≈ 600°C |
| Heat-sink fin design | Fin surface temperature distribution | Base temperature, convective ambient |
| Image inpainting | Missing pixels in a photo | Known pixels surrounding the hole |
| Cartography / shading | Smoothly interpolated elevation | Known contour-line values |
The image-inpainting connection (a small detour)
Image inpainting — filling in a missing region of a photograph — is mathematically identical to a steady-state heat problem. Treat the known pixels as boundary conditions and let the missing pixels relax to the harmonic interpolant. The Jacobi iteration we just wrote, applied to a colour image with a hole cut out, is literally Poisson image editing without sources. Adding sources gives you Photoshop's seamless-cloning feature, which is Poisson's equation — the next chapter.
Summary
- Steady-state heat distributions are exactly the harmonic functions: solutions to with prescribed boundary temperatures.
- The discrete five-point rule is both the discrete Laplacian-equals-zero condition and the iterative algorithm that finds it.
- Harmonic functions obey the mean-value property — the centre of any disk equals the average around the rim — which forces all extrema to live on the boundary.
- The same algorithm runs in NumPy (CPU) and as a 3×3 convolution in PyTorch (GPU). The math is identical; only the data plumbing changes.
- Recognising harmonic interpolation in disguise — heat sinks, image inpainting, terrain shading, graph smoothing — turns a single PDE into a dozen practical tools.