Skip to content

Metric Spaces

Definition. A metric space is a pair (M,d)(M, d) where MM is a set and d:M×M[0,)d : M \times M \to [0, \infty) satisfies, for all x,y,zMx, y, z \in M:

  1. Non-negativity: d(x,y)0d(x, y) \geq 0, with equality iff x=yx = y.
  2. Symmetry: d(x,y)=d(y,x)d(x, y) = d(y, x).
  3. Triangle inequality: d(x,z)d(x,y)+d(y,z)d(x, z) \leq d(x, y) + d(y, z).

Every metric induces a topology: the open sets are unions of open balls Br(p)={x:d(x,p)<r}B_r(p) = \{x : d(x, p) < r\}.

Example 7.1 (Euclidean metric). On Rn\mathbb{R}^n:

d2(x,y)=i=1n(xiyi)2.d_2(\mathbf{x}, \mathbf{y}) = \sqrt{\sum_{i=1}^{n} (x_i - y_i)^2}.

Example 7.2 (pp-norm metrics). For 1p1 \leq p \leq \infty:

dp(x,y)=(i=1nxiyip)1/p,d(x,y)=max1inxiyi.d_p(\mathbf{x}, \mathbf{y}) = \left(\sum_{i=1}^{n} |x_i - y_i|^p\right)^{1/p}, \qquad d_\infty(\mathbf{x}, \mathbf{y}) = \max_{1 \leq i \leq n} |x_i - y_i|.

All of these induce the standard topology on Rn\mathbb{R}^n.

Example 7.3 (Discrete metric). For any set XX:

