ACE 328/Chapter 2

Metric Spaces

Spaces equipped with a notion of distance. The metric gives rise to a topology through open balls. Includes standard examples, norms, and the metric topology.

In the previous chapter, we took the abstract viewpoint: a topology is any collection of subsets satisfying three axioms. But almost every space that appears in practice carries an additional piece of data — a way to measure distance between points. This chapter introduces metric spaces, in which a distance function is given and a topology arises automatically from it.

The key observation is one we already saw in Rn\mathbb{R}^n: once you have a notion of distance, you can define open balls, and once you have open balls, you can say which sets are "open" — namely, those sets in which every point sits inside some small ball contained in the set. This construction generalizes from Rn\mathbb{R}^n to any set equipped with a suitable distance function.


The Definition of a Metric

DefinitionMetric Space

Let XX be a nonempty set. A function d:X×XRd : X \times X \to \mathbb{R} is called a distance (or metric) on XX if it satisfies the following four axioms:

  1. Non-negativity and definiteness: d(x,y)0d(x, y) \ge 0 for all x,yXx, y \in X, and d(x,y)=0    x=yd(x, y) = 0 \iff x = y.
  2. Symmetry: d(x,y)=d(y,x)d(x, y) = d(y, x) for all x,yXx, y \in X.
  3. Triangle inequality: d(x,z)d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z) for all x,y,zXx, y, z \in X.

The pair (X,d)(X, d) is called a metric space.

Remark.

Intuition: These axioms extract the bare minimum from our geometric intuition of distance. Non-negativity and definiteness say "distance is zero exactly between identical points." Symmetry says "the distance from xx to yy equals the distance from yy to xx." The triangle inequality says "it's never shorter to detour through a third point." Any function obeying these three rules is, for our purposes, a perfectly good notion of distance — even if it looks exotic.

Remark.

Some authors split axiom 1 into two separate axioms (non-negativity; d(x,y)=0d(x,y)=0 iff x=yx=y), giving four axioms total. Either formulation is standard. Occasionally one sees a weaker object called a pseudometric, which drops the "d(x,y)=0    x=yd(x,y)=0 \implies x=y" half of axiom 1.


Examples of Metrics

ExampleThe Euclidean Metric on R to the n

On Rn\mathbb{R}^n, the Euclidean metric is d2(x,y)=xy=(j=1n(xjyj)2)1/2.d_2(\boldsymbol{x}, \boldsymbol{y}) = \|\boldsymbol{x} - \boldsymbol{y}\| = \left( \sum_{j=1}^n (x_j - y_j)^2 \right)^{1/2}. Non-negativity, definiteness, and symmetry are clear. The triangle inequality follows from the Cauchy–Schwarz inequality and is the content of the classical "triangle inequality for the Euclidean norm." When n=1n = 1 this reduces to d2(x,y)=xyd_2(x, y) = |x - y|.

ExampleThe Discrete Metric

Let XX be any nonempty set. Define d(x,y)={0if x=y,1if xy.d(x, y) = \begin{cases} 0 & \text{if } x = y, \\ 1 & \text{if } x \ne y. \end{cases} This is the discrete metric on XX. Axioms 1 and 2 are obvious. For the triangle inequality d(x,z)d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z): if x=zx = z then the left side is 0. If xzx \ne z then the left side is 1, and at least one of yxy \ne x or yzy \ne z must hold (otherwise x=y=zx = y = z), so the right side is at least 1.

The discrete metric regards every pair of distinct points as being "at distance 1" — it is as if every point were isolated on its own island.

ExampleThe Taxicab (L^1) Metric on R to the n

On Rn\mathbb{R}^n, define d1(x,y)=j=1nxjyj.d_1(\boldsymbol{x}, \boldsymbol{y}) = \sum_{j=1}^n |x_j - y_j|. This is called the taxicab metric or 1\ell^1 metric or Manhattan metric (because it measures distance as if one must travel along a grid of city blocks). Non-negativity, definiteness, and symmetry are clear. The triangle inequality follows from the triangle inequality for absolute values applied coordinate-by-coordinate: xjzjxjyj+yjzj,|x_j - z_j| \le |x_j - y_j| + |y_j - z_j|, then summing over jj.

ExampleThe Max (L^infinity) Metric on R to the n

