The Metric Topology

Topology threw distances away. This page brings them back, as one very important way to produce a topology. Every space from calculus and analysis ($\mathbb{R}^n$, spaces of functions, spaces of sequences) gets its topology from a distance function. Metric spaces are also where sequences finally become as powerful as they were in calculus.

Metrics and Balls

A metric is anything that behaves like distance.

A metric on a set $X$ is a function $$d: X \times X \to \mathbb{R}^+ \cup \{0\}$$ with the following properties:

  1. $d(x, y) \ge 0$ for all $x, y \in X$, and equality holds if and only if $x = y$;
  2. $d(x, y) = d(y, x)$ for all $x, y \in X$;
  3. $d(x, z) \le d(x, y) + d(y, z)$ for all $x, y, z \in X$ (the triangle inequality).

Given a metric $d$ on $X$, the number $d(x, y)$ is called the distance between $x$ and $y$.

The open intervals of $\mathbb{R}$ generalize to balls.

Given $\varepsilon > 0$, the set $$B_d(x, \varepsilon) = \{y \in X : d(x, y) < \varepsilon\}$$ of all points $y$ whose distance from $x$ is less than $\varepsilon$ is called the $\varepsilon$-ball centered at $x$.

And the balls form a basis.

If $d$ is a metric on $X$, then the collection of all $\varepsilon$-balls $B_d(x, \varepsilon)$, for $x \in X$ and $\varepsilon > 0$, is a basis for a topology on $X$, called the metric topology induced by $d$.

(Why is it a basis? If $y \in B_d(x, \varepsilon)$, set $\delta = \varepsilon - d(x, y)$; by the triangle inequality, $B_d(y, \delta) \subset B_d(x, \varepsilon)$. So every point of a ball has a smaller ball around it inside, and two overlapping balls have a small ball around any common point.) Some examples of metrics.

Describe the metric topologies of $d(x, y) = |x - y|$ on $\mathbb{R}$, and of the discrete metric on any set $X$: $d(x, y) = 1$ if $x \neq y$ and $d(x, x) = 0$.


For $|x - y|$, the balls are the open intervals $B(x, \varepsilon) = (x - \varepsilon, x + \varepsilon)$, so the metric topology is the standard topology.

For the discrete metric, $B(x, \frac{1}{2}) = \{x\}$. Every one-point set is open, so every set is open: the metric topology is the discrete topology.

A topological space doesn't come with a metric, but sometimes one is hiding.

Let $X$ be a topological space. $X$ is said to be metrizable if there exists a metric $d$ on the set $X$ that induces the topology of $X$.

When we've picked a specific metric, the pair gets its own name.

A metric space is a metrizable space $X$ together with a specific metric $d$ that gives the topology of $X$, often denoted $(X, d)$.

Not every space is metrizable. Every metric space is Hausdorff (Exercise 1), so for example the finite complement topology on $\mathbb{R}$ is not metrizable.

Size and Many Metrics

Distances let us measure how big a set is.

Let $(X, d)$ be a metric space. A subset $A \subset X$ is said to be bounded if there is some number $M$ such that $d(a_1, a_2) \le M$ for every pair $a_1, a_2 \in A$.

For a bounded set, the best such $M$ is its diameter.

If $A$ is bounded and nonempty, the diameter of $A$ is the number $$\operatorname{diam}(A) = \sup\{d(a_1, a_2) : a_1, a_2 \in A\}.$$

Boundedness is not a topological property. Any metric can be squashed to make everything bounded, without changing the open sets.

Let $(X, d)$ be a metric space. Define $\overline{d}: X \times X \to \mathbb{R}^+ \cup \{0\}$ by $$\overline{d}(x, y) = \min\{d(x, y), 1\}.$$ The metric $\overline{d}$ is called the standard bounded metric corresponding to $d$.

In the standard bounded metric, the distance from here to the Andromeda galaxy is $1$. Same as the distance from here to anything more than $1$ away. Road trips have never been easier.

