Learning Objectives
By the end of this section, you will be able to:
- State Laplace's equation and explain, in physical words, what it asserts about a function on a domain.
- Identify whether a given function is harmonic by computing its Laplacian by hand and by code.
- Use the mean value property as a self-contained definition of harmonicity, and explain why it forces the maximum principle.
- Derive the discrete Laplace equation on a grid and recognise that Jacobi iteration is repeated averaging.
- Solve a small boundary-value problem on a 4 × 4 grid by hand, then watch a 51 × 51 PyTorch implementation reproduce the same field at scale.
The Big Picture: Calculus of Equilibrium
Most equations in calculus describe change: velocity, growth, the propagation of heat over time. Laplace's equation is the opposite. It is the equation that survives once all the change has died down — the calculus of what remains after every wave has stilled, every diffusion has finished, every flow has reached its destination. It is the calculus of equilibrium.
The intuition. Imagine pressing a thin rubber sheet onto a wire frame bent into some shape. Once it stops vibrating, the sheet's height at every interior point is determined entirely by where the frame is. The sheet has the smoothest possible shape consistent with those boundary heights. That shape is the harmonic function. Laplace's equation is the mathematical statement that no interior point is "pulling harder" than its neighbours.
The same equation governs the steady-state temperature in a metal plate, the electrostatic potential between charged plates, the velocity potential of a smooth fluid flow, the pressure in a slow liquid through porous rock, and the displacement of a stretched membrane. Five wildly different physical situations — same equation, same solutions. That kind of universality is rare and worth paying attention to.
The one-line takeaway
Laplace's equation says: at every interior point, the value of is the average of the values in a tiny ball around it. There are no peaks, no valleys, no local extrema in the interior — only the smoothest possible shape that connects the boundary to itself.
From the Heat Equation to Laplace
We met the heat equation in Chapter 26:
It says that the rate of change of temperature at a point is proportional to how much the local temperature differs from the average of its immediate neighbours (the Laplacian measures exactly that difference). Hot spots cool, cold spots warm — and only if there is a difference.
Now ask: what happens after a very long time? If the boundary temperatures are held fixed, the interior will eventually settle into a state where nothing changes anymore. At that point:
That last equation is Laplace's equation. It is what you get when you ask "where does heat flow eventually stop?" It is the heat equation with the time derivative deleted. It is also what you would get by asking the same question of the wave equation, the diffusion equation, or any other equation whose right-hand side is the Laplacian.
Why this matters
Every parabolic equation (heat) and every hyperbolic equation (wave) has a Laplacian on the right-hand side. Their steady-state versions are all the same elliptic equation. That is why the small body of theory in this chapter covers so many physical phenomena: we are solving the universal steady-state problem, not any one of them in particular.
The Laplace Operator
Before stating the equation formally we need to know exactly what the symbol means. In two dimensions:
It is the sum of the unmixed second partial derivatives. In three dimensions you add a term. In dimensions you sum terms. No cross derivatives like ever appear — the Laplacian is invariant under rotation, and cross terms would break that.
Two readings of the Laplacian
Analytic: sum of the curvatures along each axis.
Geometric (more useful for intuition): — proportional to the average value of u in a tiny ball around minus the value at the centre.
That second reading is the key to everything. The Laplacian measures the local discrepancy between a point's value and its neighbourhood average. Saying is therefore the same as saying "every interior point equals the local average."
Laplace's equation:Find a function on the domain whose Laplacian vanishes in the interior and that takes prescribed values on the boundary.
Harmonic Functions: The Solutions
A function on an open set is called harmonic if at every point. Here are the most important harmonic functions:
| Function | Laplacian | Why harmonic |
|---|---|---|
| u(x, y) = c (constant) | 0 + 0 = 0 | Trivially smooth |
| u(x, y) = ax + by + c | 0 + 0 = 0 | Planes have no curvature |
| u(x, y) = x² − y² | +2 + (−2) = 0 | Curvatures cancel — the saddle |
| u(x, y) = xy | 0 + 0 = 0 | Rotated saddle |
| u(x, y) = e^x cos(y) | e^x cos(y) − e^x cos(y) = 0 | Real part of e^z |
| u(x, y) = ln√(x² + y²) | 0 (off origin) | The 2D fundamental solution |
Notice the pattern. The polynomials are — these are exactly the real and imaginary parts of . That is no coincidence: in 2D, every analytic complex function has and both harmonic, and conversely every harmonic arises as the real part of some complex analytic function. Complex analysis and 2D harmonic analysis are the same subject in disguise.
Why "harmonic"?
The name comes from acoustics. The normal modes of a vibrating drum on a domain satisfy . The simplest modes are the harmonics — pure tones. The static equilibrium case corresponds to : zero pitch, zero oscillation, just the silent steady shape. Those silent shapes are the "harmonics" we still call by that name.
Gallery: Harmonic, or Not?
The visual signature of a harmonic function is striking once you learn to see it. Below, six functions are plotted on the left and their Laplacians on the right. A harmonic function has a Laplacian that is uniformly the middle color of the colormap — flat zero everywhere. A non-harmonic one has hot or cold regions in its Laplacian, marking the points where the local average disagrees with the function's value.
Two takeaways. First: the harmonic surfaces all have a characteristic look — they are smooth, gently undulating, and almost "flat-looking" in the middle. They lack the dome-shape of the bowl and the volcano-shape of the Gaussian. Second: the Laplacian of a non-harmonic function tells you, point by point, by how much the equation is violated. That residual is the central quantity in any numerical solver.
The Mean Value Property
We have asserted twice already that a harmonic function equals its local average. Now we state it precisely.
Mean Value Property
If is harmonic on an open set containing a closed disk , then:
The value at the centre equals both the average over the bounding circle and the average over the entire disk — for every centre and every radius for which the disk fits inside the harmonic domain.
Why is this true? Intuitively: harmonicity says the local average equals the value at the point in the limit of an infinitesimal ball. Integrating that infinitesimal statement out from radius to radius gives the finite-radius version. The clean proof uses the divergence theorem:
One-line proof sketch
Define . Differentiating under the integral and applying the divergence theorem gives . If , then , so is constant in . Taking by continuity shows the constant value is .
The converse is also true and almost as important: if is continuous and satisfies the mean value property on every small disk, then is harmonic. So you can use and "value = local average" interchangeably as the definition of harmonic — they are the same condition wearing different clothes.
Interactive: The Mean Value Property
Drag the yellow centre, change the radius. The plotted field is — harmonic everywhere. The numerical average around the circle is computed live and compared with the value at the centre. They agree to round-off for every choice you make.
Things to try
- Shrink the radius. The numerical match stays exact — radius is irrelevant for harmonic functions.
- Move the centre near (1, 0). The point value goes up, the circle average rises with it.
- Move along the line . Both values become zero — and stay zero — because on that line.
The Maximum Principle
The mean value property has an immediate, deeply useful consequence:
Maximum (and Minimum) Principle
A non-constant harmonic function on a bounded domain attains its maximum and minimum only on the boundary. There are no interior peaks or valleys.
Why? Suppose a harmonic function had a maximum at some interior point . Then for every nearby point . But the mean value property says equals the average of over a small circle around . The average can equal the maximum only if every value on the circle equals the maximum. By repeating the argument outward, would have to be constant on a connected open set — and by analytic continuation, everywhere. Contradiction.
Concrete consequence: if a metal plate's edges are all held between 0°C and 100°C, then no interior point is hotter than 100°C or colder than 0°C. Ever. The interior is squeezed by its boundary. This is the simplest non-trivial fact about Laplace's equation, and it underwrites almost everything else.
A direct corollary: uniqueness
If and are two harmonic functions satisfying the same boundary conditions, then is harmonic and zero on the boundary. By the maximum/minimum principle, the maximum and minimum of on the closed domain are both 0. So , meaning . The boundary uniquely determines the interior.
The Discrete Laplace Equation
To compute, we replace the continuum operator by its finite-difference cousin. On a uniform grid with spacing :
Setting this to zero and solving for :
This is the discrete mean value property — and the basis of every elementary numerical method for Laplace's equation. It says: in the discrete picture, every interior cell's value must equal the average of its four neighbours. Solving Laplace's equation on a grid means making this true at every interior cell simultaneously.
The simplest way to make it true is to iterate. Pick any guess. Compute, at every interior cell, the average of its four current neighbours. Replace the guess with the averages. Do it again. And again. This is the Jacobi iteration:
Each sweep replaces every cell by the average of its old neighbours. The boundary cells are held fixed. After enough sweeps, nothing changes anymore — and the discrete Laplace equation is satisfied everywhere.
Why does it converge?
The Jacobi update is a contractive averaging operator on the interior values. Each sweep reduces the maximum-norm error between the current iterate and the true solution by a factor like on an grid — so the error decays geometrically. The rate is slow (close to 1 for large ), which is why production solvers use multigrid or conjugate-gradient methods. But Jacobi is the one whose every step looks like the mean value property, so it is by far the most pedagogical.
Interactive: Solving Laplace on a Plate
Choose a boundary pattern. Hit play. Watch the interior fill in. Every frame is one or more Jacobi sweeps — each interior cell becomes the average of its four neighbours. The colormap tracks the temperature; the residual readout shows how close we are to the true steady state. Hit Jump to steady state to run thousands of sweeps in one click and see the final harmonic field.
What to look for
- With Hot top edge, the field decays smoothly from top to bottom — no overshoots, no oscillations, no bumps. A harmonic field is the world's most boring interpolant.
- With Two hot sides, the centre value approaches the average of the boundary: . The field bows outward toward the cold top and bottom.
- With Sinusoidal top, the height of the wave drops off exponentially as you move down. This is the separation-of-variables eigenfunction we will derive in Section 28.3.
- With Hot corners, the boundary has sharp jumps. The harmonic interior smooths every jump out — within a few cells, you cannot tell there was a discontinuity at all.
Worked Numerical Example
Let's solve the smallest non-trivial Laplace problem by hand, then watch Jacobi converge to the same answer. This is the kind of calculation you should be able to reproduce on paper.
The 4 × 4 plate problem — full hand calculation
Setup
A 4 × 4 grid with indices . Row is the top of the plate, row the bottom. Boundary values:
- Top row (): u = 100
- Bottom row (): u = 0
- Left column (): u = 0
- Right column (): u = 0
The four interior unknowns are .
Step 1 — write the discrete Laplace equation at each unknown
Step 2 — exploit symmetry
The boundary is symmetric under (left/right mirror), so the solution is too. That forces and . Two unknowns left.
Step 3 — substitute and solve
Using :
Plug the second into the first:
The exact answer
The top half of the interior is at 37.5°, the bottom half at 12.5°. The vertical decay is dramatic — 37.5 → 12.5 — because the cold left, right, and bottom boundaries pull the field down fast.
Sanity check — verify by plugging back
Equation at : and . ✓
Equation at : and . ✓
Step 4 — watch Jacobi converge to it
Starting from all zeros, the first four sweeps give:
| Sweep | a = b | c = d | max change |
|---|---|---|---|
| 0 (init) | 0.000 | 0.000 | — |
| 1 | 25.000 | 0.000 | 25.000 |
| 2 | 31.250 | 6.250 | 6.250 |
| 3 | 34.375 | 9.375 | 3.125 |
| 4 | 35.938 | 10.938 | 1.562 |
| 10 | 37.451 | 12.451 | 0.049 |
| 20 | 37.500 | 12.500 | 5e−5 |
| ∞ (true) | 37.5 | 12.5 | 0 |
Each sweep cuts the residual in half (roughly). After 20 sweeps the solution is correct to four decimal places. This is the entire algorithm — averaging, repeatedly — and it converges to the unique harmonic function with the prescribed boundary.
Python: Verifying a Function Is Harmonic
Two checks in one script. First we confirm that is harmonic by numerically computing . Then we verify the mean value property by averaging over a circle and comparing to the value at the centre. Read the explanations on the right — each annotation maps to exactly one line.
Expected output
u_xx(x0, y0) = +2.000000 u_yy(x0, y0) = -2.000000 Laplacian (u_xx+u_yy) = +0.000000 u(x0, y0) = +0.160000 average on circle r=0.7 = +0.160000 difference = 4.16e-15
The Laplacian is zero to round-off precision. The circle average equals the centre value to fourteen digits. Both fingerprints of a harmonic function are present.
PyTorch: Jacobi Relaxation on a Grid
Now we scale from a 4 × 4 hand calculation to a 51 × 51 grid. The whole Jacobi sweep becomes a single tensor expression — slice the array four ways, average. PyTorch handles 2401 simultaneous averages in one line and runs the same code on CPU or GPU.
Expected output
converged in 2316 sweeps max change in last sweep = 9.99e-06 u at the centre = 25.0000 u just below top edge = 75.7041 u just above bottom edge = 4.2959
Three numbers, three checks
The centre is exactly 25.0 — that is the average of the four boundary edges (100 + 0 + 0 + 0)/4, which the mean value property guarantees for the symmetric centre point.
The values just below the hot top edge and just above the cold bottom edge sum to almost exactly 80.0. That is not an accident: the harmonic field is anti-symmetric around the horizontal midline shifted by 50. The sum of mirror-image values is constant across the field.
Jacobi took 2316 sweeps. A multigrid solver would have hit the same tolerance in roughly sweeps. The slow convergence of Jacobi is the most famous "teach first, replace later" algorithm in numerical analysis.
Why the Boundary Determines Everything
We saw above (as a corollary of the maximum principle) that the boundary data uniquely determines a harmonic function. Let's unpack what this means at the level of intuition.
Specify any continuous function on the boundary of a nice domain (say a disk, a square, or any region without nasty corners). Then there is exactly one harmonic function in the interior that agrees with at the boundary. None of the values in the interior have to be specified — they are forced by the boundary data and the equation .
The boundary contains everything
The information needed to reconstruct the entire 2D field lives on a 1D curve. The interior is a deterministic readout of the boundary. This is the precise statement that the boundary causes the interior in a stationary problem.
Compare with the heat equation, where you also need an initial condition in addition to the boundary. The heat equation has time — and time needs an origin. Laplace's equation has no time, so it has no initial condition. The boundary alone fixes everything.
Connection to electrostatics
In electrostatics, the potential in a charge-free region satisfies . The potential on the surfaces of all conductors is the boundary data. Once you know the surface potentials, the field everywhere in between is fixed. That is why an electrostatics problem reduces to specifying conductor voltages — the rest is mathematics.
Common Pitfalls
- Forgetting the boundary condition. alone has infinitely many solutions (every linear function, every harmonic polynomial). The equation is well-posed only together with boundary data. A Laplace problem without boundary conditions is not a problem yet.
- Confusing with . is a vector — the gradient. is a scalar — the divergence of the gradient. The Laplacian eats a scalar field and returns a scalar field; the gradient eats a scalar field and returns a vector field.
- Updating in place with the wrong loop order. The Jacobi method requires reading ONLY old neighbours, so it needs a buffer. If you write into the same array you read from, you are doing Gauss-Seidel — a different algorithm, also convergent, but with different convergence rates and different error patterns. Both are valid, but they are not the same method.
- Believing the discrete and continuum Laplace equations are identical. The discrete equation is an approximation of . The discrete solution on an grid differs from the true continuum solution by at every point. To halve the error you must double the grid resolution — and that quadruples the storage and roughly quadruples the per-sweep cost.
- Treating the iteration count as physical time. A Jacobi sweep is not a time step. There is no time in Laplace's equation. The relaxation is purely algorithmic — its only purpose is to drive an inconsistent guess toward a consistent steady state. You can choose different relaxation methods (Jacobi, Gauss-Seidel, SOR, multigrid) without changing the equation being solved.
Summary
Laplace's equation is the equation of equilibrium — the steady-state limit of the heat equation, the wave equation, every diffusive or oscillatory process whose right side is the Laplacian. Its solutions are the harmonic functions.
The five facts to remember:
- Defining equation: on the interior, plus prescribed values on the boundary.
- Mean value property: a harmonic function equals its average over every circle around every interior point. Equivalent to the equation itself.
- Maximum principle: no interior peaks or valleys — extrema live on the boundary.
- Uniqueness: the boundary data alone fixes the entire interior field. No initial condition, no time.
- Discrete picture: on a grid, the equation becomes "every interior cell is the average of its four neighbours," and Jacobi iteration solves it by repeated averaging.
In the next section we will turn this discussion into a complete framework for boundary value problems: the kinds of boundary conditions you can pose (Dirichlet, Neumann, Robin), what each means physically, and when each yields a unique solution.