On Rn\mathbb{R}^n, define d(x,y)=max1jnxjyj.d_\infty(\boldsymbol{x}, \boldsymbol{y}) = \max_{1 \le j \le n} |x_j - y_j|. This is the max metric or sup metric or \ell^\infty metric. Non-negativity, definiteness, and symmetry are clear. For the triangle inequality, for each jj, xjzjxjyj+yjzjd(x,y)+d(y,z).|x_j - z_j| \le |x_j - y_j| + |y_j - z_j| \le d_\infty(\boldsymbol{x}, \boldsymbol{y}) + d_\infty(\boldsymbol{y}, \boldsymbol{z}). Taking the maximum over jj on the left gives d(x,z)d(x,y)+d(y,z)d_\infty(\boldsymbol{x}, \boldsymbol{z}) \le d_\infty(\boldsymbol{x}, \boldsymbol{y}) + d_\infty(\boldsymbol{y}, \boldsymbol{z}).

ExampleThe L^p Metric on R to the n

More generally, for p[1,)p \in [1, \infty), the p\ell^p metric on Rn\mathbb{R}^n is dp(x,y)=(j=1nxjyjp)1/p.d_p(\boldsymbol{x}, \boldsymbol{y}) = \left( \sum_{j=1}^n |x_j - y_j|^p \right)^{1/p}. This recovers the taxicab metric when p=1p = 1 and the Euclidean metric when p=2p = 2. As pp \to \infty it approaches the max metric. Proving the triangle inequality for general pp requires Minkowski's inequality, a nontrivial result whose proof typically uses the Hölder inequality.

ExampleThe Restricted (Subspace) Metric

If (X,d)(X, d) is a metric space and AXA \subseteq X is a nonempty subset, then (A,dA×A)(A, d|_{A \times A}) is again a metric space. This is immediate — restricting a metric to a subset preserves all four axioms. For instance, the open interval (0,1)(0,1) is a metric space under the restricted Euclidean metric d(x,y)=xyd(x,y) = |x-y|.


Open Balls and the Metric Topology

In a metric space, the distance function lets us define "open balls," and these in turn generate a topology.

DefinitionOpen Ball

Let (X,d)(X, d) be a metric space. For xXx \in X and r>0r > 0, the open ball of radius rr centered at xx is B(x,r)={yX:d(x,y)<r}.B(x, r) = \{ y \in X : d(x, y) < r \}.

TheoremThe Metric Topology

Let (X,d)(X, d) be a metric space. The collection Td={ΩX:xΩ,ρ>0 such that B(x,ρ)Ω}\mathcal{T}_d = \{ \Omega \subseteq X : \forall x \in \Omega, \, \exists \rho > 0 \text{ such that } B(x, \rho) \subseteq \Omega \} is a topology on XX. It is called the metric topology on (X,d)(X, d).

Remark.

Intuition: The metric topology encodes "openness" in the familiar sense: Ω\Omega is open iff around every point of Ω\Omega we have a little buffer region (an open ball) that still sits inside Ω\Omega. The definition of the Euclidean topology on Rn\mathbb{R}^n was just the special case of the metric topology for the Euclidean metric.

PropositionOpen Balls are Open

In any metric space (X,d)(X, d), every open ball B(x,r)B(x, r) is an open set (i.e., belongs to Td\mathcal{T}_d).

Neighbourhoods in a Metric Space

PropositionNeighbourhoods in the Metric Topology

Let (X,d)(X, d) be a metric space with metric topology Td\mathcal{T}_d, and let xXx \in X. Then VXV \subseteq X is a neighbourhood of xx in Td\mathcal{T}_d if and only if there exists ρ>0\rho > 0 such that B(x,ρ)VB(x, \rho) \subseteq V.

Remark.

Intuition: In a metric space, open balls are the "canonical" neighbourhoods. Any neighbourhood must contain some small open ball, and any set that contains an open ball around xx is automatically a neighbourhood of xx.

Metric Spaces are Hausdorff

PropositionEvery Metric Space is Hausdorff

If (X,d)(X, d) is a metric space, then (X,Td)(X, \mathcal{T}_d) is a Hausdorff topological space.

Remark.

Intuition: The triangle inequality is exactly what lets us take two balls around two distinct points and shrink them so they don't overlap. This is why metric spaces are always "nice" in the separation sense, unlike exotic non-Hausdorff topologies such as (R,Tlsc)(\mathbb{R}, \mathcal{T}_{\text{lsc}}) — no metric can induce that topology.

ExampleThe Discrete Metric Induces the Discrete Topology

Let (X,d)(X, d) be a discrete metric space. For any xXx \in X, the ball B(x,12)={x}B(x, \tfrac{1}{2}) = \{x\}, since the only point at distance less than 12\tfrac{1}{2} from xx is xx itself (every other point is at distance exactly 1). Thus every singleton {x}\{x\} is open in Td\mathcal{T}_d. Since every subset AXA \subseteq X can be written as a union A=xA{x}A = \bigcup_{x \in A} \{x\} of open singletons, every subset is open. Hence Td=2X\mathcal{T}_d = 2^X is the discrete topology.