The balls of radius less than $1$ are the same for $d$ and $\overline{d}$, and those small balls are enough to form a basis, so $d$ and $\overline{d}$ induce the same topology. In $\mathbb{R}^n$ there are two standard metrics.

Given $x = (x_1, \dots, x_n) \in \mathbb{R}^n$, the norm of $x$ is defined by $$\lVert x \rVert = (x_1^2 + \dots + x_n^2)^{1/2}.$$

The norm measures length, so differences of points measure distance.

The Euclidean metric $d$ on $\mathbb{R}^n$ is defined by $$d(x, y) = \lVert x - y \rVert = \big[(x_1 - y_1)^2 + \dots + (x_n - y_n)^2\big]^{1/2}.$$

The other one only looks at the worst coordinate.

The square metric $\rho$ on $\mathbb{R}^n$ is defined by $$\rho(x, y) = \max\{|x_1 - y_1|, \dots, |x_n - y_n|\}.$$

Euclidean balls are round. Square-metric balls are, well, squares. Different balls, but do they give different topologies? The tool for deciding is the metric version of the comparison test for bases.

Let $d$ and $d'$ be two metrics on the set $X$, and let $\mathcal{T}$ and $\mathcal{T}'$ be the topologies they induce. Then $\mathcal{T}'$ is finer than $\mathcal{T}$ if and only if for each $x \in X$ and each $\varepsilon > 0$, there exists a $\delta > 0$ such that $$B_{d'}(x, \delta) \subset B_d(x, \varepsilon).$$

Show proof

Proof. Suppose $\mathcal{T}'$ is finer than $\mathcal{T}$. Given the basis element $B_d(x, \varepsilon)$ of $\mathcal{T}$, the comparison theorem for bases (from Topological Spaces & Bases) gives a basis element $B'$ of $\mathcal{T}'$ with $x \in B' \subset B_d(x, \varepsilon)$. Within $B'$ we can find a ball $B_{d'}(x, \delta)$ centered at $x$.

