AI Knowledge Tree

Fixed-point and iterative methods

Solve equations by iteration and analyze convergence with the contraction-mapping idea.

⏱ 30 minPrerequisites:Conditioning and numerical stability

Many problems have no closed-form solution, but can be rewritten as x=T(x)x = T(x) for some map TT. Iterative methods start from a guess and apply TT repeatedly until the sequence settles. The condition that makes this work, TT 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 T:Rn→RnT: \mathbb{R}^n \to \mathbb{R}^n is a point x⋆x^\star with T(x⋆)=x⋆T(x^\star) = x^\star. The fixed-point iteration is the simple loop

xk+1=T(xk).x_{k+1} = T(x_k).

If the sequence converges, its limit is a fixed point: lim⁡xk+1=lim⁡T(xk)=T(lim⁡xk)\lim x_{k+1} = \lim T(x_k) = T(\lim x_k) when TT is continuous. The question is when the sequence converges and how fast.

Contraction mappings

TT is a contraction with constant L<1L < 1 if it brings every pair of points strictly closer together:

∥T(x)−T(y)∥≤L ∥x−y∥for all x,y.\lVert T(x) - T(y)\rVert \le L\,\lVert x - y\rVert \quad \text{for all } x, y.

Banach fixed-point theorem. A contraction on a complete space has a unique fixed point x⋆x^\star, and from any x0x_0 the iteration converges to it at a geometric rate:

∥xk−x⋆∥≤Lk ∥x0−x⋆∥.\lVert x_k - x^\star\rVert \le L^k\,\lVert x_0 - x^\star\rVert.

Proof sketch. Apply the contraction property iteratively: ∥xk+1−xk∥≤L∥xk−xk−1∥≤Lk∥x1−x0∥\lVert x_{k+1} - x_k\rVert \le L\lVert x_k - x_{k-1}\rVert \le L^k \lVert x_1 - x_0\rVert. The geometric series ∑kLk\sum_k L^k converges since L<1L < 1, so {xk}\{x_k\} is Cauchy and has a limit x⋆x^\star. Continuity of TT shows x⋆x^\star is a fixed point. Uniqueness: two fixed points x,yx, y would give ∥x−y∥=∥T(x)−T(y)∥≤L∥x−y∥\lVert x - y\rVert = \lVert T(x) - T(y)\rVert \le L\lVert x - y\rVert, forcing ∥x−y∥=0\lVert x - y\rVert = 0. ■\qquad\blacksquare

The rate LkL^k is linear convergence: each step shrinks the error by a constant factor. Reaching accuracy ε\varepsilon takes O(log⁡(1/ε)/log⁡(1/L))O(\log(1/\varepsilon)/\log(1/L)) steps.

The constant LL is the whole story, and its scale is worth feeling. To reach ε=10−6\varepsilon = 10^{-6}:

  • L=0.5L = 0.5 (error halves each step) needs about 20 steps; after 10 steps the error is already down to 0.510≈10−30.5^{10} \approx 10^{-3}.
  • L=0.9L = 0.9 needs about 131 steps; 10 steps only knock the error down to 0.910≈0.350.9^{10} \approx 0.35.
  • L=0.99L = 0.99 needs about 1375 steps; 10 steps barely move it, to 0.9100.9^{10}'s far worse cousin 0.9910≈0.900.99^{10} \approx 0.90.

The cosine map below has L=∣T′(x⋆)∣=sin⁡(x⋆)≈0.674L = |T'(x^\star)| = \sin(x^\star) \approx 0.674, so it sits near the fast end and settles in a few dozen steps.

Newton's method as a fixed-point iteration

Solving f(x)=0f(x) = 0 can be cast as the fixed-point iteration xk+1=T(xk)x_{k+1} = T(x_k) with T(x)=x−f(x)/f′(x)T(x) = x - f(x)/f'(x), which is exactly Newton's method. At a simple root, T′(x⋆)=1−(f′(x⋆)2−f(x⋆)f′′(x⋆))/f′(x⋆)2=0T'(x^\star) = 1 - (f'(x^\star)^2 - f(x^\star)f''(x^\star))/f'(x^\star)^2 = 0, so TT 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 Ax=bAx = b with A=D+RA = D + R (DD the diagonal, RR the rest), the Jacobi iteration is

