Iterative linear solvers and preconditioning
Connect residual corrections, spectral convergence, Krylov spaces, and the practical role of a preconditioner.
On this page
The question for today
What you’ll understand
- Analyze a stationary iteration through its error propagation matrix.
- Match conjugate gradients and GMRES to appropriate matrix assumptions.
- Evaluate preconditioning by total cost rather than iteration count alone.
A sparse operator with millions of unknowns may be cheap to multiply by a vector yet expensive to factor. Iterative solvers exploit that difference: start with a candidate, inspect its residual, and build increasingly useful corrections. Their success depends on matrix geometry, stopping rules, and preconditioning, not on the word iterative itself. Some converge slowly, some diverge, and some behave well only under symmetry or positivity assumptions. This lesson begins with a transparent residual update, then connects it to Krylov methods used for large simulations, optimization subproblems, and infrastructure-scale scientific computation.
An update induces an error equation
A stationary residual correction applies a fixed approximate inverse M inverse to b minus A times the current guess. Subtract the exact solution to find a linear recurrence for the error. Convergence from every starting vector in finite dimensions occurs when the error propagation matrix has spectral radius below one. A bound in a convenient induced norm gives an easier sufficient condition, but failing that norm test does not automatically prove divergence. The chosen diagnostic must match the theorem being used.
Jacobi iteration chooses M as the diagonal of A and requires nonzero diagonal entries. Strict row diagonal dominance is one useful sufficient condition for convergence, but arbitrary nonsingular matrices need not satisfy it. Gauss–Seidel uses newly computed coordinates within each sweep, producing a different propagation matrix. Rearranging or damping updates can change convergence. None of these choices makes a small residual synonymous with small forward error: the original system's conditioning remains relevant at termination.
Krylov spaces adapt directions to the operator
A Krylov method uses vectors generated by repeatedly applying A to the initial residual. The resulting subspace can capture useful directions without storing a dense factorization. Conjugate gradients exploits real symmetry and positive definiteness, minimizing the error in the A-energy norm over its affine Krylov space in exact arithmetic. Its textbook finite-termination property is an ideal exact-arithmetic fact, not a promise that a large floating-point run finishes with zero error after exactly n iterations.
GMRES instead minimizes the Euclidean residual over a growing Krylov subspace and applies to general nonsymmetric square systems. Building and orthogonalizing that basis consumes increasing memory and communication, so restarted variants discard part of the history and may stagnate. An algorithm choice follows from operator structure and available resources. Using conjugate gradients on an arbitrary nonsymmetric or indefinite problem invalidates its usual guarantees; changing the solver name in code does not change the mathematics of the matrix.
A useful preconditioner changes the hard geometry cheaply
A preconditioner approximates the action of A well enough that applying its inverse makes the transformed problem easier, while remaining cheaper than solving the original system directly. Diagonal scaling is inexpensive; incomplete factorizations and multilevel methods can be stronger but need setup work and storage. For conjugate gradients, a symmetric positive-definite preconditioner is used with a compatible symmetric formulation. Merely left-multiplying an SPD matrix by an arbitrary inverse does not preserve ordinary Euclidean symmetry.
Measure total time: setup, sparse products, preconditioner applications, orthogonalization, communication, and the number of right-hand sides. A preconditioner that halves iterations but triples each step can lose overall. Monitor a meaningful residual in the original system, since a transformed residual has a different scale. In floating-point arithmetic, recursively updated residuals may drift from b−Ax, so occasional explicit recomputation can be necessary. Stop at an error level justified by the data and the outer algorithm instead of solving an inner system far more accurately than needed.
Work it through
Two Jacobi sweeps and an exact comparison
Apply Jacobi to 4x+y=1 and x+3y=2 from (0,0). Compare the first two iterates with the exact solution.
The update is x(next)=(1−y)/4 and y(next)=(2−x)/3, with both right-hand sides using the old iterate. The first vector is (1/4,2/3).
The second vector is ((1−2/3)/4,(2−1/4)/3)=(1/12,7/12). Solving the original two equations exactly gives (1/11,7/11).
The second residual is (1−11/12,2−11/6)=(1/12,1/6), with Euclidean norm √5/12≈0.186339. The actual error norm is √50/132≈0.0535687.
The error propagation matrix has off-diagonal entries −1/4 and −1/3 and zero diagonal. Its eigenvalues are ±1/√12, so its spectral radius is about 0.288675<1. This establishes convergence in exact arithmetic, beyond merely observing two improved iterates.
The iteration has a provable convergent error recurrence. Residual size and solution error remain distinct quantities even in this small well-behaved example.
The living notebook
Explore the model
Interactive lab · optimization
A scalar residual correction you can control
The lab iterates xₙ=(1−η)ⁿx₀ for the quadratic x²/2. Treat this as Richardson iteration for the scalar system x=0. Which step sizes damp the error, alternate its sign, or make it grow? It does not run Jacobi on the worked matrix, build Krylov spaces, or apply a preconditioner.
- Position x0
- 2
- Objective x²/2
- 2
- Iteration behavior
- Stable step
Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forConvergence follows from the update's amplification factor; a matrix solver replaces the scalar factor with an operator.
Pause & reason
Check your understanding
Your turn
Try it yourself
For scalar Richardson iteration x(next)=x+ω(2−2x), find the range of ω giving convergence to one from every initial value.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Subtract the exact solution one and inspect the multiplier of the error.
Compare with the solution
The error satisfies e(next)=(1−2ω)e. Convergence from every initial error requires |1−2ω|<1, giving 0<ω<1. At ω=1/2 the solution is reached in one exact-arithmetic step; at ω=1 a nonzero error alternates without decaying.
Keep the idea
Take it with you
- Analyze the error propagation operator, not just the visible iterates.
- Krylov methods have distinct matrix assumptions and memory costs.
- Preconditioning succeeds when its total cost improves a meaningful accuracy target.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.