Conversely, suppose the $\delta$-$\varepsilon$ condition holds. Given a basis element $B$ of $\mathcal{T}$ containing $x$, we can find within $B$ a ball $B_d(x, \varepsilon)$ centered at $x$. The condition gives $\delta$ with $B_{d'}(x, \delta) \subset B_d(x, \varepsilon) \subset B$, so by the same comparison theorem, $\mathcal{T}'$ is finer than $\mathcal{T}$. $\blacksquare$

Apply it in both directions to the round and square balls in the plane.

Balls in Two Metrics

In general, $\rho(x, y) \le d(x, y) \le \sqrt{n}\, \rho(x, y)$ in $\mathbb{R}^n$, so a ball of either kind fits inside a ball of the other kind. The Euclidean and square metrics induce the same topology on $\mathbb{R}^n$, and it equals the product topology.

Two metrics can give the same topology while disagreeing wildly about distances. "Same topology" only needs small balls of each kind to fit inside balls of the other kind, with no control on how much smaller. Don't try to prove $d = d'$ when the question only asks about topologies.

For infinite products of $\mathbb{R}$, a sup-type metric gives a new topology.

Given an index set $J$ and points $x = (x_\alpha)_{\alpha \in J}$ and $y = (y_\alpha)_{\alpha \in J}$ of $\mathbb{R}^J$, define the metric $\overline{\rho}$ on $\mathbb{R}^J$ by $$\overline{\rho}(x, y) = \sup\{\overline{d}(x_\alpha, y_\alpha) : \alpha \in J\},$$ where $\overline{d}$ is the standard bounded metric on $\mathbb{R}$. $\overline{\rho}$ is called the uniform metric, and the topology it induces is the uniform topology.

The uniform topology on $\mathbb{R}^\omega$ is strictly finer than the product topology (a uniform ball controls every coordinate at once). But the product topology on $\mathbb{R}^\omega$ is still metrizable, using a cleverer metric that cares less and less about later coordinates.

Let $\overline{d}(a, b) = \min\{|a - b|, 1\}$ be the standard bounded metric on $\mathbb{R}$. If $x$ and $y$ are two points of $\mathbb{R}^\omega$, define $$D(x, y) = \sup\left\{\frac{\overline{d}(x_i, y_i)}{i}\right\}.$$ Then $D$ is a metric that induces the product topology on $\mathbb{R}^\omega$.

(The proof is omitted for now.) Dividing by $i$ is the trick: coordinates far down the sequence can never contribute more than $\frac{1}{i}$, so a $D$-ball of radius $\varepsilon$ only really restricts the coordinates with $i < \frac{1}{\varepsilon}$, finitely many, just like a product-topology basis element.

That's the "only finitely many coordinates" picture from the Product Topology page, now produced by a metric.

Continuity and Sequences

In metric spaces, continuity is literally the calculus definition.

Let $X$ and $Y$ be metrizable with metrics $d_X$ and $d_Y$, and let $f: X \to Y$. Then $f$ is continuous if and only if, given $x \in X$ and $\varepsilon > 0$, there exists $\delta > 0$ such that $$d_X(x, y) < \delta \implies d_Y(f(x), f(y)) < \varepsilon.$$

Show proof

Proof. Suppose $f$ is continuous. Given $x$ and $\varepsilon$, the set $f^{-1}(B(f(x), \varepsilon))$ is open in $X$ and contains $x$, so it contains some ball $B(x, \delta)$. If $y \in B(x, \delta)$, then $f(y) \in B(f(x), \varepsilon)$, as desired.

Conversely, suppose the $\varepsilon$-$\delta$ condition holds. Let $U$ be open in $Y$ and $x \in f^{-1}(U)$. Since $f(x) \in U$, there is a ball $B(f(x), \varepsilon) \subset U$. The condition gives $\delta$ with $f(B(x, \delta)) \subset B(f(x), \varepsilon) \subset U$. So $B(x, \delta)$ is a neighborhood of $x$ inside $f^{-1}(U)$. Since $x$ was arbitrary, $f^{-1}(U)$ is open, and $f$ is continuous. $\blacksquare$

The next lemma is why sequences are enough in metric spaces.

Let $X$ be a topological space and $A \subset X$. If there is a sequence of points of $A$ converging to $x$, then $x \in \overline{A}$. The converse holds if $X$ is metrizable.

Proof. Suppose $x_n \to x$ with every $x_n \in A$. Then every neighborhood $U$ of $x$ contains some $x_n$, a point of $A$, so $x \in \overline{A}$. Conversely, suppose $X$ is metrizable with metric $d$, and $x \in \overline{A}$. For each $n \in \mathbb{N}$, the neighborhood $B_d(x, \frac{1}{n})$ intersects $A$; choose $x_n$ in the intersection. Any open set $U$ containing $x$ contains some ball $B_d(x, \varepsilon)$. Choose $N$ with $\frac{1}{N} < \varepsilon$; then $x_i \in B_d(x, \frac{1}{i}) \subset U$ for all $i \ge N$. So $x_n \to x$. $\blacksquare$

The metric gave us a countable list of shrinking neighborhoods $B(x, \frac{1}{n})$, and that's what made the sequence possible. Same idea for continuity.

Let $f: X \to Y$. If $f$ is continuous, then for every convergent sequence $x_n \to x$ in $X$, the sequence $f(x_n) \to f(x)$. The converse holds if $X$ is metrizable.

Show proof

Proof. Assume $f$ is continuous and $x_n \to x$. Let $U$ be a neighborhood of $f(x)$. Then $f^{-1}(U)$ is a neighborhood of $x$, so there is $N$ with $x_n \in f^{-1}(U)$ for all $n \ge N$. Hence $f(x_n) \in U$ for $n \ge N$, and $f(x_n) \to f(x)$.

Conversely, assume $X$ is metrizable and the sequence condition holds. Let $A \subset X$ and $x \in \overline{A}$. By the sequence lemma there is a sequence $x_n$ in $A$ with $x_n \to x$. By assumption $f(x_n) \to f(x)$, and each $f(x_n) \in f(A)$, so by the (easy half of the) sequence lemma, $f(x) \in \overline{f(A)}$. Hence $f(\overline{A}) \subset \overline{f(A)}$, which is one of the equivalent forms of continuity. $\blacksquare$

In a general space, a countable sequence of neighborhoods might not be enough to reach a point. The fix is to index by something bigger than $\mathbb{N}$: a net.

Uniform Convergence

A sequence of functions can converge in a weak way (point by point) or a strong way (all points at once).

Let $f_n: X \to Y$ be a sequence of functions from the set $X$ to the metric space $Y$. We say that $(f_n)$ converges uniformly to the function $f: X \to Y$ if, given $\varepsilon > 0$, there exists $N \in \mathbb{N}$ such that $d(f_n(x), f(x)) < \varepsilon$ for all $n > N$ and all $x \in X$.

The same $N$ has to work for every $x$. In pictures: eventually the whole graph of $f_n$ lies inside a tube of width $\varepsilon$ around the graph of $f$.

The $\varepsilon$-Tube

The functions $x^n$ are all continuous, and they converge at every single point, but the limit has a jump. Uniform convergence is exactly what forbids that.

Let $f_n: X \to Y$ be a sequence of continuous functions from the topological space $X$ to the metric space $Y$. If $(f_n)$ converges uniformly to $f$, then $f$ is continuous.

Show proof

Proof. Let $x_0 \in X$ and $\varepsilon > 0$. We find a neighborhood $U$ of $x_0$ with $f(U) \subset B(f(x_0), \varepsilon)$; since such balls form a basis of $Y$, this is condition (4) of continuity. By uniform convergence, choose $N$ with $d(f_N(x), f(x)) < \frac{\varepsilon}{3}$ for all $x \in X$. Since $f_N$ is continuous, there is a neighborhood $U$ of $x_0$ with $d(f_N(x), f_N(x_0)) < \frac{\varepsilon}{3}$ for all $x \in U$. Then for $x \in U$, $$d(f(x), f(x_0)) \le d(f(x), f_N(x)) + d(f_N(x), f_N(x_0)) + d(f_N(x_0), f(x_0)) < \tfrac{\varepsilon}{3} + \tfrac{\varepsilon}{3} + \tfrac{\varepsilon}{3} = \varepsilon. \; \blacksquare$$

This is the famous "$\frac{\varepsilon}{3}$ argument." It's worth memorizing; it shows up all over analysis.

Exercises

One more definition that comes up with metrics.

Let $(X, d)$ be a metric space. An isometry of $X$ is a function $f: X \to X$ with $$d(x, y) = d(f(x), f(y))$$ for all $x, y \in X$.

For example, the rotations and reflections of the plane are isometries for the Euclidean metric. Now the promised fact about metric spaces.

Show that every metric space $(X, d)$ is Hausdorff.

Show proof

Proof. Let $p, q \in X$ be distinct. Then $\varepsilon = d(p, q) > 0$. The balls $B_d(p, \frac{\varepsilon}{2})$ and $B_d(q, \frac{\varepsilon}{2})$ are neighborhoods of $p$ and $q$. They are disjoint: if $z$ were in both, the triangle inequality would give $d(p, q) \le d(p, z) + d(z, q) < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon$, a contradiction. So $X$ is Hausdorff. $\blacksquare$

And a quick computation with the definitions.

In $\mathbb{R}^2$, find the diameter of the unit square $[0, 1] \times [0, 1]$ in the Euclidean metric $d$ and in the square metric $\rho$.

Show answer

The two points farthest apart are opposite corners, like $(0, 0)$ and $(1, 1)$. In the Euclidean metric, $\operatorname{diam} = \sqrt{1^2 + 1^2} = \sqrt{2}$. In the square metric, every pair of points differs by at most $1$ in each coordinate, and the corners differ by exactly $1$, so $\operatorname{diam} = 1$. Same set, same topology, different diameters: diameter depends on the metric, not just the topology.

Spicy Bonus

A prelim problem: one space described two ways, once with a topology and once with a metric.

🌶️ SPICY BONUS 🌶️

Let $[0, 1]^{\mathbb{N}}$ denote the set of sequences $(x_n)_{n=1}^\infty$ with $x_n \in [0, 1]$ for every $n$. Let $X$ be the topological space obtained by giving $[0, 1]^{\mathbb{N}}$ the smallest topology for which the projection $(x_n)_{n=1}^\infty \mapsto x_k$ is continuous for every $k \in \mathbb{N}$. Let $Y$ be $[0, 1]^{\mathbb{N}}$ with the metric topology induced by $$d\big((x_n), (y_n)\big) = \sqrt{\sum_{n=1}^{\infty} 2^{-n} |x_n - y_n|^2}.$$ Show that the spaces $X$ and $Y$ are homeomorphic.

Show proof

Proof. We show that the topology of $X$ and the topology induced by $d$ are the same topology on $[0, 1]^{\mathbb{N}}$. Then the identity map is a homeomorphism $X \to Y$.

The topology of $X$ is the product topology. The projection onto slot $k$ is continuous exactly when every set $\pi_k^{-1}(A)$, with $A$ open in $[0, 1]$, is open. So the smallest such topology is the one generated by the subbasis $\{\pi_k^{-1}(A)\}$, which is precisely the product topology. Its basis elements are the sets $V_1 \times V_2 \times \cdots$ with each $V_k$ open in $[0, 1]$ and $V_k = [0, 1]$ for all $k \ge M$, for some $M$.

Every $d$-ball contains a product basis element around its center. Fix $x = (x_n)$ and $\varepsilon > 0$. For $\delta > 0$ and $L \in \mathbb{N}$, let $$N(x, \delta, L) = \{(y_n) : |y_n - x_n| < \delta \text{ for all } 1 \le n \le L\},$$ a product basis element containing $x$. If $y \in N(x, \delta, L)$, then since $|x_n - y_n| \le 1$ always, $$d(x, y)^2 < \delta^2 \sum_{n=1}^{L} 2^{-n} + \sum_{n=L+1}^{\infty} 2^{-n} \le \delta^2 + 2^{-L}.$$ Choose $L$ with $2^{-L} < \frac{\varepsilon^2}{2}$ and then $\delta$ with $\delta^2 < \frac{\varepsilon^2}{2}$. Then $N(x, \delta, L) \subset B_d(x, \varepsilon)$. So $d$-open sets are open in the product topology.

Every product basis element contains a $d$-ball around each of its points. Let $x \in V_1 \times \cdots \times V_M \times [0, 1] \times \cdots$. For each $k \le M$, choose $\varepsilon_k > 0$ with $(x_k - \varepsilon_k, x_k + \varepsilon_k) \cap [0, 1] \subset V_k$. If $d(x, y) < \varepsilon$, then $2^{-k} |x_k - y_k|^2 < \varepsilon^2$, so $|x_k - y_k| < 2^{k/2} \varepsilon$. Choosing $\varepsilon < \min_{k \le M} 2^{-k/2} \varepsilon_k$ makes $B_d(x, \varepsilon) \subset V_1 \times \cdots \times V_M \times [0, 1] \times \cdots$. So product-open sets are $d$-open.

The two topologies are equal, so $\mathrm{Id}: X \to Y$ and $\mathrm{Id}: Y \to X$ are both continuous, and the identity is a homeomorphism. $\blacksquare$