Numerics of PDE

Modeling with PDE produced a governing equation — the heat equation and its stationary form, the Laplace equation — but stopped short of solving it. For all but the simplest one-dimensional configurations there is no formula for the solution, so the temperature field has to be computed numerically. This page is about how that is done.

The first thing to settle is that the kind of PDE matters enormously. Whether an equation is elliptic, parabolic, or hyperbolic is not a cosmetic label: the three classes behave so differently that each demands its own numerical machinery, and a method built for one can fail outright on another. To keep the focus on the methods rather than on case analysis, we restrict throughout to the elliptic case, and more specifically to the simplest elliptic equation of all — the Laplace equation

Δu=0.\Delta u = 0.

Three Families of Discretization

Every numerical method for a PDE shares one opening move: replace the continuous problem, which asks for the solution at every one of infinitely many points, with a finite problem that asks for it at finitely many. What separates the major methods is how they perform that replacement, and three families dominate.

  • The finite difference method (FD) approximates every derivative in the equation directly by a difference quotient. It is the most obvious approach, easy to implement, and needs little theoretical background — which is exactly why it is the one we build in full below.
  • The finite volume method (FV) implements the continuum-mechanical conservation laws directly for a small control volume around each point, rather than approximating derivatives. It is the natural choice for flow problems, where conservation of mass and momentum is the physical heart of the model.
  • The finite element method (FE) takes a variational route: instead of the PDE itself it enforces a slightly weakened version of it, expressed through integrals. It is more involved to implement, but it comes with a rich and powerful theory, and it is taken up in detail later on this page.

The Finite Difference Method

The finite difference method solves a PDE on a domain ΩRd\Omega \subset \mathbb{R}^d, d{1,2,3}d \in \{1, 2, 3\}, by laying a regular grid Ωh\Omega_h over it and replacing every derivative in the equation with a difference quotient. The continuous equation, valid at every point, becomes one algebraic relation per grid point among the values at that point and its neighbors.

The grid is described by its mesh width (or grid width) h=(hx,hy,hz)h = (h_x, h_y, h_z) — the spacing between neighboring points along each axis. A common simplification, used throughout the examples below, is an equidistant grid where the spacing is the same in every direction, h=hx=hy=hzh = h_x = h_y = h_z.

The derivatives are replaced one by one with the difference quotients already developed for ODEs.

A first derivative has three standard one-step approximations, differing only in which neighbors they reach for: the forward difference quotient reaches ahead of the point, its backward mirror image reaches behind it, and the symmetric central difference straddles the point. Any one of the three can stand in for the derivative — they are alternatives, not a sequence applied together:

u(x)    u(x+h)u(x)hforward,u(x)u(xh)hbackward,u(x+h)u(xh)2hcentral.u'(x) \;\approx\; \underbrace{\frac{u(x+h) - u(x)}{h}}_{\text{forward}}, \quad \underbrace{\frac{u(x) - u(x-h)}{h}}_{\text{backward}}, \quad \underbrace{\frac{u(x+h) - u(x-h)}{2h}}_{\text{central}}.

A second derivative uses the second difference quotient, the standard three-point formula built from the point and one neighbor on each side:

u(x)u(x+h)2u(x)+u(xh)h2.u''(x) \approx \frac{u(x+h) - 2\,u(x) + u(x-h)}{h^2}.
Where the three-point formula comes from

A second derivative is the derivative of the first derivative, so the plan is to apply a difference quotient twice: first estimate the slope at two nearby places, then measure how fast that slope itself changes.

The subtle point is where each first-difference estimate actually lives. The forward quotient u(x+h)u(x)h\frac{u(x+h) - u(x)}{h} is the slope of the straight chord joining (x,u(x))(x, u(x)) and (x+h,u(x+h))(x+h, u(x+h)), i.e. the average slope over the interval [x,x+h][x, x+h]. A chord’s slope best matches the true derivative not at either endpoint but at the midpoint of the interval, so this estimate is naturally pinned to x+h2x + \tfrac{h}{2}. The backward quotient is the same kind of chord over [xh,x][x-h, x], pinned to that interval’s midpoint xh2x - \tfrac{h}{2}:

u ⁣(x+h2)u(x+h)u(x)h,u ⁣(xh2)u(x)u(xh)h.u'\!\left(x + \tfrac{h}{2}\right) \approx \frac{u(x+h) - u(x)}{h}, \qquad u'\!\left(x - \tfrac{h}{2}\right) \approx \frac{u(x) - u(x-h)}{h}.

That is what the h2\tfrac{h}{2} records: two slope estimates sitting symmetrically on either side of xx, exactly a step hh apart. The second derivative is the rate of change of the slope, so take a central difference of these two slopes over the gap hh between them:

u(x)u ⁣(x+h2)u ⁣(xh2)h.u''(x) \approx \frac{u'\!\left(x + \tfrac{h}{2}\right) - u'\!\left(x - \tfrac{h}{2}\right)}{h}.

Substituting the two quotients back in collapses everything onto the three points xhx-h, xx, and x+hx+h:

u(x)1h(u(x+h)u(x)hu(x)u(xh)h)=u(x+h)2u(x)+u(xh)h2.u''(x) \approx \frac{1}{h}\left( \frac{u(x+h) - u(x)}{h} - \frac{u(x) - u(x-h)}{h} \right) = \frac{u(x+h) - 2\,u(x) + u(x-h)}{h^2}.

Because the two inner slopes straddle xx evenly, the whole construction stays centered on xx, which is why both neighbors u(x±h)u(x \pm h) enter with equal weight and the result measures how the slope just after xx differs from the slope just before it.

The Laplace operator Δu=uxx+uyy(+uzz)\Delta u = u_{xx} + u_{yy} (+ u_{zz}), being a sum of pure second derivatives, is approximated by combining several second difference quotients into a single formula spanning the point and its immediate neighbors.

What a stencil is

The combinations above all have the same shape: a value at a grid point is replaced by a fixed, weighted combination of the values at a small fixed pattern of nearby points. That pattern, weights and all, has a name.

A stencil (also called a difference stencil or computational molecule) is the fixed pattern of neighboring grid points that a difference approximation combines, together with the weight it attaches to each. Applying the approximation at a grid point means stamping the stencil down centered on that point and reading off the weighted sum of the values it covers.

The picture behind the word is a literal one: a stencil is a small template you lay over the grid, centered on the point you are currently working on, that tells you which surrounding values to take and in what proportion. Move to the next point, lay the same template down again — the pattern never changes, only where it sits.

The simplest example is the second difference quotient written above, whose stencil is the three-point stencil: the point itself and its two immediate neighbors, with weights 1,2,11, -2, 1 (all divided by h2h^2). In two dimensions the Laplacian adds the same three-point pattern in the yy-direction on top of the one in xx. The two share the center point, so together they cover five points — the center and its four nearest neighbors:

Δu(x,y)u(xh,y)+u(x+h,y)+u(x,yh)+u(x,y+h)4u(x,y)h2.\Delta u(x, y) \approx \frac{u(x-h, y) + u(x+h, y) + u(x, y-h) + u(x, y+h) - 4\,u(x, y)}{h^2}.

This is the five-point stencil, the workhorse of the method in 2D: weight 4-4 on the center, +1+1 on each of the four neighbors. In three dimensions a third three-point pattern in zz joins in, giving the seven-point stencil — the center plus six neighbors, with weight 6-6 on the center. Richer stencils with more neighbors exist too, and they buy higher accuracy at a cost we return to at the end.

Setting up the equations

With the stencil chosen, the method writes one difference equation at each interior grid point: stamp the stencil down there and set the resulting weighted sum equal to the right-hand side of the PDE at that point. The right-hand side is whatever the differential operator is set equal to — the known data of the equation, with the unknown uu all on the left. For Δu=0\Delta u = 0 it is simply zero; for an equation with a source term it is that prescribed function, evaluated at the grid point. The unknowns are the discrete values themselves.

A degree of freedom (DOF) is a single unknown the discretization must solve for: the discrete, approximate value of the solution at one grid point. There is one degree of freedom per grid point per scalar unknown of the PDE.

Points on or near the boundary are handled by what the boundary condition prescribes there, and the two kinds split cleanly — mirroring how a boundary value problem for an ODE handles its endpoints:

  • At a Dirichlet boundary the value is already given, so there is nothing to solve for: no difference equation is written and the point is not a degree of freedom.
  • At a Neumann boundary the value is unknown but its normal derivative is prescribed, so the point keeps a difference equation — one of a special form that folds the boundary condition into the stencil.

Collecting one equation per interior degree of freedom turns the discretized PDE into a system of linear equations. Because each stencil reaches only a handful of neighbors, almost every entry of the system’s matrix is zero — the matrix is sparse (only a small, fixed number of nonzeros per row, regardless of how large the grid grows). Sparsity is what makes large grids tractable at all, and it is why fast iterative solution methods, rather than direct elimination, are essential — a theme that occupies much of the rest of this page.

Example: the Poisson equation on the unit square

The cleanest concrete case adds a source term to the Laplace equation.

The Poisson equation is the Laplace equation with a prescribed source term ff on the right:

Δu=f.-\Delta u = f.

With f=0f = 0 it collapses back to the Laplace equation; it is the elliptic equation that governs a steady field driven by sources.

