A metric space equips a set with a distance function satisfying three axioms; contraction mappings on complete metric spaces always have a unique fixed point (Banach's theorem), the engine behind PageRank, iterative solvers, and fractal image compression.
IntuitionMeasuring distance without a ruler
GPS uses straight-line distance, a taxi driver uses street-grid distance, and a spell-checker uses "edit distance" between words. All three are legitimate notions of distance because they share the same three common-sense rules: distance is never negative and is zero only when two points coincide, distance from A to B equals distance from B to A, and going via a detour C never shortens the direct trip from A to B. A metric space is exactly a set equipped with any distance function obeying these three rules.
Plot of the line T(x) = 0.5x + 1 crossing the diagonal y = x at the fixed point x = 2, illustrating contraction mapping iteration.
The map T(x)=0.5x+1 on R (with d(x,y)=∣x−y∣) is a contraction with ratio q=0.5: it always halves the distance between any two points. Adjust the sliders and watch that every starting point iterates toward the same fixed point x∗=2.
UndergraduateThe three axioms
Definition: Metric space
A metric on a set X is a function d:X×X→R satisfying, for all x,y,z∈X: (M1) positivity d(x,y)≥0,d(x,y)=0⟺x=y; (M2) symmetry d(x,y)=d(y,x); (M3) the triangle inequality d(x,z)≤d(x,y)+d(y,z). The pair (X,d) is a metric space.
Two families of examples matter most. On Rn, the **ℓp metrics** are dp(x,y)=(∑i=1n∣xi−yi∣p)1/p for p≥1 (so p=2 gives ordinary Euclidean distance, p=1 gives "taxicab" distance, and p→∞ gives the maximum coordinate difference). On the space C([a,b]) of continuous functions, the sup-metric is d∞(f,g)=supt∈[a,b]∣f(t)−g(t)∣: two functions are close if their graphs never separate by more than a small margin anywhere on [a,b].
UndergraduateBalls, completeness, and contractions
The open ballB(x0,r)={x∈X:d(x,x0)<r} is the set of points within distance r of the center. A sequence (xn) is Cauchy if ∀ε>0∃N∀m,n>N:d(xm,xn)<ε: its terms eventually get arbitrarily close to each other (not necessarily to any fixed limit point yet). A metric space is complete if every Cauchy sequence converges to a point of X. Rn with any ℓp metric is complete; Q with d(x,y)=∣x−y∣ is not, since 2 is missing.
For all x,y,z in a metric space, ∣d(x,z)−d(y,z)∣≤d(x,y).
Why is it true?
It shows the distance function itself is Lipschitz-continuous (with constant 1) in each argument, which is what lets you take limits of distances safely.
Proof
Step 1 — Two applications of the triangle inequality. By (M3), d(x,z)≤d(x,y)+d(y,z), which rearranges to d(x,z)−d(y,z)≤d(x,y). Swapping the roles of x and y in the same axiom gives d(y,z)≤d(y,x)+d(x,z)=d(x,y)+d(x,z) (using symmetry d(y,x)=d(x,y)), which rearranges to d(y,z)−d(x,z)≤d(x,y), i.e. −(d(x,z)−d(y,z))≤d(x,y).
Step 2 — Combine both bounds. The two inequalities say d(x,z)−d(y,z)≤d(x,y) and −(d(x,z)−d(y,z))≤d(x,y) simultaneously, which is exactly the statement ∣d(x,z)−d(y,z)∣≤d(x,y) by the definition of absolute value: a real number u satisfies ∣u∣≤c precisely when both u≤c and −u≤c hold.
Let (X,d) be a complete metric space and T:X→X a contraction: d(T(x),T(y))≤qd(x,y) for some fixed 0≤q<1 and all x,y∈X. Then T has exactly one fixed point x∗∈X (i.e. T(x∗)=x∗), and starting from any x0∈X the iterates xn+1=T(xn) converge to x∗ with the explicit error bound d(xn,x∗)≤1−qqnd(x1,x0).
Why is it true?
It converts existence-and-uniqueness questions (does this equation have exactly one solution?) into a mechanical, guaranteed-to-converge computation, with a precomputable bound on how many iterations are needed for any target accuracy.
Proof
Step 1 — The iterates form a Cauchy sequence. Fix x0∈X and set xn=Tn(x0). By the contraction property applied repeatedly, d(xn+1,xn)=d(T(xn),T(xn−1))≤qd(xn,xn−1)≤⋯≤qnd(x1,x0). For m>n, the triangle inequality chains this along the path xn,xn+1,…,xm: d(xm,xn)≤∑k=nm−1d(xk+1,xk)≤∑k=nm−1qkd(x1,x0)≤d(x1,x0)∑k=n∞qk=d(x1,x0)1−qqn, using the geometric series formula since 0≤q<1. As n→∞, qn→0, so this tail bound goes to 0: (xn) is Cauchy.
Step 2 — Completeness gives a limit, and continuity makes it a fixed point. Since X is complete, the Cauchy sequence (xn) converges to some x∗∈X. The contraction inequality d(T(x),T(y))≤qd(x,y) shows T is (Lipschitz) continuous, so T(x∗)=T(limnxn)=limnT(xn)=limnxn+1=x∗. Thus x∗ is a fixed point.
Step 3 — Uniqueness. Suppose x∗ and y∗ are both fixed points. Then d(x∗,y∗)=d(T(x∗),T(y∗))≤qd(x∗,y∗), so (1−q)d(x∗,y∗)≤0. Since 1−q>0, this forces d(x∗,y∗)=0, i.e. x∗=y∗.
Step 4 — The error bound. Letting m→∞ in the Step 1 estimate d(xm,xn)≤1−qqnd(x1,x0) and using continuity of d gives exactly d(xn,x∗)≤1−qqnd(x1,x0): the distance to the true fixed point after n steps shrinks geometrically, and the bound can be computed before running a single iteration.
UndergraduateReal-World Applications and Worked Examples
Google's PageRank computes the dominant eigenvector of a web-link matrix by repeatedly applying it to a probability vector — this power iteration is a contraction in the ℓ1 metric on probability distributions. Iterative linear solvers (Jacobi, Gauss–Seidel) rewrite Ax=b as a fixed-point map x↦Cx+d that is a contraction in the sup-metric whenever A is diagonally dominant. Fractal (IFS) image compression represents an image as the unique fixed point of a contraction on the space of images equipped with the sup/Hausdorff metric, so decompression is just iterating the map.
Example: PageRank as a contraction on probability vectors
A tiny 2-page web has link matrix M=(0.10.90.90.1) (each column redistributes rank with a damping factor). Starting from r0=(1,0), compute r1=Mr0 and r2=Mr1 using the ℓ1 metric d(x,y)=∣x1−y1∣+∣x2−y2∣, and check d(r1,r2)≤qd(r0,r1) for q=0.8.
Step 3 — Compute distances and check the contraction ratio. d(r0,r1)=∣1−0.1∣+∣0−0.9∣=0.9+0.9=1.8. d(r1,r2)=∣0.1−0.82∣+∣0.9−0.18∣=0.72+0.72=1.44. Indeed 1.44=0.8×1.8, matching q=0.8 exactly (the row/column sums of M shifted by 0.5 from the damping factor give this ratio), confirming the iteration contracts and will converge to the stationary rank vector (0.5,0.5).
Example: How many iterations for a target compression accuracy?
A fractal image-compression decoder applies a contraction T with ratio q=0.6 on the sup-metric over images, and the first two iterates satisfy d(x1,x0)=100 (pixel-intensity units). Using the error bound d(xn,x∗)≤1−qqnd(x1,x0), find the smallest n guaranteeing d(xn,x∗)<1.
Solution
Step 1 — Write the inequality to solve. We need 1−qqnd(x1,x0)<1, i.e. 0.40.6n×100<1, i.e. 0.6n<0.004.
Step 2 — Take logarithms. nln(0.6)<ln(0.004). Since ln(0.6)≈−0.5108 is negative, dividing flips the inequality: n>ln(0.6)ln(0.004)=−0.5108−5.521≈10.81.
Step 3 — Round up to the smallest integer. n=11 iterations guarantee d(xn,x∗)<1 pixel-intensity unit, and this number was known before running any iteration — exactly the practical value of the a priori error bound in compression codecs.
Which property FAILS for d(x,y)=(x−y)2 on R?
Using the ℓ2 metric, what is d((1,2,2),(4,6,2)) in R3?
An iterative solver has contraction ratio q=0.9 instead of q=0.1 for the same problem. What happens?
Which pair of conditions guarantees the Banach fixed-point theorem applies?