Fixed-point and iterative methods
Solve equations by iteration and analyze convergence with the contraction-mapping idea.
Many problems have no closed-form solution, but can be rewritten as for some map . Iterative methods start from a guess and apply repeatedly until the sequence settles. The condition that makes this work, being a contraction, also gives an explicit error bound and convergence rate, which is the template used in everything from linear solvers to optimization to MCMC[1].
Fixed points
A fixed point of a map is a point with . The fixed-point iteration is the simple loop
If the sequence converges, its limit is a fixed point: when is continuous. The question is when the sequence converges and how fast.
Contraction mappings
is a contraction with constant if it brings every pair of points strictly closer together:
Banach fixed-point theorem. A contraction on a complete space has a unique fixed point , and from any the iteration converges to it at a geometric rate:
Proof sketch. Apply the contraction property iteratively: . The geometric series converges since , so is Cauchy and has a limit . Continuity of shows is a fixed point. Uniqueness: two fixed points would give , forcing .
The rate is linear convergence: each step shrinks the error by a constant factor. Reaching accuracy takes steps.
The constant is the whole story, and its scale is worth feeling. To reach :
- (error halves each step) needs about 20 steps; after 10 steps the error is already down to .
- needs about 131 steps; 10 steps only knock the error down to .
- needs about 1375 steps; 10 steps barely move it, to 's far worse cousin .
The cosine map below has , so it sits near the fast end and settles in a few dozen steps.
Newton's method as a fixed-point iteration
Solving can be cast as the fixed-point iteration with , which is exactly Newton's method. At a simple root, , so is more than a contraction near the root: it has zero local derivative, which is the algebraic source of Newton's quadratic convergence.
Jacobi iteration for linear systems
For with ( the diagonal, the rest), the Jacobi iteration is
a fixed-point form of the linear system. The iteration matrix is , and the iteration converges if the spectral radius (the largest eigenvalue magnitude) is less than 1, which holds for strictly diagonally dominant (). Jacobi and its variant Gauss-Seidel are the original iterative linear solvers, the predecessors of conjugate gradient[2, 3].
Check it on arrays
import numpy as np
# 1) Fixed-point iteration for cos: x = cos(x), Dottie number ~0.7390851...
T = np.cos
x = 0.0
errs = []
for _ in range(60):
errs.append(x)
x = T(x)
print("Dottie fixed point:", round(x, 8))
print("|T'(x*)| =", round(abs(-np.sin(x)), 4), " < 1 (contraction near x*)")
# 2) Jacobi for a diagonally dominant linear system
rng = np.random.default_rng(0)
n = 30
A = rng.normal(size=(n, n))
np.fill_diagonal(A, np.abs(A).sum(axis=1) + 1.0) # make strictly diag. dominant
b = rng.normal(size=n)
D = np.diag(np.diag(A)); R = A - D
Dinv = np.diag(1.0 / np.diag(A))
x = np.zeros(n)
gaps = []
truth = np.linalg.solve(A, b)
for _ in range(200):
x = Dinv @ (b - R @ x)
gaps.append(np.linalg.norm(x - truth))
# Geometric decay: ratio of consecutive errors should be roughly constant
ratios = np.array(gaps[1:]) / np.array(gaps[:-1])
print(f"Jacobi avg contraction factor: {np.mean(ratios[50:100]):.4f}")
print(f"final error: {gaps[-1]:.2e}")The cosine iteration settles on the Dottie number with confirming contraction, and Jacobi converges linearly on the diagonally dominant system.
Exercises
Exercise 1. A contraction has constant . Using the geometric bound , find the smallest that guarantees the error has dropped below of the initial error.
Solution
Step 1. The guarantee is , i.e. . Take logs: .
Step 2. Since , dividing flips the inequality:
Step 3. The smallest integer is . The general count shows the dependence on : a contraction nearer to needs proportionally more steps for the same accuracy.
Exercise 2. Newton's method for gives the iteration . Show this is the fixed-point map , and verify at the root .
Solution
Step 1. With and ,
which is the stated iteration.
Step 2. Differentiate :
Step 3. At the root , , so . The local derivative vanishes, which is why this iteration converges quadratically rather than merely linearly: each step roughly doubles the number of correct digits.
Exercise 3 (code). Implement Jacobi iteration for a strictly diagonally dominant and confirm the error decays geometrically with a contraction factor below equal to the spectral radius of .
Solution
import numpy as np
rng = np.random.default_rng(0)
n = 20
A = rng.normal(size=(n, n))
np.fill_diagonal(A, np.abs(A).sum(axis=1) + 1.0) # strictly diagonally dominant
b = rng.normal(size=n)
D = np.diag(np.diag(A))
R = A - D
Dinv = np.diag(1.0 / np.diag(A))
iter_matrix = -Dinv @ R
rho = np.max(np.abs(np.linalg.eigvals(iter_matrix))) # spectral radius
assert rho < 1.0 # convergence condition
truth = np.linalg.solve(A, b)
x = np.zeros(n)
errs = []
for _ in range(40):
x = Dinv @ (b - R @ x)
errs.append(np.linalg.norm(x - truth))
errs = np.array(errs)
# Error ratio in the geometric regime (before it hits the rounding floor)
# tracks the spectral radius.
ratios = errs[6:15] / errs[5:14]
assert abs(np.mean(ratios) - rho) < 0.05
print("spectral radius:", round(rho, 4), " measured ratio:", round(float(np.mean(ratios)), 4))The strict diagonal dominance forces the spectral radius below , so the iteration matrix is a contraction in the eigenvector basis and the error shrinks by that factor each sweep, which the measured ratio confirms.
The next lesson specializes the iterative idea to symmetric positive-definite systems: conjugate gradient.
References
- [1]Trefethen, L. N., & Bau, D. (1997). Numerical Linear Algebra. SIAM. Iteration and convergence of stationary methods (Lectures 27-28).↩
- [2]Saad, Y. (2003). Iterative Methods for Sparse Linear Systems (2nd ed.). SIAM. Jacobi, Gauss-Seidel, and spectral-radius convergence (doi:10.1137/1.9780898718003).↩
- [3]Golub, G. H., & Van Loan, C. F. (2013). Matrix Computations (4th ed.). Johns Hopkins University Press. Classical stationary iterative methods.↩