Take it on the open unit square ]0,1[2\,]0, 1[^{\,2} (the outward-turned brackets mark an open interval — the same thing as (0,1)(0, 1), the endpoints 00 and 11 excluded; so ]0,1[2]0, 1[^{\,2} is the square’s interior without its edges) with an equidistant square grid of width h=hx=hy=1/Nh = h_x = h_y = 1/N. That leaves N1N - 1 interior points along each axis, so the number of degrees of freedom is

M=(N1)2.M = (N - 1)^2.

Applying the five-point stencil at every interior point produces a linear system Ax=bA x = b. The construction is mechanical: each interior point contributes exactly one equation — its stencil, which ties the value there to its four neighbors — and that equation becomes one row of the system. Stacking all MM of them gives three objects:

  • xx is the vector of unknowns: the MM discrete grid values themselves, the interior points collected into a single column in whatever order they are numbered.
  • AA is the M×MM \times M coefficient matrix: row ii holds the stencil weights for point ii — the coefficient on its own value on the diagonal, and the coefficients on its neighbors in the columns those neighbors occupy in the numbering. Every other entry in the row is zero, so multiplying row ii by xx reproduces exactly the difference equation at point ii.
  • bb is the right-hand side: the known data, one entry per point. It carries the source term ff sampled at that point (so this part vanishes wherever ff does, and is entirely zero for pure Laplace Δu=0\Delta u = 0), plus any known boundary values the stencil reaches, which are not unknowns and so move out of AA and over to the right.

The matrix AA is sparse — only a handful of nonzeros per row, no matter how large the grid grows — and, because the grid points are numbered row by row, has a regular band structure: its nonzeros sit on a few diagonals rather than scattered anywhere.

It is customary to multiply every equation through by h2h^2 to clear the denominators, leaving clean integer coefficients. The exact shape of the resulting rows depends on which boundary condition the problem carries:

  • Pure Dirichlet. Each interior row has a 44 on the diagonal and a 1-1 for each neighbor that is itself an interior unknown — between two and four such entries, fewer for rows whose stencil reaches a boundary point. The known boundary values that the stencil touches are moved to the right-hand side.
  • Pure Neumann. Boundary points are now unknowns too, so they get their own rows; near the boundary the diagonal drops to 22 or 33 (a boundary point has fewer neighbors), while interior rows keep the 44. The discretized flux condition contributes paired (1,1)(1, -1) entries along the boundary, with the prescribed fluxes carried to the right-hand side.

Discretization of a Dirichlet boundary

To see where the matrix rows come from, write the five-point stencil for Δu=f-\Delta u = f explicitly as the sum of the two three-point second differences, in xx and in yy:

u(xh,y)+2u(x,y)u(x+h,y)h2+u(x,yh)+2u(x,y)u(x,y+h)h2=f(x,y).\frac{-u(x-h, y) + 2\,u(x, y) - u(x+h, y)}{h^2} + \frac{-u(x, y-h) + 2\,u(x, y) - u(x, y+h)}{h^2} = f(x, y).

Multiplying by h2h^2 and reading off the coefficients gives a matrix row of the form ( 1  1  4  1  1 )(\,\dots\ {-1}\ \dots\ {-1}\ \dots\ 4\ \dots\ {-1}\ \dots\ {-1}\ \dots\,): a 44 on the diagonal and four 1-1‘s placed where the four neighbors sit in the global numbering. Where one of those neighbors lies on a Dirichlet boundary, its value ψ\psi is known; that term is not an unknown, so it is brought over to the right-hand side. Boundary-adjacent rows therefore carry fewer off-diagonal entries and a right-hand side enriched by the known boundary values.

That sorts the M=(N1)2M = (N-1)^2 rows into three kinds. The great majority are deep-interior points, all four of whose neighbors are unknowns as well, and their rows keep the full complement of four 1-1‘s. Points sitting one step in from an edge have exactly one neighbor on the boundary, so their rows keep three; there are on the order of 4N4N of these, one band running along each side of the square. The four points tucked into the corners have two boundary neighbors apiece and so keep only two. The diagonal stays at 44 in every row, because it comes from the stencil’s center weight, which no boundary condition touches.

Discretization of a Neumann boundary

A Neumann boundary is different in kind: the value there is not given, so the boundary point stays an unknown, but the normal derivative — the heat flow across the boundary — is prescribed. On the upper edge, for instance, that flux is a known one-sided difference,

u(x,y+h)u(x,y)h=φ(x,y),\frac{u(x, y+h) - u(x, y)}{h} = \varphi(x, y),

and this relation is folded into the difference equation at the boundary point rather than replacing it. The consequence for the matrix is again a change of row shape near the edge: because a boundary point simply has fewer neighbors than an interior one, its rows carry a 33 on the diagonal along an edge and a 22 at a corner, instead of the interior 44. The prescribed flux values are gathered, as always, on the right-hand side.

Accuracy and the curse of dimensionality

The standard five-point scheme is second-order accurate: the error between the computed and the exact solution shrinks quadratically with the mesh width,

ucalcuexact=O(h2)=O(N2).\bigl\lVert u^{\text{calc}} - u^{\text{exact}} \bigr\rVert = O(h^2) = O(N^{-2}).

Halving the grid spacing therefore cuts the error to a quarter — a good return on refinement. But refinement is not free, and in more than one dimension its cost grows alarmingly.

The curse of dimensionality is the explosion in cost that comes from resolving each axis of a dd-dimensional domain independently: a grid with NN points per axis has O(Nd)O(N^d) points in total. Each added dimension multiplies the work by a full factor of NN, so a resolution that is cheap in 1D can be hopeless in 3D.

There are two standard ways to push back against this cost, each with its own catch:

  • Higher-order stencils. Using more neighbors per stencil raises the order of accuracy — cubic, quartic, and beyond — so a coarser grid reaches the same accuracy. The price is that the matrix becomes denser: each row now couples to more points, eroding the sparsity that made the system cheap to solve.
  • Locally refined (adaptive) grids. Rather than refining everywhere, place grid points densely only where the solution varies sharply and sparsely where it is smooth, economizing points overall. The difficulty is at the joints between coarse and fine regions: a fine-grid point may have no matching coarse-grid neighbor to reference, and deciding which value to use there takes extra care.

The Finite Element Method

The finite difference method attacks the derivatives head-on: every derivative in the equation is swapped for a difference quotient. The finite element method (FE) takes a route that looks, at first, nothing like that — it never approximates a derivative directly. Yet it arrives at the very same destination: a system of linear equations whose matrix is sparse, handed off to exactly the same solvers. The method is deep enough to fill courses of its own; what follows is only the rough idea, with attention to the mechanics that carry over to the finite difference systems we already built.

The finite element method solves a PDE not by approximating its derivatives but by decomposing the domain Ω\Omega into small patches of a fixed shape — the finite elements — and replacing the equation with a weakened version of itself, stated through integrals rather than at individual points. The continuous solution is then approximated within a finite-dimensional space of functions built on that decomposition, which again turns the problem into a system of linear equations.

The whole method unfolds in five essential steps, each of which the rest of this section takes in turn:

  • Substructuring and grid generation — decompose the domain into individual patches of a given pattern and of finite extent, the finite elements.
  • Weak form — stop requiring the PDE to hold pointwise everywhere, and ask only that it hold in a weakened (inner-product) or averaged (integral) sense.
  • Finite-dimensional ansatz space — replace the continuous solution in the weak form by a suitable finite-dimensional approximation.
  • System of linear equations — use test functions to generate one equation per degree of freedom, and collect them into the associated linear system.
  • Solution of the linear system — hand that system to a suitable iteration method, the subject of the remainder of this page.

Substructuring and grid generation

The decomposition step borrows its instinct straight from engineering statics: a complicated structure is understood by breaking it into standard components whose behavior is easy to describe, and then reassembling the behavior of the whole from the behavior of the parts. The finite element method does the same to a domain, cutting it into many small finite elements.

In three dimensions the result is a finite element net — a data structure with a tidy hierarchy of pieces:

  • elements — the 3D atoms of the decomposition (cubes, tetrahedra, and the like),
  • surfaces — their 2D faces (triangles, squares),
  • edges — the 1D boundary structures of an element,
  • grid points (or nodes) — the points where the unknowns live.

The choice of element shape is a trade-off: cubes are the simplest to work with, while triangles and tetrahedra are more accurate and bend far more readily around awkward geometry.

Each node of the finite element net carries a trial function φk\varphi_k with finite support — it is non-zero only on the elements immediately neighboring its node, and zero everywhere else. Together all the trial functions span a linear, finite-dimensional trial space VnV_n and form a basis of it; the approximate solution of the PDE is sought within VnV_n. The simplest basis in 1D is the piecewise-linear nodal point basis, whose trial functions are the “hat” functions peaking at one node and sloping down to zero at the next on each side.

This is the sharpest contrast with finite differences. There the discretization was purely local: each grid point carried a difference formula relating it to its neighbors, and nothing tied those local relations into a single function over the whole domain. Here the trial functions assemble into one global function un=kαkφku_n = \sum_k \alpha_k \varphi_k defined at every point of Ω\Omega — partitioned into local contributions, but a genuine function on the whole domain in the end.

The weak form

Let LL be the differential operator of the problem — for the Laplace equation, L=ΔL = \Delta (the Laplace operator). The finite element method does not ask for Lu=fLu = f to hold at every point of Ω\Omega. Instead it picks a finite set of test functions ψl\psi_l, multiplies the equation through by each one, integrates over the whole domain, and asks only that

ΩLuψldΩ=ΩfψldΩψl.\int_\Omega Lu \cdot \psi_l \, d\Omega = \int_\Omega f \cdot \psi_l \, d\Omega \quad \forall \psi_l.

This is the weak form of the PDE, and the strategy is called the method of weighted residuals or the Galerkin approach.

What “weakening” really does

Checking whether two functions are equal pointwise is an enormously strict demand — it asks for agreement at infinitely many points at once. The weak form replaces that with something looser but far easier to test. Think of comparing two people to decide whether they are really the same person: rather than inspecting every detail directly, you pair each of them with the same handful of companions, watch how each pairing plays out over a long stretch of time, and tally up the results. If every paired-up reading comes out identical for both, you are willing to call them the same.

The test functions ψl\psi_l are those companions. Multiplying by ψl\psi_l and integrating over Ω\Omega turns the question “is LuLu equal to ff here, and here, and here?” into “do LuLu and ff produce the same total reading when probed against ψl\psi_l?” Demanding agreement for every test function in the set recovers a faithful — but much more tractable — stand-in for genuine pointwise equality. That is all “satisfying the PDE only weakly” means.

The test functions span their own linear space, the test space WnW_n. Whether it coincides with the trial space matters enough to have a name:

  • when test and trial space are the same, Wn=VnW_n = V_n, the method is the Ritz-Galerkin approach (the common case),
  • when they differ, it is the Petrov-Galerkin approach.

Because LL is a linear operator, only the basis functions actually have to fulfill the weak form — agreement on a basis extends to every function built from it by linearity. It is customary to package the two sides of the weak form into a bilinear form a(,)a(\cdot, \cdot) (the left-hand side, linear in each of its two arguments) and a linear form b()b(\cdot) (the right-hand side), so the whole condition reads

a(u,ψl)=b(ψl)ψlWn.a(u, \psi_l) = b(\psi_l) \quad \forall \psi_l \in W_n.

These are nn linear equations, one per test function, where nn is the dimension of the test space.

Discrete approximation and the stiffness matrix

The weak form is nn equations, but uu is still a continuous function — infinitely many unknowns. The final move makes the unknowns finite too: replace the exact solution uu by a discrete approximation drawn from the trial space VnV_n, written as a linear combination of the trial functions with nn unknown coefficients αk\alpha_k:

un=kαkφkVn.u_n = \sum_k \alpha_k \varphi_k \in V_n.

Substituting unu_n for uu in the weak form and pulling the linear operator through the sum collapses everything onto the basis:

a(un,ψl)=a ⁣(kαkφk,ψl)=kαka(φk,ψl)=b(ψl)ψlWn.\begin{aligned} a(u_n, \psi_l) &= a\!\left( \sum_k \alpha_k \varphi_k, \, \psi_l \right) \\ &= \sum_k \alpha_k \, a(\varphi_k, \psi_l) = b(\psi_l) \quad \forall \psi_l \in W_n. \end{aligned}

Read left to right: the bilinear form evaluated at the approximation unu_n equals the same form applied to its expansion kαkφk\sum_k \alpha_k \varphi_k; linearity in the first argument lets each coefficient αk\alpha_k come out front, leaving a weighted sum of the numbers a(φk,ψl)a(\varphi_k, \psi_l); and that sum must equal b(ψl)b(\psi_l) for every test function ψl\psi_l in WnW_n. The doubly-indexed quantities a(φk,ψl)a(\varphi_k, \psi_l) assemble into a matrix, the singly-indexed b(ψl)b(\psi_l) into a vector, and the unknowns are the coefficients αk\alpha_k.

The crucial observation is that every a(φk,ψl)a(\varphi_k, \psi_l) and every b(ψl)b(\psi_l) depends only on the problem — the operator, the right-hand side, and the chosen basis functions — and not on the approximation of uu we are trying to find. They can therefore be computed once and for all, at the very beginning, producing a system of nn linear equations in the nn unknowns.

Discretizing the weak form yields a linear system Ax=bA x = b in the nn unknown coefficients αk\alpha_k, whose coefficient matrix AA — with entries al,k=a(φk,ψl)a_{l,k} = a(\varphi_k, \psi_l) — is called the stiffness matrix. As with the finite difference method, solving the PDE comes down to solving this linear system.

Solving the resulting system

The finite element route lands on a linear system just as the finite difference route did, and the two systems share the properties that govern how they are solved:

  • With the Ritz-Galerkin approach (Vn=WnV_n = W_n), the stiffness matrix AA is often symmetric and positive definite (SPD) — the friendliest case for the iterative solvers below.

  • The ideal constellation would be a diagonal AA, which happens exactly when the trial and test functions are bi-orthogonal, so that

    ai,j=a(φi,φj)=ΩLφiφjdΩ=δi,j.a_{i,j} = a(\varphi_i, \varphi_j) = \int_\Omega L\varphi_i \cdot \varphi_j \, d\Omega = \delta_{i,j}.

    A diagonal system is trivial to solve, but such bases are rare and, where they exist at all, hardly accessible.

  • The realistic guarantee is weaker but still decisive: because the trial and test functions have only local support, most pairs (φk,ψl)(\varphi_k, \psi_l) never overlap, their integral vanishes, and AA comes out sparse — exactly as the five-point stencil produced a sparse matrix. With many unknowns and a sparse matrix, iterative solvers are again essential.

The strategy that follows from this is to choose trial and test spaces with good approximation properties, and then to construct bases for them that yield “nice” matrices — sparse, well-conditioned, fast to solve. The plain sample-point bases used here (one fixed basis function per grid point) are far from optimal; hierarchical bases, which resolve the solution at several scales at once, do considerably better, though their study belongs to a course of its own.

Solving the Linear System: Iterative Methods

Both routes — finite differences and finite elements — end at the same place: a large, sparse linear system Ax=bA x = b. From here on it no longer matters where the matrix came from. The finite difference matrix is always sparse and the finite element matrix typically is too, and we simply have such a matrix in hand and want to solve it. This is one of the central problems of numerical simulation, and it shows up not only here but in the discretization of boundary value problems for ODEs as well.

The obvious idea — solve Ax=bA x = b exactly by a direct method like Gaussian elimination — turns out to be the wrong reflex for these systems, for three reasons:

  • The number of unknowns is simply too large, especially for a PDE in 3D.
  • Classical elimination fills in the matrix: the sparse structure that made the system cheap to store and apply is destroyed as elimination proceeds, and a dense system of this size is hopeless.
  • Solving exactly is overkill when everything around it is already an approximation. The grid values only approximate the true solution to begin with — and in nonlinear problems a fresh linear system arises at every step of an outer iteration, so there is no point in pinning each one down to ten digits.

The alternative is an iterative method: start from a guess and improve it step by step, coming arbitrarily close to the solution without ever landing on it exactly. The aim is performance of the form “for 3 digits, one needs 10 steps” — and, crucially, a step count that stays fixed independently of the number of unknowns. The frustration that drives the rest of this page is that the classical iterative methods fall short of that aim: their speed of convergence degrades as the problem grows.

Basics of iterative methods

An iterative method begins at some starting vector x(0)Rnx^{(0)} \in \mathbb{R}^n and produces a sequence of ever-better approximations that, in the limit, reach the exact solution xx of Ax=bA x = b:

x(0)x(1)x(i+1)limix(i)=x.x^{(0)} \to x^{(1)} \to \dots \to x^{(i+1)} \to \dots \to \lim_{i \to \infty} x^{(i)} = x.

The idea is that the starting point should not matter — from anywhere, the sequence homes in on xx — and of course we stop after finitely many steps rather than running to the limit. Throughout, a parenthesized superscript x(i)x^{(i)} counts the iteration step, while a plain subscript xkx_k picks out the kk-th component of a vector.

How fast the sequence converges is captured by comparing successive errors:

xx(i+1)<γxx(i)s,\bigl\| x - x^{(i+1)} \bigr\| < \gamma \cdot \bigl\| x - x^{(i)} \bigr\|^{s},

for some 0<γ<10 < \gamma < 1 and a convergence order ss. Larger ss is dramatically better: s=1s = 1 is linear convergence, s=2s = 2 quadratic, s=3s = 3 cubic, and so on (the opposite sense to computational complexity, where a higher order is worse). The trouble is that a simple iteration for a linear system typically manages only

s=1,γ=O(1nk),k{0,1,2,},s = 1, \quad \gamma = O(1 - n^{-k}), \quad k \in \{0, 1, 2, \dots\},

where nn is the number of grid points. With linear convergence and a contraction factor γ\gamma this close to 11, each step shaves off only a sliver of the error, and reaching a useful accuracy takes a great many steps.

This sets the strategy precisely. We want a method that costs only O(n)O(n) arithmetic operations per step — obviously at least that much is needed, since each step must at minimum touch every unknown — while delivering a contraction factor bounded away from 11, γ<1const\gamma < 1 - \text{const}, with the constant independent of the grid. The two big families that chase this goal are the relaxation methods and the Krylov-subspace methods.

Relaxation methods

A relaxation method (the members are sometimes called smoothers) is an iterative solver for Ax=bA x = b that repeatedly sweeps over the components of the current approximation, correcting each one using the residual of the equation. The classical members are the Richardson, Jacobi, Gauß-Seidel, and successive over-relaxation (SOR) iterations.

To design such a method, the natural thing to attack is the error of the current approximation — but the error is precisely what we do not know. The way out is to work with a closely related quantity that we can compute, the residual, and use it as a stand-in.

For an approximation x(i)x^{(i)} to the solution xx of Ax=bA x = b, the error is the (unknown) difference e(i)=x(i)xe^{(i)} = x^{(i)} - x, the cause of our trouble. The residual is the (computable) amount by which the equation fails to hold, the effect:

r(i)=bAx(i)=AxAx(i)=A(x(i)x)=Ae(i).r^{(i)} = b - A x^{(i)} = A x - A x^{(i)} = -A(x^{(i)} - x) = -A\,e^{(i)}.

Error and residual are thus linked by the matrix itself, r(i)=Ae(i)r^{(i)} = -A\,e^{(i)}. In the absence of any better alternative, the residual serves as our error indicator.

The chain above is worth reading slowly: the residual bAx(i)b - A x^{(i)} measures how far the right-hand side is from being reproduced; substituting b=Axb = A x (since xx is the exact solution) turns it into AxAx(i)=Ae(i)A x - A x^{(i)} = -A\,e^{(i)}, tying it directly to the unknown error through AA. A small residual does not, in general, guarantee a small error — if AA has very large or very small entries the two can differ in size by a lot. But there is a reliable directional link between them: driving the residual down drives the error down too, roughly proportionally, so halving the residual roughly halves the error. That is enough to build a method on.

Each classical relaxation method is just a different answer to the question how do we exploit the residual to improve the approximation?

  • Richardson uses the residual directly as the correction.
  • Jacobi and Gauß-Seidel scale the correction so as to zero out one component of the residual at a time.
  • SOR and damped methods take the same correction but deliberately overshoot or undershoot it.

The classical relaxation iterations

Richardson iteration

The simplest method takes the residual at face value and adds it straight onto the current approximation, component by component:

for i=0,1,for k=1,,n:xk(i+1):=xk(i)+rk(i).\begin{aligned} &\text{for } i = 0, 1, \dots \\ &\quad \text{for } k = 1, \dots, n: \quad x_k^{(i+1)} := x_k^{(i)} + r_k^{(i)}. \end{aligned}

The two loops read just as their indices suggest: the outer loop counts the iteration step i=0,1,i = 0, 1, \dots, producing the sequence x(0),x(1),x^{(0)}, x^{(1)}, \dots, while the inner loop runs kk over the nn components 1,,n1, \dots, n of the vector, updating each one in turn. This same ii-over-steps, kk-over-components structure carries through all the methods below. This particular update is exactly the “residual as corrector” idea: since r(i)=Ae(i)r^{(i)} = -A\,e^{(i)} points opposite to the error, adding it nudges x(i)x^{(i)} back toward xx.

Jacobi iteration

The Jacobi iteration refines this with a normalization. Adding the raw residual is crude because the entries of AA set the scale: where the diagonal entry akka_{kk} is large the step is too big, where it is small the step is too timid. Dividing the kk-th residual component by akka_{kk} corrects for this:

for i=0,1,for k=1,,n:yk:=1akkrk(i)for k=1,,n:xk(i+1):=xk(i)+yk.\begin{aligned} &\text{for } i = 0, 1, \dots \\ &\quad \text{for } k = 1, \dots, n: \quad y_k := \tfrac{1}{a_{kk}} \, r_k^{(i)} \\ &\quad \text{for } k = 1, \dots, n: \quad x_k^{(i+1)} := x_k^{(i)} + y_k. \end{aligned}

Using only the diagonal entry to rescale the kk-th correction may look arbitrary, but it is well justified for the matrices we get here: they are heavily diagonally dominant (recall the five-point stencil — a 44 on the diagonal against four 1-1‘s and a sea of zeros), so the diagonal already captures the bulk of each row, and akka_{kk} is the entry most responsible for component kk.

Two details of the algorithm matter. First, the corrections yky_k are computed and stored in a first kk-loop and only applied in a second kk-loop, not immediately. The reason is subtle: if we applied yky_k the instant we computed it, the kk-th component of the residual would momentarily drop to zero — equation kk would be solved exactly — but that gain would be undone in the very next substep k+1k+1, because changing one component of xx changes the residual of the others (the residual was defined as r(i)=bAx(i)r^{(i)} = b - A x^{(i)}, so it depends on the whole vector). Holding all corrections until the end of the step sidesteps the interference. Second, within each loop the components k=1,,nk = 1, \dots, n do not depend on one another, so Jacobi is embarrassingly parallel — every component can be updated at once.

Gauß-Seidel iteration

The Gauß-Seidel iteration makes exactly the opposite choice: apply each correction immediately, so that when component kk is updated, the already-improved values of components 1,,k11, \dots, k-1 are used in its residual. Writing the residual out with the updated entries spelled in gives

for i=0,1,for k=1,,n:rk(i):=bkj=1k1akjxj(i+1)j=knakjxj(i)yk:=1akkrk(i),xk(i+1):=xk(i)+yk.\begin{aligned} &\text{for } i = 0, 1, \dots \\ &\quad \text{for } k = 1, \dots, n: \\ &\qquad r_k^{(i)} := b_k - \sum_{j=1}^{k-1} a_{kj}\, x_j^{(i+1)} - \sum_{j=k}^{n} a_{kj}\, x_j^{(i)} \\ &\qquad y_k := \tfrac{1}{a_{kk}} \, r_k^{(i)}, \quad x_k^{(i+1)} := x_k^{(i)} + y_k. \end{aligned}

The two sums are the heart of it: the first runs over the components j=1,,k1j = 1, \dots, k-1 already updated this step (so it uses xj(i+1)x_j^{(i+1)}), the second over the components j=k,,nj = k, \dots, n not yet reached (still xj(i)x_j^{(i)}). The corrections are the same ones Jacobi computes; only the timing differs. This usually converges somewhat faster, but the immediate updates create a dependence between components and so cost the easy parallelism Jacobi enjoyed.

Damping and over-relaxation

Finally, the size of the correction can itself be tuned. Multiplying yky_k by a factor α\alpha before applying it,

xk(i+1):=xk(i)+αyk,x_k^{(i+1)} := x_k^{(i)} + \alpha \, y_k,

gives damping when 0<α<10 < \alpha < 1 (a deliberately cautious, too-small step) and over-relaxation when 1<α<21 < \alpha < 2 (a deliberately bold, too-large step). Either can improve convergence in any of the three methods above. Over-relaxation applied to Gauß-Seidel is so common that it has its own name, the successive over-relaxation (SOR) method; for Jacobi, damping is the usual choice.

Convergence analysis: the additive decomposition

The algorithmic descriptions above are how the methods are run, but they are awkward to analyze. For a convergence analysis it pays to recast all four methods in a single algebraic form. They all rest on one simple idea: split the matrix as

A=M+(AM),A = M + (A - M),

choosing MM to meet two competing demands: a system Mx=bM x = b should be very easy to solve, and MM should be as close to AA as possible (so that the leftover AMA - M stays small). The two pull against each other — M=IM = I makes Mx=bM x = b trivial but is a poor stand-in for AA, whereas M=AM = A is a perfect stand-in but leaves Mx=bM x = b exactly as hard as the original problem — and a good method strikes a balance between them.

The algebraic trick is to take the trivial identity Mx+(AM)x=bM x + (A - M) x = b (which just restates Ax=bA x = b) and split its two copies of the unknown across two successive iterates:

Mx(i+1)+(AM)x(i)=b.M x^{(i+1)} + (A - M) x^{(i)} = b.

This is what turns an identity into an algorithm: the new approximation x(i+1)x^{(i+1)} is computed from the old one x(i)x^{(i)}, and if the iteration ever settles down — x(i+1)=x(i)=xx^{(i+1)} = x^{(i)} = x — it reproduces the original identity exactly, so the resting point is the true solution. Solving for x(i+1)x^{(i+1)} shows the residual reappearing:

x(i+1):=M1bM1(AM)x(i)=M1b(M1AI)x(i)=x(i)+M1r(i).x^{(i+1)} := M^{-1} b - M^{-1}(A - M) x^{(i)} = M^{-1} b - (M^{-1} A - I) x^{(i)} = x^{(i)} + M^{-1} r^{(i)}.

Every relaxation method above is this one update with a particular choice of MM. To name those choices, decompose AA additively into its diagonal part DAD_A, its strictly lower-triangular part LAL_A, and its strictly upper-triangular part UAU_A (the “strictly” meaning the diagonal itself belongs to neither triangle):

A=:LA+DA+UA.A =: L_A + D_A + U_A.

The four methods then correspond to:

  • Richardson: M:=IM := I
  • Jacobi: M:=DAM := D_A
  • Gauß-Seidel: M:=DA+LAM := D_A + L_A
  • SOR: M:=1αDA+LAM := \tfrac{1}{\alpha} D_A + L_A

The first two are immediate from the algorithms: Richardson used the residual directly as the correction, which is the update above with prefactor M1=IM^{-1} = I; Jacobi divided the residual by the diagonal, which is prefactor M1=DA1M^{-1} = D_A^{-1}. The Gauß-Seidel and SOR choices take a short derivation.

Deriving the SOR decomposition

Since Gauß-Seidel is just the special case α=1\alpha = 1 of SOR, it is enough to verify the formula M:=1αDA+LAM := \tfrac{1}{\alpha} D_A + L_A for the general SOR method. Starting from the SOR algorithm and rewriting the component sums in terms of LAL_A, DAD_A, and UAU_A:

xk(i+1):=xk(i)+α(bkj=1k1akjxj(i+1)j=knakjxj(i))/akkx(i+1):=x(i)+αDA1(bLAx(i+1)(DA+UA)x(i))1αDAx(i+1)=1αDAx(i)+bLAx(i+1)(DA+UA)x(i)(1αDA+LA)x(i+1)+((11α)DA+UA)x(i)=bMx(i+1)+(AM)x(i)=b.\begin{aligned} x_k^{(i+1)} &:= x_k^{(i)} + \alpha \left( b_k - \sum_{j=1}^{k-1} a_{kj}\, x_j^{(i+1)} - \sum_{j=k}^{n} a_{kj}\, x_j^{(i)} \right) \Big/ a_{kk} \\ \Leftrightarrow \quad x^{(i+1)} &:= x^{(i)} + \alpha D_A^{-1} \left( b - L_A x^{(i+1)} - (D_A + U_A) x^{(i)} \right) \\ \Leftrightarrow \quad \tfrac{1}{\alpha} D_A\, x^{(i+1)} &= \tfrac{1}{\alpha} D_A\, x^{(i)} + b - L_A x^{(i+1)} - (D_A + U_A) x^{(i)} \\ \Leftrightarrow \quad \left( \tfrac{1}{\alpha} D_A + L_A \right) x^{(i+1)} &+ \left( \left(1 - \tfrac{1}{\alpha}\right) D_A + U_A \right) x^{(i)} = b \\ \Leftrightarrow \quad M x^{(i+1)} &+ (A - M) x^{(i)} = b. \end{aligned}

The last line is exactly the algebraic form, with M=1αDA+LAM = \tfrac{1}{\alpha} D_A + L_A and therefore AM=(11α)DA+UAA - M = \left(1 - \tfrac{1}{\alpha}\right) D_A + U_A, which proves the claim.

When the iteration converges: the spectral radius

Two consequences flow from the algebraic form Mx(i+1)+(AM)x(i)=bM x^{(i+1)} + (A - M) x^{(i)} = b. The first we have already used: if the sequence (x(i))\left( x^{(i)} \right) converges at all, its limit is the exact solution xx of Ax=bA x = b. The second is a sharp criterion for whether it converges, and it turns on a single matrix.

The iteration matrix of a relaxation method is M1(AM)-M^{-1}(A - M) — the matrix that maps the error of one step to the error of the next. Subtracting the fixed-point identity Mx+(AM)x=bM x + (A - M) x = b from the update gives the error recurrence

Me(i+1)+(AM)e(i)=0e(i+1)=M1(AM)e(i),M e^{(i+1)} + (A - M)\, e^{(i)} = 0 \quad \Leftrightarrow \quad e^{(i+1)} = -M^{-1}(A - M)\, e^{(i)},

so each step multiplies the error vector by this fixed matrix.

Whether repeated multiplication by the iteration matrix shrinks the error or lets it grow is governed by its eigenvalues — the eigenvalues and eigenvectors of M1(AM)-M^{-1}(A - M).

The spectral radius ρ\rho of a matrix is the largest absolute value among its eigenvalues. Assuming the iteration matrix M1(AM)-M^{-1}(A - M) is symmetric, the relaxation method converges from every starting vector exactly when its spectral radius is below 11:

(x(0)Rn:limix(i)=x=A1b)ρ<1.\left( \forall x^{(0)} \in \mathbb{R}^n : \lim_{i \to \infty} x^{(i)} = x = A^{-1} b \right) \quad \Leftrightarrow \quad \rho < 1.

The reasoning is direct from the error recurrence. Decomposed along the eigenvectors of the iteration matrix, each step scales every error component by the corresponding eigenvalue. If all eigenvalues are less than 11 in absolute value — equivalently ρ<1\rho < 1 — then every component shrinks each step and the error dies out. If ρ>1\rho > 1, at least one component is amplified and the iteration diverges. The whole aim of constructing a good iterative method is therefore to make the spectral radius as small as possible, ideally near zero.

Convergence results, and why they are not enough

A handful of classical results pin down when the methods converge for the matrices that actually arise:

  • A necessary condition for SOR to converge is 0<α<20 < \alpha < 2 — over-relaxation past 22 always diverges.
  • If AA is positive definite, then both SOR (for 0<α<20 < \alpha < 2) and Gauß-Seidel converge.
  • If AA and 2DAA2 D_A - A are both positive definite, then Jacobi converges.
  • If AA is strictly diagonally dominantaii>jiaija_{ii} > \sum_{j \neq i} |a_{ij}| for every row ii — then both Jacobi and Gauß-Seidel converge.
  • In certain cases the optimal relaxation parameter α\alpha can be computed exactly, the one that minimizes ρ\rho and so maximizes the error reduction per step.

One natural guess turns out to be false: applying corrections immediately does not make Gauß-Seidel uniformly better than Jacobi. There are matrices on which Gauß-Seidel converges while Jacobi diverges, and others the other way around. In many practical cases, though, Gauß-Seidel reaches a given accuracy in about half as many steps.

The spectral radius decides not just whether the iteration converges but how fast: the smaller ρ\rho, the more sharply every error component is cut each step. And here is where the classical methods disappoint. In practice ρ\rho often sits so close to 11 that — convergence notwithstanding — the number of steps needed for acceptable accuracy is far too large. The discretized PDE is the cautionary example: its spectral radius depends on the problem size nn and hence on the grid resolution hh, typically as

ρ=O ⁣(1hl2)=O ⁣(114l)for a mesh width hl=2l.\rho = O\!\left(1 - h_l^2\right) = O\!\left(1 - \tfrac{1}{4^l}\right) \quad \text{for a mesh width } h_l = 2^{-l}.

This is the worst possible coupling: the finer the grid — and so the more accurate the solution we are after — the closer ρ\rho creeps to 11 and the more miserably the iteration crawls. Refining the grid to gain accuracy directly sabotages the solver meant to exploit it. Escaping this trap — building a solver whose convergence does not decay as the grid is refined — is the concern that drives the rest of this page.

Minimization Methods: Steepest Descent and Conjugate Gradients

The relaxation methods were the first of the two families named earlier. The second comes at the linear system from a completely different angle, and it begins with a change of question. Rather than solving Ax=bA x = b head-on, it steps up one level to an artificial minimization problem, solves that instead, and lands back on the solution of the linear system as a by-product.

Solving a linear system as minimizing a quadratic

The trick rests on a different way of looking at a positive definite matrix AA (one whose eigenvalues are all strictly positive). Attach to the system the scalar-valued quadratic function

f(x)=12xTAxbTx+c,f(x) = \tfrac{1}{2}\, x^T A x - b^T x + c,

where AA is the system matrix, bb the right-hand side, cc an arbitrary scalar constant, and the products are arranged so the whole expression returns a single number. This ff is artificial — nothing in the original problem asked for it; it is introduced purely as a solution device. Its point is the equivalence

x solves Ax=bx minimizes f(x),x \text{ solves } A x = b \quad \Leftrightarrow \quad x \text{ minimizes } f(x),

and because AA is positive definite, that minimum is unique.

Why minimizing ff is the same as solving Ax=bA x = b

Minimizing a function means finding where its derivative vanishes. The gradient of the quadratic is

f(x)=Axb,\nabla f(x) = A x - b,

a linear function of xx — which is the whole reason the detour works: setting the gradient to zero, f(x)=0\nabla f(x) = 0, is exactly the linear system Ax=bA x = b again. So the place where ff is flat is the place where the linear system holds.

That the flat point is a genuine minimum (not a maximum or a saddle) is what positive definiteness buys. It is the matrix analogue of the 1D second-derivative test: just as f(x)>0f''(x) > 0 makes a stationary point of a scalar function a minimum, AA being positive definite makes the stationary point of the quadratic a minimum — and a unique one. Geometrically ff is a bowl-shaped paraboloid opening upward, and solving Ax=bA x = b means finding the single point at the bottom of the bowl.

The method of steepest descent

Once solving is recast as finding the bottom of a bowl, the most natural descent strategy applies. From the gradient we know that f\nabla f points in the direction of steepest ascent and is orthogonal to the contour lines of ff. To go downhill as fast as possible, then, step in the opposite direction — the negative gradient. And the negative gradient is an old friend: from f(x)=Axb\nabla f(x) = A x - b,

f(x(i))=bAx(i)=r(i),-\nabla f\bigl(x^{(i)}\bigr) = b - A x^{(i)} = r^{(i)},

the residual. So at each step the search direction is simply the residual.

A direction alone is not enough; we also need a step size — how far to travel along it. The natural choice is the value that goes as low as possible along that one ray, a one-dimensional line search

minαi f(x(i)+αir(i)),\min_{\alpha_i}\ f\bigl(x^{(i)} + \alpha_i\, r^{(i)}\bigr),

and because ff is quadratic this minimization along a line has a closed-form answer. Together the direction and the optimal step size make up the method of steepest descent.

The method of steepest descent solves Ax=bA x = b (with AA positive definite) by repeatedly stepping from the current approximation in the direction of the negative gradient of f(x)=12xTAxbTx+cf(x) = \tfrac{1}{2} x^T A x - b^T x + c — that is, in the direction of the residual r(i)r^{(i)} — taking at each step the optimal step size αi\alpha_i from a one-dimensional line search:

repeat i=0,1,αi:=r(i)Tr(i)r(i)TAr(i)x(i+1):=x(i)+αir(i)r(i+1):=r(i)αiAr(i)\begin{aligned} &\text{repeat } i = 0, 1, \dots \\ &\quad \alpha_i := \frac{r^{(i)T} r^{(i)}}{r^{(i)T} A r^{(i)}} \\ &\quad x^{(i+1)} := x^{(i)} + \alpha_i\, r^{(i)} \\ &\quad r^{(i+1)} := r^{(i)} - \alpha_i\, A r^{(i)} \end{aligned}

The three lines are the whole method. The first sets the step size to the line-search minimum. The second moves the approximation that far along the residual. The third updates the residual — and it is worth seeing that this is not a fresh computation but a cheap reuse: since r(i+1)=bAx(i+1)=bA(x(i)+αir(i))=r(i)αiAr(i)r^{(i+1)} = b - A x^{(i+1)} = b - A\bigl(x^{(i)} + \alpha_i r^{(i)}\bigr) = r^{(i)} - \alpha_i A r^{(i)}, and the matrix-vector product Ar(i)A r^{(i)} was already formed for the denominator of αi\alpha_i, the residual rides along for almost no extra work. The one strict requirement is that AA be positive definite, so that ff has a minimum to descend toward at all. It is a reasonable procedure, but a very heuristic one.

Why steepest descent is slow: the condition number

Before improving the method it pays to ask how it can possibly go wrong — and can it get any easier? One simplification is to search not along the gradient but along the coordinate axes in turn, one component at a time. Doing exactly that turns out to reproduce the Gauß-Seidel iteration from the relaxation family — a first sign that these methods, approached from opposite directions, are all related.

The trouble with steepest descent is its speed: it can be arbitrarily slow. The reason is that each step optimizes locally and in isolation, with no memory of the steps before it, so a new step routinely destroys part of what an earlier one had already achieved. On a long, narrow bowl the iterates zig-zag back and forth across the valley in tiny right-angle steps, creeping toward the minimum (this is the oscillation the line search cannot avoid: each direction is locally best but globally incoherent with the others).

How elongated that bowl is — and therefore how badly the method zig-zags — is measured by a single number built from the eigenvalues of AA.

The spectral condition number of a matrix AA is the ratio of its largest to its smallest eigenvalue in absolute value:

κ(A)=λmax(A)λmin(A).\kappa(A) = \frac{\lambda_{\max}(A)}{\lambda_{\min}(A)}.

It measures how stretched the level sets of the associated quadratic are. The best possible value is κ(A)=1\kappa(A) = 1, where the eigenvalues are all equal, the contours are perfectly round, and steepest descent reaches the minimum in a single step; the larger κ(A)\kappa(A) grows, the more elongated the bowl and the more slowly the iteration converges.

The condition number is not a quantity the algorithm computes or uses — it never appears in the update rules above. It is a diagnostic: it explains and predicts how fast the iteration will converge, and that is all. What it tells us is what to aim for. We want κ(A)\kappa(A) as small as possible, and — crucially — kept small even as the grid is refined, so the spectrum of AA does not spread out without bound as nn grows. Achieving that means designing algorithms that tame the eigenvalues: this time the eigenvalues of the system matrix AA itself, as opposed to the eigenvalues of the iteration matrix (the spectral radius) that governed the relaxation methods. The two cures developed below — conjugate directions and preconditioning — are two ways of doing exactly that.

Conjugate directions

The flaw to fix is the destruction: steepest descent keeps spoiling its own past progress. The cure is to choose search directions that never interfere — so that whatever a step accomplishes along its direction is never undone by a later step. Concretely, after ii steps the remaining error should be orthogonal to all the previous search directions, so that no earlier gain can leak back.

If the directions are chosen this way and the error component along each is eliminated exactly once, then in Rn\mathbb{R}^n the process must finish in at most nn steps — every direction handled, no error left. That makes it, in principle, a direct method: after nn steps it lands exactly on the optimum, no approximation about it.

The catch is that nn is enormous for a fine grid — millions or billions of unknowns in 3D — so running all nn steps is out of the question. In practice the method is stopped far earlier, the moment the approximation is accurate enough, and used exactly like an iterative method. A scheme that is a direct method in exact theory but is run as an iteration in practice is called semi-iterative: for a system with n=1010n = 10^{10} unknowns it would reach the exact answer after 101010^{10} steps, but no one ever takes 101010^{10} steps — a handful suffices for the accuracy a simulation actually needs.

The update now steps along a dedicated search direction d(i)d^{(i)} rather than the raw residual,

x(i+1)=x(i)+αid(i),x^{(i+1)} = x^{(i)} + \alpha_i\, d^{(i)},

and the directions must be built so the no-interference property holds. The ideal condition would be that each direction is orthogonal to the new error, 0=d(i)Te(i+1)0 = d^{(i)T} e^{(i+1)} — but the error e(i+1)e^{(i+1)} is exactly the unknown we lack, so this cannot be tested directly. The way out is to replace plain orthogonality with orthogonality through the matrix AA:

0=d(i)TAe(i+1).0 = d^{(i)T} A\, e^{(i+1)}.

Two vectors uu and vv are AA-orthogonal, or conjugate, when

uTAv=0.u^T A v = 0.

This is ordinary orthogonality measured through the matrix AA rather than directly. Building the search directions so that successive ones are conjugate is what lets each step preserve the progress of all the steps before it.

Conjugacy is the condition that can be enforced, precisely because Ae(i+1)=r(i+1)A\, e^{(i+1)} = -r^{(i+1)} is the (computable) residual — so the unknown error is once again accessed only through AA, exactly as the residual gave us a handle on it before. The iteration starts from d(0)=r(0)d^{(0)} = r^{(0)}, the steepest-descent direction. What remains is the recipe for producing the later conjugate directions d(i)d^{(i)}.

Conjugate gradients

The final method adds that recipe to the conjugate-direction iteration. The construction principle is Gram-Schmidt conjugation of the residuals — the standard orthogonalization procedure, but performed in the AA-orthogonality sense to turn the successive residuals into conjugate directions. Carried out naively, Gram-Schmidt would be ruinously expensive: each new direction would have to be made conjugate against all its predecessors, and accumulating those corrections over nn steps costs on the order of nn work per step, hence O(n3)O(n^3) overall — no better than the direct elimination we were trying to avoid.

The remarkable discovery at the heart of the method is that, for this particular setup, almost all of that work is unnecessary: the conjugation against every earlier direction collapses to a correction against only the single previous one. Enforcing conjugacy against the last direction turns out to deliver conjugacy against all of them for free. That short recurrence is what makes the method practical, and it is the conjugate gradient method.

The conjugate gradient method (CG) solves Ax=bA x = b for symmetric positive definite AA by steepest-descent-style line searches along directions d(i)d^{(i)} that are kept mutually conjugate through a short two-term recurrence:

repeat i=0,1,αi:=d(i)Tr(i)d(i)TAd(i)x(i+1):=x(i)+αid(i)r(i+1):=r(i)αiAd(i)βi+1:=r(i+1)Tr(i+1)r(i)Tr(i)d(i+1):=r(i+1)+βi+1d(i)\begin{aligned} &\text{repeat } i = 0, 1, \dots \\ &\quad \alpha_i := \frac{d^{(i)T} r^{(i)}}{d^{(i)T} A d^{(i)}} \\ &\quad x^{(i+1)} := x^{(i)} + \alpha_i\, d^{(i)} \\ &\quad r^{(i+1)} := r^{(i)} - \alpha_i\, A d^{(i)} \\ &\quad \beta_{i+1} := \frac{r^{(i+1)T} r^{(i+1)}}{r^{(i)T} r^{(i)}} \\ &\quad d^{(i+1)} := r^{(i+1)} + \beta_{i+1}\, d^{(i)} \end{aligned}

The iteration starts, as in the conjugate-direction scheme above, from d(0)=r(0)=bAx(0)d^{(0)} = r^{(0)} = b - A x^{(0)} — the first search direction is just the residual at the starting guess x(0)x^{(0)}, the steepest-descent direction — after which the recurrence in the last line generates every subsequent d(i+1)d^{(i+1)}. The five lines of the loop body then read as follows:

  • αi:=d(i)Tr(i)d(i)TAd(i)\alpha_i := \dfrac{d^{(i)T} r^{(i)}}{d^{(i)T} A d^{(i)}} — the line-search step size, exactly as in steepest descent, but measured along the search direction d(i)d^{(i)} instead of along the residual.
  • x(i+1):=x(i)+αid(i)x^{(i+1)} := x^{(i)} + \alpha_i\, d^{(i)} — step the current approximation that far along the search direction.
  • r(i+1):=r(i)αiAd(i)r^{(i+1)} := r^{(i)} - \alpha_i\, A d^{(i)} — update the residual cheaply, reusing the matrix-vector product Ad(i)A d^{(i)} already formed for αi\alpha_i rather than recomputing bAx(i+1)b - A x^{(i+1)} from scratch.
  • βi+1:=r(i+1)Tr(i+1)r(i)Tr(i)\beta_{i+1} := \dfrac{r^{(i+1)T} r^{(i+1)}}{r^{(i)T} r^{(i)}} — the conjugation coefficient: the ratio of the new residual’s squared length to the old one’s, a measure of how much the residual has shrunk this step.
  • d(i+1):=r(i+1)+βi+1d(i)d^{(i+1)} := r^{(i+1)} + \beta_{i+1}\, d^{(i)} — the new search direction: the fresh residual nudged by βi+1\beta_{i+1} times the old direction.

The first three lines are steepest descent with d(i)d^{(i)} in place of r(i)r^{(i)}; the last two are what is genuinely new. That single backward nudge by βi+1d(i)\beta_{i+1} d^{(i)} is the whole of the cheap conjugation — it keeps the directions mutually conjugate while storing only the one previous direction, never the full history. CG is markedly faster than steepest descent — but its step count still depends on nn.

There is a deeper structure to the directions it generates. The spaces spanned by the successive search directions form a so-called Krylov sequence:

span{d(0),,d(i1)}=span{d(0),Ad(0),,Ai1d(0)}=span{r(0),Ar(0),,Ai1r(0)}.\begin{aligned} \operatorname{span}\bigl\{ d^{(0)}, \dots, d^{(i-1)} \bigr\} &= \operatorname{span}\bigl\{ d^{(0)}, A d^{(0)}, \dots, A^{i-1} d^{(0)} \bigr\} \\ &= \operatorname{span}\bigl\{ r^{(0)}, A r^{(0)}, \dots, A^{i-1} r^{(0)} \bigr\}. \end{aligned}

Each iteration enlarges the search space by one more power of AA applied to the initial residual — and this is the structure that gives the second family the name promised earlier, the Krylov-subspace methods. CG is the most prominent member for symmetric positive definite systems; other widely used Krylov methods, built to handle matrices that are not symmetric positive definite, are GMRES and Bi-CGSTAB.

Preconditioning

Here the two families meet the same wall. The goal set out at the very start was a solver whose step count stays fixed no matter how many unknowns there are — “for 3 digits, ten steps,” independent of the grid resolution. Neither family reaches it. The relaxation methods stall because their spectral radius ρ\rho creeps toward 11 as the grid is refined, so each step removes less and less of the error; CG is much faster, but its step count still grows with nn. The decisive disadvantage they share is therefore exactly the one we were trying to avoid: the finer the grid, the more iterations the solver needs — convergence slows down precisely as the problem grows, which is precisely when we most want it to stay cheap.

This is not a small annoyance. Refining the grid is the whole point of the exercise — it is how the discrete solution is made accurate — so a solver that bogs down under refinement undercuts the very thing it is there to support. Escaping the wall is what the remainder of the page is about, and the cure splits along family lines:

  • For the relaxation methods, the cure is an explicit application of the multigrid principle (the subject of the rest of this page).
  • For the Krylov/CG methods, the cure is preconditioning — and the preconditioner is itself often multigrid-based.

Take preconditioning first. The quantity that governs CG’s convergence is the condition number κ(A)\kappa(A) of the matrix, and for a discretized PDE that condition number increases dramatically as nn grows — roughly like the inverse square of the mesh width, κ(A)=O(h2)\kappa(A) = O(h^{-2}). The idea is blunt: if the matrix is the problem, change the matrix. Multiplying Ax=bA x = b from the left by some invertible matrix M1M^{-1} leaves the solution xx untouched but replaces the system with an equivalent one,

Ax=bM1Ax=M1b,A x = b \quad \Leftrightarrow \quad M^{-1} A x = M^{-1} b,

and if MM is chosen so that M1AM^{-1} A has a far smaller condition number than AA — ideally close to 11 — the minimization methods converge dramatically faster on the new system. The symbol M1M^{-1} is just notation; the inverse is never formed explicitly, only applied.

There is a catch: M1AM^{-1} A need not be symmetric even when AA is, and CG relies on symmetric positive definiteness. The repair is to factor the (symmetric positive definite) preconditioner as M=WWTM = W W^T and transform symmetrically, which yields the fully expanded chain

Ax=bM1Ax=M1bW1AWTy=W1b,A x = b \quad \Leftrightarrow \quad M^{-1} A x = M^{-1} b \quad \Leftrightarrow \quad W^{-1} A W^{-T} y = W^{-1} b,

where MM is symmetric positive definite, WWT=MW W^T = M, and y=WTxy = W^T x. The two preconditioned matrices M1AM^{-1} A and W1AWTW^{-1} A W^{-T} are similar (they share the same eigenvalues, so the conditioning improvement is identical), but the symmetric form W1AWTW^{-1} A W^{-T} has the advantage of preserving the symmetry of AA — keeping the system in the symmetric positive definite class that CG needs.

Preconditioning accelerates an iterative solver for Ax=bA x = b by replacing the system with an equivalent, better-conditioned one through a preconditioner MM (symmetric positive definite):

Ax=bM1Ax=M1b.A x = b \quad \Leftrightarrow \quad M^{-1} A x = M^{-1} b.

A good MM balances two competing demands: it must be cheap to apply (solving Mz=rM z = r must be easy) yet close enough to AA that M1AM^{-1} A is far better conditioned than AA — ideally near the identity. Neither MM nor its factor WW (with WWT=MW W^T = M) is ever constructed explicitly; only their application is needed.

The two demands on MM pull in opposite directions in exactly the way the additive splitting A=M+(AM)A = M + (A - M) did for the relaxation methods: the easier MM is to apply, the less it resembles AA, and vice versa. The art is in the compromise.

Strategies for preconditioners

The choice of MM spans a spectrum between the two useless extremes:

  • M=IM = I — the easiest possible choice and the cheapest to apply, but useless: it changes nothing, leaving the original unpreconditioned method.
  • M=AM = A — the perfect choice for conditioning, since then M1A=IM^{-1} A = I exactly, but worthless in practice: applying M1=A1M^{-1} = A^{-1} means solving a system as hard as the original Ax=bA x = b, so computing the inverse is even more expensive than the problem we started from.

Every practical preconditioner is a compromise between these poles, cheap to apply yet a decent stand-in for AA:

  • Diagonal (Jacobi) preconditioner — take M=DAM = D_A, the diagonal of AA (reusing the A=LA+DA+UAA = L_A + D_A + U_A split from the relaxation analysis). It is the cheapest nontrivial choice and trivial to invert.

  • No Gauß-Seidel or SOR — these are deliberately not used as preconditioners, because the matrix MM they would supply is not symmetric, which would break the symmetric positive definite structure CG depends on.

  • SSOR preconditioner — the symmetric variant of SOR restores symmetry by combining a forward and a backward sweep. With the over-relaxation parameter α\alpha (the same parameter as in SOR, not the line-search step size αi\alpha_i above), it is built from

    M(1/2):=α1DA+LA,M(1):=α1DA+UA,M:=αα2(M(1/2))1DA1M(1).\begin{aligned} M^{(1/2)} &:= \alpha^{-1} D_A + L_A, \\ M^{(1)} &:= \alpha^{-1} D_A + U_A, \\ M &:= \frac{\alpha}{\alpha - 2}\,\bigl(M^{(1/2)}\bigr)^{-1} D_A^{-1} M^{(1)}. \end{aligned}
  • Imperfect (incomplete) factorization — for example ILU (incomplete LU): compute only approximate triangular factors LL and UU instead of the exact ones a direct solver would use, cheap to form and sparse, and use their product M=LUM = L U as the preconditioner. These are not the strictly-triangular parts LAL_A and UAU_A from the relaxation analysis, despite the similar names. That split was additive, A=LA+DA+UAA = L_A + D_A + U_A, with the diagonal held separately in DAD_A, so both triangles were strict. This one is multiplicative, ALUA \approx L U, and each factor carries a diagonal of its own (by convention ones along LL, the substantive diagonal in UU).

  • Sparse approximate inverse — construct a simple sparse matrix BB that approximates A1A^{-1} directly, by minimizing the residual of the inverse relation

    minB IAB2,M1=B,\min_B\ \lVert I - A B \rVert^2, \qquad M^{-1} = B,

    so that applying the preconditioner is just a sparse multiplication by BB.

  • Multilevel (multigrid) preconditioner — build MM to follow the multigrid principle, the deepest of the cures and the subject of the rest of this page.

Multigrid Methods

Every method so far has hit the same wall: convergence slows down as the grid is refined, precisely when speed matters most. Multigrid is the way through the wall — and it delivers exactly the goal set at the very start, a solver whose step count stays fixed no matter how many unknowns there are. The idea grows out of a single careful observation about what kind of error a relaxation sweep actually removes.

The smoothing property: why relaxation stalls

Take the error of the current approximation, e(i)=x(i)xe^{(i)} = x^{(i)} - x, and decompose it into Fourier components — sine waves of every frequency, from slow swells that rise and fall once across the whole domain to fast ripples that reverse from one grid point to the next. This is the same Fourier mode analysis used to study any wave-like signal, applied here to the error. The question is how each frequency fares under a standard relaxation sweep (Jacobi or Gauß-Seidel), and the answer splits cleanly in two:

  • The high-frequency part of the error — the rapid, jagged oscillations, wavelengths of just a few grid spacings — is knocked down fast. A sweep only ever couples a point to its immediate neighbors, so it is very effective against error that varies sharply from one point to the next.
  • The low-frequency part — the slow, smooth swells spanning many grid points — barely moves. It shrinks very slowly, and, worse, the slower the finer the grid is.

That last clause is the crux, and it hinges on what “fine” means. A grid’s resolution is simply how many points it packs into the domain — equivalently, how small its mesh width hh is. More points, smaller hh, finer grid, higher resolution. A smooth error swell spans a fixed physical distance; on a finer grid that same swell covers more grid points, so from the local point-to-neighbor view of the smoother it looks even flatter, even less like something to correct. Refining the grid — the very thing we do to make the solution more accurate — makes the smooth error harder to remove.

A relaxation method applied to a discretized PDE reduces the high-frequency components of the error (oscillations on the scale of the mesh width) quickly, but the low-frequency, smooth components only very slowly — the more slowly the finer the grid. After a few sweeps the error is therefore smooth: the wiggles are gone, a broad slowly-varying remainder survives. This is the smoothing property, and it is why relaxation methods are also called smoothers — on their own they do not solve the system, they merely smooth the error.

This cuts both ways. It is annoying, because the smooth remainder is exactly what refuses to die on a fine grid, so a plain smoother grinds to a halt long before the error is actually small. But it is also encouraging: a smooth function carries very little detail, and something with little detail does not need a fine grid to be represented — a much coarser grid, with far fewer points, captures it perfectly well. That gap between what the smoother can kill and what a coarse grid can represent is the opening multigrid drives through.

A very simple experiment makes the stall concrete. Solve the 1D Laplace equation with boundary values u(0)=u(1)=0u(0) = u(1) = 0; the exact solution is identically zero, which is convenient, because then the current approximation is the error — whatever nonzero values remain are pure error we can watch directly. Lay down an equidistant grid of 65 points, use the three-point stencil and a damped Jacobi method (damping factor 12\tfrac{1}{2} — the damping is what turns Jacobi into a good smoother), and start from random values in [0,1][0, 1]. After 100 sweeps the largest remaining error is still bigger than 0.10.1 — a hundred passes over every point and the error is nowhere near gone, held up entirely by its low-frequency part.

The picture behind the experiment tells the whole story at a glance. The random starting error is violently jagged, spikes at every scale. After just ten Jacobi steps the jaggedness is gone — the smoother has done its one job — but what is left is a broad smooth hump of height around 12\tfrac{1}{2}. After a full hundred steps that hump is only slightly lower: the method has essentially stopped making progress. A single multigrid cycle, by contrast, flattens the error almost to zero. One cycle against a hundred stalled sweeps — that is the payoff the rest of this section builds toward.

Frequencies are relative to the grid — the correction scheme

Here is the pivot. Whether an error component counts as “high” or “low” frequency is not a property of the component alone — it is relative to the grid it lives on. A smooth swell that is low-frequency on a fine grid, spread over many points, becomes high-frequency on a coarse grid, where only a handful of points span the same swell so it now reverses rapidly from point to point. The error has not changed; the grid under it has. And a smoother, useless against that swell on the fine grid, chews through it efficiently on the coarse grid, because there it is exactly the kind of rapid, point-to-point variation smoothers are good at.

So the plan writes itself: smooth on the fine grid to kill the high frequencies, then take the smooth remainder to a coarser grid where it is no longer smooth-relative-to-the-spacing, and smooth there too. What we must not do is naively move the solution around — the boundary conditions and right-hand side belong to the fine grid. The object that transfers cleanly is the error, through its equation.

That equation is the residual–error link from before, read in the other direction. With xx^\ast the exact solution and xlx_l the current approximation on grid Ωl\Omega_l, the residual is rl=blAlxlr_l = b_l - A_l x_l, and the exact correction e:=xxle := x^\ast - x_l needed to finish the job satisfies

Ale=AlxAlxl=blAlxl=rl.A_l\, e = A_l x^\ast - A_l x_l = b_l - A_l x_l = r_l.

This is the error equation (or residual equation) Ale=rlA_l e = r_l. Solving it exactly would hand us the exact answer in one shot, x=xl+ex^\ast = x_l + e — but that is just as hard as the original system. The multigrid move is to solve it only approximately, and cheaply, on a coarse grid: represent the residual rlr_l on Ωl1\Omega_{l-1}, solve the coarse version Al1el1=rl1A_{l-1} e_{l-1} = r_{l-1} there, carry the coarse correction el1e_{l-1} back up, and add it to xlx_l.

On the sign of ee. The residual definition earlier took the error as e(i)=x(i)xe^{(i)} = x^{(i)} - x (approximation minus exact), giving r=Ae(i)r = -A\,e^{(i)}. Here e=xxle = x^\ast - x_l is the opposite sign — the correction we add to the approximation, exact minus current — which is why the error equation comes out as Ale=rlA_l e = r_l with a clean plus sign. Same relationship, sign flipped to match what the scheme actually computes.

Combining the two grids in this way is the two-grid correction scheme.

Given a hierarchy of grids Ωl\Omega_l, l=1,,Ll = 1, \dots, L, with mesh width hl=2lh_l = 2^{-l} and corresponding matrices and right-hand sides Al,blA_l, b_l, the (two-grid) correction scheme improves an approximation xlx_l on the fine grid Ωl\Omega_l by borrowing a coarse grid Ωl1\Omega_{l-1}:

  1. smooth the current solution xlx_l (a few relaxation sweeps);
  2. form the residual rl=blAlxlr_l = b_l - A_l x_l;
  3. restrict rlr_l to the coarse grid Ωl1\Omega_{l-1}, giving rl1r_{l-1};
  4. solve the coarse error equation Al1el1=rl1A_{l-1}\, e_{l-1} = r_{l-1};
  5. prolongate the coarse correction el1e_{l-1} back to the fine grid Ωl\Omega_l;
  6. add the resulting correction to xlx_l;
  7. if necessary, smooth again.

The two-grid algorithm: restriction and prolongation

The seven steps group into five named stages, each with a clear job.

Pre-smoothing is step 1. Beyond making the error smooth, it does something specific and necessary: it removes the high-frequency content before the transfer. A rapidly oscillating wave simply cannot be recorded on a grid with too few points to trace it — the coarse grid would sample it wrongly and store something misleading (this misrepresentation is called aliasing). Smoothing first strips out precisely the components the coarse grid cannot hold, so what remains transfers without corruption.

Restriction is the fine-to-coarse transfer, step 3.

Restriction transfers a grid function (here the residual) from a fine grid to a coarse one. Two common choices:

  • injection — inherit the values at the points the coarse grid shares with the fine grid (every second point in 1D) and simply forget the rest;
  • (full) weighting — set each coarse value to a weighted average of the corresponding fine point and its neighbors, an averaging process that is more robust because it folds in the discarded points instead of dropping them.

Coarse-grid correction is step 4: produce an (approximate) solution of Al1el1=rl1A_{l-1} e_{l-1} = r_{l-1} on the coarse grid — solved directly if the coarse grid is small enough, or with a few smoothing steps otherwise.

Prolongation is the coarse-to-fine transfer, step 5, the reverse of restriction.

Prolongation transfers a grid function (here the coarse correction el1e_{l-1}) from a coarse grid back to a fine one, filling in the values at the fine points that the coarse grid does not carry. This is usually done by interpolation — most simply, linear interpolation, where each new in-between value is the average of its two coarse neighbors.

Post-smoothing is step 7: a final relaxation sweep or two on the fine grid, sometimes worth doing to damp any new high-frequency error that the interpolation in the prolongation step may have introduced.

The V-cycle

The two-grid scheme still contains one honest solve — step 4, the coarse error equation. But that coarse equation Al1el1=rl1A_{l-1} e_{l-1} = r_{l-1} is itself a discretized linear system of exactly the same kind as the one we started with. So rather than solving it outright, apply the same trick to it: smooth it, form its residual, restrict to a still coarser grid, and so on down a whole hierarchy of grids until the coarsest one is tiny enough to solve directly. That recursion is what turns the two-grid idea into a genuine multigrid method.

A multigrid method solves Ax=bA x = b by applying the correction scheme recursively over a hierarchy of grids Ω1,,ΩL\Omega_1, \dots, \Omega_L: each coarse-grid error equation is solved not directly but by the same coarse-grid correction, one level down, until the coarsest grid is small enough for a direct solve. Combining the smoothing property of relaxation (which handles high frequencies on each level) with coarse-grid correction (which handles what is smooth on that level) reduces error at every frequency in a single pass.

Following the recursion down to the coarsest grid and back up traces a V — down the left arm through successive restrictions to the bottom, up the right arm through successive prolongations — which is where the basic scheme gets its name.

The V-cycle is the multigrid scheme obtained by solving each coarse error equation with a single recursive coarse-grid correction. On grid Ωl\Omega_l:

  1. smooth the current solution xlx_l;
  2. form the residual rl=blAlxlr_l = b_l - A_l x_l;
  3. restrict rlr_l to Ωl1\Omega_{l-1};
  4. solve Al1el1=rl1A_{l-1}\, e_{l-1} = r_{l-1} by coarse-grid correction (the same procedure, one level down);
  5. prolongate el1e_{l-1} back to Ωl\Omega_l;
  6. add the correction to xlx_l;
  7. if necessary, smooth again.

On the coarsest grid the recursion stops with a direct solution. The number of smoothing steps per level is kept small, typically 1 or 2.

Further multigrid schemes

The V-cycle is the simplest recursion, not the only one, and a few named variants are worth recognizing.

  • The W-cycle visits the coarse grids more thoroughly: after each prolongation it dips back down once more before climbing to the next finer grid, so its trace through the hierarchy looks like a W rather than a V. It is heavier per cycle but sometimes advantageous for speed of convergence.
  • Nested iteration builds a good starting guess instead of a correction. It begins on the coarsest grid, smooths, prolongates the result up to the next grid, smooths again, and continues up to the finest grid — only then starting a V-cycle, now from a much better initial approximation.
  • Full multigrid (FMG) is nested iteration with each “smooth” step replaced by a full V-cycle, combining the improved starting solution of nested iteration with the multigrid solver at every level. It is the most powerful of the standard schemes.

Nothing in the idea depends on the grid being rectangular or even structured — all it needs is a hierarchy of nested grids, so it works equally well on triangles or tetrahedra. It can even be pushed further, dropping the underlying geometry entirely and building the hierarchy from the structure of the matrix alone: these are the algebraic multigrid (AMG) methods.

Why it works: cost and convergence

Two facts together explain why multigrid is the fast solver the whole page has been after.

The cost of one cycle is O(n)O(n), dominated entirely by the finest grid. Each coarser grid has a fraction 2d2^{-d} as many points as the one above it (in dd dimensions), so if one smoothing sweep on the finest grid of nn points costs cnc \cdot n, the total over the hierarchy is a geometric series that sums to a small constant times cnc \cdot n:

1D:cn+cn2+cn4+2cn=O(n),2D:cn+cn4+cn16+43cn=O(n),3D:cn+cn8+cn64+87cn=O(n).\begin{aligned} \text{1D:} \quad & c n + \tfrac{c n}{2} + \tfrac{c n}{4} + \dots \le 2\, c n = O(n), \\ \text{2D:} \quad & c n + \tfrac{c n}{4} + \tfrac{c n}{16} + \dots \le \tfrac{4}{3}\, c n = O(n), \\ \text{3D:} \quad & c n + \tfrac{c n}{8} + \tfrac{c n}{64} + \dots \le \tfrac{8}{7}\, c n = O(n). \end{aligned}

The work on all the coarse grids is negligible next to the finest grid — a complete V-cycle costs barely more than a single smoothing sweep on the fine grid alone.

The benefit is in the convergence. A multigrid cycle always beats pure smoothing by a wide margin, and in most cases it reaches the ideal behavior γ=O(1const)\gamma = O(1 - \text{const}) — the error-reduction factor per cycle is bounded away from 11 by a constant that does not depend on nn or hh. This is exactly the property every earlier method lacked: their reduction factor crept toward 11 as the grid was refined.

Put the two together and the consequence is the goal announced at the very start of the iterative discussion — “for 3 digits, ten steps,” independent of the number of unknowns. A constant number of V-cycles buys a given number of correct digits regardless of grid size, and each cycle costs O(n)O(n), so the total work to solve the system grows only linearly with nn. For discretized elliptic PDEs this is essentially optimal: you cannot solve for nn unknowns in less than O(n)O(n) work, and multigrid gets there.