xk+1=D−1(b−Rxk),x_{k+1} = D^{-1}(b - R x_k),

a fixed-point form of the linear system. The iteration matrix is −D−1R-D^{-1}R, and the iteration converges if the spectral radius (the largest eigenvalue magnitude) is less than 1, which holds for strictly diagonally dominant AA (∣aii∣>∑j≠i∣aij∣|a_{ii}| > \sum_{j \neq i}|a_{ij}|). Jacobi and its variant Gauss-Seidel are the original iterative linear solvers, the predecessors of conjugate gradient[2, 3].

Stationary iterations like Jacobi converge geometrically when the iteration matrix is a contraction: the error shrinks by a roughly constant factor per sweep.
Stationary iterations like Jacobi converge geometrically when the iteration matrix is a contraction: the error shrinks by a roughly constant factor per sweep.

Check it on arrays

python · numpy
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 ∣T′∣<1|T'| < 1 confirming contraction, and Jacobi converges linearly on the diagonally dominant system.

Exercises

Exercise 1. A contraction has constant L=0.8L = 0.8. Using the geometric bound ∥xk−x⋆∥≤Lk∥x0−x⋆∥\lVert x_k - x^\star\rVert \le L^k \lVert x_0 - x^\star\rVert, find the smallest kk that guarantees the error has dropped below 10−310^{-3} of the initial error.

Solution

Step 1. The guarantee is Lk≤10−3L^k \le 10^{-3}, i.e. 0.8k≤10−30.8^k \le 10^{-3}. Take logs: klog⁡0.8≤log⁡10−3k \log 0.8 \le \log 10^{-3}.

Step 2. Since log⁡0.8<0\log 0.8 < 0, dividing flips the inequality:

k≥log⁡10−3log⁡0.8=−3log⁡10log⁡0.8≈−6.908−0.2231≈30.96.k \ge \frac{\log 10^{-3}}{\log 0.8} = \frac{-3 \log 10}{\log 0.8} \approx \frac{-6.908}{-0.2231} \approx 30.96.

Step 3. The smallest integer is k=31k = 31. The general count O(log⁡(1/ε)/log⁡(1/L))O(\log(1/\varepsilon)/\log(1/L)) shows the dependence on LL: a contraction nearer to 11 needs proportionally more steps for the same accuracy.

Exercise 2. Newton's method for f(x)=x2−af(x) = x^2 - a gives the iteration xk+1=12(xk+axk)x_{k+1} = \tfrac12\left(x_k + \tfrac{a}{x_k}\right). Show this is the fixed-point map T(x)=x−f(x)/f′(x)T(x) = x - f(x)/f'(x), and verify T′(x⋆)=0T'(x^\star) = 0 at the root x⋆=ax^\star = \sqrt{a}.

Solution

Step 1. With f(x)=x2−af(x) = x^2 - a and f′(x)=2xf'(x) = 2x,

T(x)=x−x2−a2x=2x2−x2+a2x=x2+a2x=12(x+ax),T(x) = x - \frac{x^2 - a}{2x} = \frac{2x^2 - x^2 + a}{2x} = \frac{x^2 + a}{2x} = \tfrac12\left(x + \frac{a}{x}\right),

which is the stated iteration.

Step 2. Differentiate T(x)=12(x+ax−1)T(x) = \tfrac12\left(x + a x^{-1}\right):

T′(x)=12(1−ax2).T'(x) = \tfrac12\left(1 - \frac{a}{x^2}\right).

Step 3. At the root x⋆=ax^\star = \sqrt{a}, x⋆2=ax^{\star 2} = a, so T′(x⋆)=12(1−1)=0T'(x^\star) = \tfrac12(1 - 1) = 0. 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 Ax=bAx = b and confirm the error decays geometrically with a contraction factor below 11 equal to the spectral radius of −D−1R-D^{-1}R.

Solution
python · numpy
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 11, 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. [1]Trefethen, L. N., & Bau, D. (1997). Numerical Linear Algebra. SIAM. Iteration and convergence of stationary methods (Lectures 27-28).↩
  2. [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. [3]Golub, G. H., & Van Loan, C. F. (2013). Matrix Computations (4th ed.). Johns Hopkins University Press. Classical stationary iterative methods.↩