Equivalent Metrics

Two different metrics can induce the same topology. This turns out to be more important than which specific metric one uses — topological properties (continuity, compactness, convergence of sequences) depend only on the topology, not on the particular distance function.

DefinitionEquivalent Metrics

Let XX be a nonempty set and let d,dd, d' be two metrics on XX. We say dd and dd' are topologically equivalent (or simply equivalent) if they induce the same topology: Td=Td\mathcal{T}_d = \mathcal{T}_{d'}.

A useful sufficient condition for equivalence is the existence of two-sided bounds between the metrics:

PropositionStrongly Equivalent Metrics are Equivalent

Let d,dd, d' be two metrics on XX. Suppose there exist constants c,C>0c, C > 0 such that cd(x,y)d(x,y)Cd(x,y)for all x,yX.c \cdot d(x, y) \le d'(x, y) \le C \cdot d(x, y) \qquad \text{for all } x, y \in X. Then Td=Td\mathcal{T}_d = \mathcal{T}_{d'}.

ExampleThe L^1, L^2, and L^infinity Metrics on R^n are All Equivalent

On Rn\mathbb{R}^n, the metrics d1d_1, d2d_2, dd_\infty are all topologically equivalent. We show this via the elementary chain of inequalities d(x,y)d2(x,y)d1(x,y)nd(x,y).d_\infty(\boldsymbol{x}, \boldsymbol{y}) \le d_2(\boldsymbol{x}, \boldsymbol{y}) \le d_1(\boldsymbol{x}, \boldsymbol{y}) \le n \cdot d_\infty(\boldsymbol{x}, \boldsymbol{y}).

Proof of the chain. Let aj=xjyja_j = |x_j - y_j|.

  • dd2d_\infty \le d_2: maxjaj=(maxjaj)2jaj2=d2\max_j a_j = \sqrt{(\max_j a_j)^2} \le \sqrt{\sum_j a_j^2} = d_2.
  • d2d1d_2 \le d_1: this follows from jaj2(jaj)2\sum_j a_j^2 \le (\sum_j a_j)^2 because the cross-terms 2aiaj2 a_i a_j are non-negative.
  • d1ndd_1 \le n \, d_\infty: jajnmaxjaj\sum_j a_j \le n \cdot \max_j a_j.

Thus all three metrics are pairwise strongly equivalent and induce the same topology — namely, the Euclidean topology E\mathcal{E}.

Remark.

Intuition: Different metrics can have different-looking "balls" (the 1\ell^1 unit ball is a diamond, the 2\ell^2 unit ball is a disk, the \ell^\infty unit ball is a square), but as long as balls of each type can be sandwiched between balls of the other, the open sets they generate are identical. The take-away: for topological questions on Rn\mathbb{R}^n (continuity, convergence, openness), the choice of pp in p\ell^p does not matter.


Product Metrics

Given two metric spaces, we can form a metric on their Cartesian product in several natural ways.

DefinitionProduct Metrics

Let (X,dX)(X, d_X) and (Y,dY)(Y, d_Y) be metric spaces. On X×YX \times Y, define three candidate product metrics:

  • d1prod((x1,y1),(x2,y2))=dX(x1,x2)+dY(y1,y2),d_1^{\text{prod}}((x_1, y_1), (x_2, y_2)) = d_X(x_1, x_2) + d_Y(y_1, y_2),
  • d2prod((x1,y1),(x2,y2))=dX(x1,x2)2+dY(y1,y2)2,d_2^{\text{prod}}((x_1, y_1), (x_2, y_2)) = \sqrt{d_X(x_1, x_2)^2 + d_Y(y_1, y_2)^2},
  • dprod((x1,y1),(x2,y2))=max{dX(x1,x2),dY(y1,y2)}.d_\infty^{\text{prod}}((x_1, y_1), (x_2, y_2)) = \max\{d_X(x_1, x_2), \, d_Y(y_1, y_2)\}.

Each of these is a metric on X×YX \times Y, and all three are topologically equivalent.

Remark.

Intuition: The product metrics are exactly the analogs of d1d_1, d2d_2, dd_\infty on Rn\mathbb{R}^n, applied here to the "coordinates" dX(x1,x2)d_X(x_1, x_2) and dY(y1,y2)d_Y(y_1, y_2). Since all three are equivalent, there is a single well-defined product topology on X×YX \times Y. A sequence ((xn,yn))((x_n, y_n)) converges in any one of these product metrics if and only if xnxx_n \to x in (X,dX)(X, d_X) and ynyy_n \to y in (Y,dY)(Y, d_Y) simultaneously.


Isometries and Contractions

Metric spaces come with a natural notion of "distance-preserving" or "distance-shrinking" maps.

DefinitionIsometry

Let (X,dX)(X, d_X) and (Y,dY)(Y, d_Y) be metric spaces. A function f:XYf : X \to Y is called an isometry if dY(f(x1),f(x2))=dX(x1,x2)for all x1,x2X.d_Y(f(x_1), f(x_2)) = d_X(x_1, x_2) \qquad \text{for all } x_1, x_2 \in X. If an isometry ff is also a bijection, we say (X,dX)(X, d_X) and (Y,dY)(Y, d_Y) are isometric.

Remark.

Intuition: An isometry is a rigid embedding — it sends XX into YY while preserving distances exactly. Rotations, reflections, and translations of Rn\mathbb{R}^n are isometries of (Rn,d2)(\mathbb{R}^n, d_2). Two isometric metric spaces are indistinguishable from the metric point of view. Every isometry is automatically injective (if f(x1)=f(x2)f(x_1) = f(x_2), then dX(x1,x2)=dY(f(x1),f(x2))=0d_X(x_1, x_2) = d_Y(f(x_1), f(x_2)) = 0, so x1=x2x_1 = x_2).

PropositionIsometries are Continuous

Every isometry f:(X,dX)(Y,dY)f : (X, d_X) \to (Y, d_Y) is continuous with respect to the metric topologies.

DefinitionContraction

Let (X,d)(X, d) be a metric space. A function f:XXf : X \to X is called a contraction (or contractive map) if there exists a constant 0k<10 \le k < 1 such that d(f(x),f(y))kd(x,y)for all x,yX.d(f(x), f(y)) \le k \cdot d(x, y) \qquad \text{for all } x, y \in X. The constant kk is called the contraction constant or Lipschitz constant.

Remark.

Intuition: A contraction shrinks all distances by a uniform factor strictly less than 1. Think of repeatedly applying f(x)=x/2f(x) = x/2 on R\mathbb{R}: iterating the map drives every point toward a single fixed point (the origin). This behaviour is general and is the content of the Banach Fixed-Point Theorem: on a complete metric space, every contraction has a unique fixed point, and iterating from any starting point converges to it. The Banach fixed-point theorem is the mathematical engine behind existence/uniqueness of solutions to ODEs, Markov chain convergence, and many practical iterative algorithms.

PropositionContractions are Continuous

Every contraction f:(X,d)(X,d)f : (X, d) \to (X, d) is continuous.


Continuity in Metric Spaces: the Familiar ε\varepsilon-δ\delta

The topological definition of continuity simplifies dramatically when both spaces are metric.

TheoremEpsilon-Delta Characterization of Continuity

Let (X,dX)(X, d_X) and (Y,dY)(Y, d_Y) be metric spaces, equipped with their metric topologies. Let AXA \subseteq X and f:AYf : A \to Y. Let aAa \in A. Then ff is continuous at aa if and only if ε>0,δ>0 such that dY(f(x),f(a))<ε for all xA with dX(x,a)<δ.\forall \varepsilon > 0, \, \exists \delta > 0 \text{ such that } d_Y(f(x), f(a)) < \varepsilon \text{ for all } x \in A \text{ with } d_X(x, a) < \delta.

Remark.

Intuition: In metric spaces, "neighbourhood" can always be replaced by "open ball of some radius," so the general topological condition collapses to the familiar ε\varepsilon-δ\delta formulation from first-year calculus. When X=RnX = \mathbb{R}^n and Y=RmY = \mathbb{R}^m with their Euclidean metrics, this is exactly the definition you have seen before: limxaf(x)=λ    ε>0δ>0:f(x)λRm<ε whenever xA,0<xaRn<δ.\lim_{\boldsymbol{x} \to \boldsymbol{a}} \boldsymbol{f}(\boldsymbol{x}) = \boldsymbol{\lambda} \iff \forall \varepsilon > 0 \, \exists \delta > 0 : \|\boldsymbol{f}(\boldsymbol{x}) - \boldsymbol{\lambda}\|_{\mathbb{R}^m} < \varepsilon \text{ whenever } \boldsymbol{x} \in A, \, 0 < \|\boldsymbol{x} - \boldsymbol{a}\|_{\mathbb{R}^n} < \delta.


Limits in Metric Spaces are Unique

TheoremUniqueness of Limits in Hausdorff Spaces

Let (X,T)(X, \mathcal{T}) and (Y,S)(Y, \mathcal{S}) be topological spaces with (Y,S)(Y, \mathcal{S}) Hausdorff. Let AXA \subseteq X, f:AYf : A \to Y, and let aa be an accumulation point of AA. If limxaf(x)=λ\lim_{x \to a} f(x) = \lambda and limxaf(x)=μ\lim_{x \to a} f(x) = \mu, then λ=μ\lambda = \mu.

CorollaryLimits in Metric Spaces are Unique

If (Y,dY)(Y, d_Y) is a metric space (with its metric topology), then every function f:AYf : A \to Y has at most one limit at each accumulation point of AA. In particular, limits of sequences in metric spaces are unique.

Remark.

Intuition: Uniqueness of limits is something we take for granted in calculus, but it's a nontrivial topological fact — it holds precisely because metric spaces are Hausdorff. In the non-Hausdorff topology (R,Tlsc)(\mathbb{R}, \mathcal{T}_{\text{lsc}}), limits are genuinely not unique (a function converging to λ\lambda also converges to every μλ\mu \le \lambda).


Cauchy Sequences and Completeness

We close with one of the most important concepts tied to metric spaces — one that does not have a purely topological formulation.

DefinitionCauchy Sequence

Let (X,d)(X, d) be a metric space. A sequence (an)n1(a_n)_{n \ge 1} in XX is called a Cauchy sequence if and only if ε>0,N1 such that d(an,am)<ε for all n,mN.\forall \varepsilon > 0, \, \exists N \ge 1 \text{ such that } d(a_n, a_m) < \varepsilon \text{ for all } n, m \ge N.

Remark.

Intuition: A Cauchy sequence is one whose terms eventually get arbitrarily close to each other — no reference to a limit point is made. Contrast this with convergence, which requires the terms to get close to a specific point.

PropositionConvergent Implies Cauchy

Every convergent sequence in a metric space is Cauchy.

DefinitionComplete Metric Space

A metric space (X,d)(X, d) is called complete if and only if every Cauchy sequence in XX converges (to a point in XX).

ExampleExamples and Non-Examples of Completeness
  • R\mathbb{R} with the Euclidean metric is complete (the core theorem from MATH/MTHE 281). More generally, Rn\mathbb{R}^n with any of d1,d2,dd_1, d_2, d_\infty is complete.
  • Q\mathbb{Q} with d(x,y)=xyd(x, y) = |x - y| is not complete. For instance, an=(1+1n)nQa_n = (1 + \tfrac{1}{n})^n \in \mathbb{Q} defines a Cauchy sequence in Q\mathbb{Q}, but its limit is eQe \notin \mathbb{Q}.
  • The open interval X=(0,1)X = (0, 1) with d(x,y)=xyd(x, y) = |x - y| is not complete. The sequence an=1na_n = \tfrac{1}{n} is Cauchy but its limit 00 is not in XX.
  • The closed interval [0,1][0, 1] with d(x,y)=xyd(x, y) = |x - y| is a complete metric space. (It is a closed subset of the complete space R\mathbb{R}.)
Remark.

Why completeness matters. Completeness is the property that lets us do analysis: it guarantees that "reasonable" sequences (those whose terms bunch up) have limits. Without completeness, many theorems fail — for example, in Q\mathbb{Q} you cannot build 2\sqrt{2} as the limit of a sequence of rationals that "should" converge to it. The Baire Category Theorem, the contraction mapping principle (Banach fixed-point theorem), and existence of solutions to differential equations all rely crucially on the underlying space being complete.

Remark.

Completeness is metric-dependent, not topological. Two equivalent metrics can differ in completeness: (0,1)(0, 1) with d(x,y)=xyd(x,y) = |x-y| is not complete, but (0,1)(0,1) is homeomorphic to R\mathbb{R} (via, e.g., xtan(π(x12))x \mapsto \tan(\pi(x - \tfrac{1}{2}))), and R\mathbb{R} is complete. So completeness is a property of the metric, not just the topology it induces.


Looking Ahead

Equipped with a metric, a space inherits a topology "for free," and many familiar notions from calculus — continuity, convergence, completeness — become available. The next chapter examines how the basic topological building blocks (interior, closure, boundary) behave on the metric side, and develops the language of dense sets, nowhere dense sets, and accumulation points that we'll need to state and prove deeper results such as the Baire Category Theorem.