Introduction to Metric Spaces
Everything in
analysis
rested on one tool: the distance |x - y| between real numbers. Strip that
idea down to its essential rules and you can run the same arguments — limits, continuity, completeness —
on points that are functions, sequences, or vectors. The abstraction is the metric space.
A metric on a set X is a function
d : X \times X \to [0, \infty) assigning a distance to each pair of points,
subject to three axioms. For all x, y, z \in X:
\textbf{(M1)} \;\; d(x, y) \ge 0, \quad \text{and} \quad d(x, y) = 0 \iff x = y \qquad (\text{positivity / identity}),
\textbf{(M2)} \;\; d(x, y) = d(y, x) \qquad (\text{symmetry}),
\textbf{(M3)} \;\; d(x, z) \le d(x, y) + d(y, z) \qquad (\text{the triangle inequality}).
The pair (X, d) is a metric space. The triangle inequality
is the load-bearing one — it is what makes "close to close is close" true, and hence what makes limits
behave.
Three metrics to keep in mind
-
\mathbb{R} with the absolute value:
d(x, y) = |x - y|. The ordinary number line — the special case all the
others generalise.
-
\mathbb{R}^n with the Euclidean metric:
d_2(x, y) = \sqrt{\sum_{i=1}^{n} (x_i - y_i)^2}. Straight-line ("as the
crow flies") distance.
-
Functions with the sup metric: on the continuous functions on
[a, b],
d_\infty(f, g) = \sup_{x} |f(x) - g(x)|. Two functions are "close" when
their graphs are everywhere close — exactly the
uniform distance, now
recognised as a genuine metric.
Centrepiece: the Euclidean metric obeys the triangle inequality
Positivity and symmetry are immediate for d_2 (a square root of a sum of
squares is \ge 0 and vanishes only when every coordinate matches; swapping
x and y changes nothing). The real work is the
triangle inequality. Write it with displacement vectors
u = x - y and v = y - z, so that
x - z = u + v and the claim becomes
\|u + v\| \le \|u\| + \|v\|.
Step 1 — square the target. Both sides are non-negative, so it suffices to compare
their squares. Expand using the dot product:
\|u + v\|^2 = (u + v) \cdot (u + v) = \|u\|^2 + 2\,(u \cdot v) + \|v\|^2.
Step 2 — bound the cross term by Cauchy–Schwarz. The one fact we borrow is the
Cauchy–Schwarz inequality |u \cdot v| \le \|u\|\,\|v\|. In particular
u \cdot v \le \|u\|\,\|v\|, so
\|u + v\|^2 \le \|u\|^2 + 2\,\|u\|\,\|v\| + \|v\|^2.
Step 3 — recognise a perfect square. The right-hand side is
(\|u\| + \|v\|)^2:
\|u + v\|^2 \le \big(\|u\| + \|v\|\big)^2.
Step 4 — take square roots. Both sides are non-negative, and the square root is
increasing, so
\|u + v\| \le \|u\| + \|v\|.
Step 5 — translate back to distances. Substituting
u = x - y and v = y - z gives exactly (M3):
d_2(x, z) = \|x - z\| \le \|x - y\| + \|y - z\| = d_2(x, y) + d_2(y, z).
So Euclidean distance is a genuine metric. Geometrically this is the schoolroom fact that
any side of a triangle is at most the sum of the other two — a detour through
y is never shorter than the straight path.
The vocabulary, generalised
With a metric in hand, the basic notions of analysis transplant verbatim — every
|x - y| becomes d(x, y).
-
Open ball: B(x, r) = \{\, y \in X : d(x, y) < r \,\} — all
points within radius r of x.
-
Open set: a set U such that every point of
U has some ball B(x, r) \subseteq U around it —
the metric's version of "no boundary points included".
-
Convergence: x_n \to x means
d(x_n, x) \to 0.
Cauchy = convergent becomes completeness. Recall that on the
real line a sequence
converges iff it is Cauchy — its terms eventually crowd together. A general
(x_n) is Cauchy when
d(x_m, x_n) \to 0 as m, n \to \infty. Crowding
together does not by itself guarantee a limit inside the space — the rationals are Cauchy
toward \sqrt{2}, which is not rational. A metric space in which every
Cauchy sequence does converge to a point of the space is called complete:
(X, d) \text{ complete} \;\;\iff\;\; \big[\, (x_n) \text{ Cauchy} \Rightarrow x_n \to x \text{ for some } x \in X \,\big].
"\mathbb{R} is complete" is precisely the no-holes property of the reals,
now seen as one instance of a property any metric space may or may not have.
A metric space is a pair (X, d) with
d : X \times X \to [0, \infty) satisfying, for all
x, y, z:
-
(M1) Positivity / identity: d(x, y) \ge 0, and
d(x, y) = 0 \iff x = y.
- (M2) Symmetry: d(x, y) = d(y, x).
-
(M3) Triangle inequality:
d(x, z) \le d(x, y) + d(y, z).
-
The Euclidean metric on \mathbb{R}^n, the absolute value on
\mathbb{R}, and the sup metric on
C[a, b] are all metrics. (X, d) is
complete when every Cauchy sequence converges within X.
Completeness is not just tidy bookkeeping — it manufactures solutions out of thin air. A map
T : X \to X on a metric space is a contraction if it
shrinks all distances by a fixed factor q < 1:
d\big(T(x), T(y)\big) \le q\,d(x, y), \qquad 0 \le q < 1.
Banach's contraction mapping theorem: on a complete metric space, a
contraction has exactly one fixed point x^* = T(x^*), and
the iterates x_{n+1} = T(x_n) converge to it from any starting
point. The proof is pure metric-space reasoning: the iterates form a Cauchy sequence (successive gaps
shrink geometrically like q^n), completeness supplies the limit, and
continuity pins it as the fixed point.
This single theorem is an existence engine. Cast "solve the differential equation
y' = f(x, y)" as a fixed point of an integral operator on the complete
space C[a, b] with the sup metric; the contraction theorem then yields a
unique solution — that is the Picard–Lindelöf existence theorem for ODEs. The same
move proves the inverse function theorem and underlies countless numerical iterations.
The shape of "within radius r"
An open ball B(0, r) looks completely different depending on the metric. In
the Euclidean metric d_2 it is the familiar disc. In the
taxicab metric d_1(x, y) = |x_1 - y_1| + |x_2 - y_2| — distance
as a grid-walking taxi must travel — the ball is a diamond. Slide the radius and watch
both grow; both are perfectly valid metrics.