d(x,y)={0if x=y,1if xy.d(x, y) = \begin{cases} 0 & \text{if } x = y, \\ 1 & \text{if } x \neq y. \end{cases}

The discrete metric induces the discrete topology.

Definition. A sequence (xn)(x_n) in (M,d)(M, d) converges to xMx \in M (written xnxx_n \to x) if for every ε>0\varepsilon > 0 there exists NN such that d(xn,x)<εd(x_n, x) < \varepsilon for all nNn \geq N.

Proposition 7.1. In a metric space, xnxx_n \to x if and only if for every open neighbourhood UU of xx, there exists NN with xnUx_n \in U for all nNn \geq N.

Limits in metric spaces are unique (this follows from the Hausdorff property).

Definition. A sequence (xn)(x_n) is Cauchy if for every ε>0\varepsilon > 0 there exists NN such that d(xm,xn)<εd(x_m, x_n) < \varepsilon for all m,nNm, n \geq N.

Every convergent sequence is Cauchy. The converse need not hold.

Definition. A metric space (M,d)(M, d) is complete if every Cauchy sequence converges.

Example 7.4. Rn\mathbb{R}^n with the Euclidean metric is complete.

Example 7.5. Q\mathbb{Q} with d(x,y)=xyd(x, y) = |x - y| is not complete: the Cauchy sequence 3,3.1,3.14,3.141,3.1415,3, 3.1, 3.14, 3.141, 3.1415, \ldots does not converge in Q\mathbb{Q}.

Proposition 7.2. A closed subset of a complete metric space is complete.

Definition. A Banach space is a complete normed vector space.

Example 7.6. (C([a,b]),)(C([a, b]), \|\cdot\|_\infty) — the space of continuous functions on [a,b][a, b] with the sup norm — is a Banach space.

Definition. A map f:MMf : M \to M is a contraction if there exists 0c<10 \leq c < 1 such that d(f(x),f(y))cd(x,y)d(f(x), f(y)) \leq c \cdot d(x, y) for all x,yMx, y \in M.

Theorem 5.6 (Banach Fixed Point Theorem). If (M,d)(M, d) is a complete metric space and f:MMf : M \to M is a contraction, then ff has a unique fixed point xx^*, and for any x0Mx_0 \in M, the iteration xn+1=f(xn)x_{n+1} = f(x_n) converges to xx^*.

Proof. For any x0x_0, the sequence xn=fn(x0)x_n = f^n(x_0) is Cauchy (by repeated application of the contraction condition), hence converges to some xx^*. By continuity of ff, x=f(x)x^* = f(x^*). Uniqueness follows from the contraction condition: if x=f(x)x^* = f(x^*) and y=f(y)y^* = f(y^*), then d(x,y)=d(f(x),f(y))cd(x,y)d(x^*, y^*) = d(f(x^*), f(y^*)) \leq c \cdot d(x^*, y^*), so d(x,y)=0d(x^*, y^*) = 0. \square

7.6 Key Relationships Between Metric Spaces

Section titled “7.6 Key Relationships Between Metric Spaces”
PropertyDefinitionExample
Metric spaceSet + distance function satisfying triangle ineqRn\mathbb{R}^n with d2d_2
Complete metricEvery Cauchy sequence convergesRn\mathbb{R}^n, C([a,b])C([a,b])
Compact metricEvery open cover has finite subcover[0,1][0,1] with Euclidean metric
Connected metricCannot be partitioned into two disjoint open setsRn\mathbb{R}^n, any interval
Totally boundedFor every ε>0\varepsilon > 0, finite ε\varepsilon-net[0,1][0,1] but not R\mathbb{R}

Compact \Rightarrow complete and totally bounded. Complete + totally bounded \Rightarrow compact.

  • Assuming all metrics come from a norm. The discrete metric does not come from any norm (norms are homogeneous: αx=αx\|\alpha x\| = |\alpha|\|x\|, but d(αx,0)=1d(\alpha x, 0) = 1 for α0\alpha \neq 0).
  • Confusing completeness with closedness. A subset of a metric space can be closed but not complete (if the ambient space is not complete), and complete but not closed (if complete in a subspace topology).
  • Thinking contractions require d(f(x),f(y))<d(x,y)d(f(x), f(y)) < d(x, y) for all xyx \neq y. This is weaker and does not guarantee a fixed point. The strict inequality d(f(x),f(y))cd(x,y)d(f(x), f(y)) \leq c d(x, y) with c<1c < 1 is essential.
  • Forgetting that convergence of sequences is not enough in general topology. In metric spaces sequential convergence characterises the topology, but in general topological spaces nets or filters are needed.
  • Numerical analysis: The Banach fixed-point theorem justifies iterative methods like Newton’s method and Picard iterations for ODEs.
  • Computer science: Metric spaces model edit distances (Levenshtein, Hamming) for string matching and bioinformatics sequence alignment.
  • Image processing: The Hausdorff distance measures similarity between shapes and is used in computer vision for template matching.
  • Functional analysis: C([a,b])C([a,b]) with the sup norm is a complete metric space, providing the setting for the Stone-Weierstrass approximation theorem.

Problem 1. Show that Rn\mathbb{R}^n with the Euclidean metric is complete.

Solution. Let {xk}\{x_k\} be a Cauchy sequence in Rn\mathbb{R}^n. Then each coordinate sequence {xk(i)}\{x_k^{(i)}\} is Cauchy in R\mathbb{R} (since xk(i)x(i)d2(xk,x)|x_k^{(i)} - x_\ell^{(i)}| \leq d_2(x_k, x_\ell)). R\mathbb{R} is complete, so each coordinate converges to x(i)x^{(i)}. Then xkxx_k \to x componentwise, and by the triangle inequality d2(xk,x)0d_2(x_k, x) \to 0. \blacksquare

Problem 2. Let X=(0,1)X = (0,1) with d(x,y)=xyd(x,y) = |x-y|. Show XX is not complete.

Solution. The sequence xn=1/nx_n = 1/n is Cauchy: for any ε>0\varepsilon > 0, choose N>2/εN > 2/\varepsilon, then for m,nNm,n \geq N, 1/m1/n1/m+1/n2/N<ε|1/m - 1/n| \leq 1/m + 1/n \leq 2/N < \varepsilon. But xn0(0,1)x_n \to 0 \notin (0,1), so the sequence does not converge in XX. Thus (0,1)(0,1) with the Euclidean metric is not complete. However, [0,1][0,1] is complete (closed subset of complete R\mathbb{R}). \blacksquare