Metric Spaces
1 Metric Spaces
A metric is a generalisation of the concept of distance between points of a set. Metric spaces are the setting in which convergence, continuity and completeness make sense without any algebraic structure. They sit between normed spaces (a metric from a norm) and general topological spaces (open sets without a metric).
A metric on a set \(X\) is a function \(d:X\times X\to[0,\infty)\) such that for all \(x,y,z\in X\):
- \(d(x,y)=0\) if and only if \(x=y\);
- \(d(x,y)=d(y,x)\) (symmetry);
- \(d(x,z)\leq d(x,y)+d(y,z)\) (triangle inequality).
The pair \((X,d)\) is a metric space.
- Euclidean: \(d(x,y)=\lvert x-y\rvert\) on \(\mathbb{R}\), and \(d(x,y)=\lVert x-y\rVert_2\) on \(\mathbb{R}^n\). More generally any norm gives a metric \(d(x,y)=\lVert x-y\rVert\).
- Discrete: \(d(x,y)=1\) if \(x\neq y\) and \(0\) otherwise, on any set \(X\).
- Function spaces: on \(C([0,1])\), \(d_\infty(f,g)=\sup_{x\in[0,1]}\lvert f(x)-g(x)\rvert\) and \(d_1(f,g)=\int_0^1\lvert f(x)-g(x)\rvert\,dx\). For \(d_1\), the condition \(d_1(f,g)=0\implies f=g\) uses continuity: a nonzero continuous function has a positive integral. (On merely integrable functions \(d_1\) is only a pseudometric.)
- Extended reals: \(\overline{\mathbb{R}}=\mathbb{R}\cup\{\pm\infty\}\) with \(d(x,y)=\lvert\varphi(x)-\varphi(y)\rvert\), where \(\varphi(x)=\frac{x}{1+\lvert x\rvert}\) and \(\varphi(\pm\infty)=\pm1\). This is a metric because \(\varphi\) is injective, and it makes \(\varphi\) an isometry onto \([-1,1]\). Hence \(\overline{\mathbb{R}}\) is a compact metric space.
2 Open and Closed Sets
The open ball of radius \(\epsilon>0\) about \(x\in X\) is \(B_\epsilon(x)=\{y\in X:d(x,y)<\epsilon\}\), and the closed ball is \(\bar B_\epsilon(x)=\{y\in X:d(x,y)\leq\epsilon\}\). A set \(A\subseteq X\) is open if for every \(x\in A\) there is \(\epsilon>0\) with \(B_\epsilon(x)\subseteq A\). A set is closed if its complement is open.
In a metric space \((X,d)\):
- Open balls are open.
- \(\emptyset\) and \(X\) are open, arbitrary unions of open sets are open, and finite intersections of open sets are open.
- Dually, \(\emptyset\) and \(X\) are closed, arbitrary intersections of closed sets are closed, and finite unions of closed sets are closed.
Proof.
If \(y\in B_\epsilon(x)\) let \(\delta=\epsilon-d(x,y)>0\). For \(z\in B_\delta(y)\) the triangle inequality gives \(d(x,z)\leq d(x,y)+d(y,z)<\epsilon\), so \(B_\delta(y)\subseteq B_\epsilon(x)\).
A point in a union lies in one of the sets, hence has a ball inside it. For \(x\in U_1\cap\cdots\cap U_n\) choose \(\epsilon_i\) with \(B_{\epsilon_i}(x)\subseteq U_i\) and take \(\epsilon=\min_i\epsilon_i>0\). The finite requirement is needed: in \(\mathbb{R}\), \(\bigcap_n(-\tfrac1n,\tfrac1n)=\{0\}\) is not open.
follows from (2) by taking complements (De Morgan).
Open sets are exactly what a Topology axiomatises: a collection of sets closed under arbitrary unions and finite intersections. A set can be both open and closed (such as \(\emptyset\) and \(X\)) or neither (such as \([0,1)\) in \(\mathbb{R}\)). The countable intersections of open sets (\(G_\delta\)) and countable unions of closed sets (\(F_\sigma\)) feed into the Borel σ-algebra.
3 Convergence and Continuity
A sequence \(\{x_n\}\) in \((X,d)\) converges to \(x\in X\), written \(x_n\to x\), if \(d(x_n,x)\to0\), that is, for every \(\epsilon>0\) there is \(N\) with \(d(x_n,x)<\epsilon\) for all \(n\geq N\). See Sequence Convergence for the real case.
\(A\subseteq X\) is closed if and only if whenever \(x_n\in A\) and \(x_n\to x\in X\), we have \(x\in A\).
Proof. (\(\Rightarrow\)) Suppose \(A\) is closed, \(x_n\in A\), \(x_n\to x\) and \(x\notin A\). Since \(A^c\) is open there is \(\epsilon>0\) with \(B_\epsilon(x)\subseteq A^c\), but \(x_n\in B_\epsilon(x)\) for large \(n\), contradicting \(x_n\in A\). (\(\Leftarrow\)) Suppose \(A\) is not closed, so \(A^c\) is not open: there is \(x\in A^c\) with \(B_{1/n}(x)\cap A\neq\emptyset\) for every \(n\). Choosing \(x_n\in B_{1/n}(x)\cap A\) gives \(x_n\to x\) with \(x\notin A\).
For \(f:(X,d_X)\to(Y,d_Y)\) and \(x_0\in X\) the following are equivalent:
- \(\epsilon\)-\(\delta\): for all \(\epsilon>0\) there is \(\delta>0\) with \(d_X(x,x_0)<\delta\implies d_Y(f(x),f(x_0))<\epsilon\).
- Sequential: \(x_n\to x_0\) implies \(f(x_n)\to f(x_0)\).
Moreover \(f\) is continuous at every point if and only if \(f^{-1}(V)\) is open in \(X\) for every open \(V\subseteq Y\).
Proof. (1)\(\Rightarrow\)(2): given \(\epsilon\) take \(\delta\) from (1), then \(d_X(x_n,x_0)<\delta\) for large \(n\) gives \(d_Y(f(x_n),f(x_0))<\epsilon\). (2)\(\Rightarrow\)(1): if (1) fails there is \(\epsilon>0\) such that for every \(n\) some \(x_n\) has \(d_X(x_n,x_0)<1/n\) but \(d_Y(f(x_n),f(x_0))\geq\epsilon\), contradicting (2).
For the last claim, if \(f\) is \(\epsilon\)-\(\delta\) continuous and \(V\) is open, take \(x_0\in f^{-1}(V)\) and \(\epsilon\) with \(B_\epsilon(f(x_0))\subseteq V\); then \(B_\delta(x_0)\subseteq f^{-1}(V)\). Conversely, apply the open-preimage condition to \(V=B_\epsilon(f(x_0))\) to get an open set containing \(x_0\), hence a ball \(B_\delta(x_0)\) inside it.
The open-preimage formulation is the one that survives in topology and in measure theory, where a function is measurable when preimages of open (Borel) sets are measurable, see Set Functions. A bijection \(f\) such that \(f\) and \(f^{-1}\) are continuous is a homeomorphism.
4 Completeness and Compactness
A sequence \(\{x_n\}\) is Cauchy if for all \(\epsilon>0\) there is \(N\) with \(d(x_n,x_m)<\epsilon\) for all \(n,m\geq N\). A metric space is complete if every Cauchy sequence converges to a point of the space.
Every convergent sequence is Cauchy (see Cauchy Sequence), but the converse depends on the space. \(\mathbb{R}\) is complete while \(\mathbb{Q}\) is not (a rational sequence can converge to \(\sqrt2\)). See Completeness.
\(C([0,1])\) with \(d_\infty\) is complete, as uniform limits of continuous functions are continuous. For \(d_1\), let \(f_n=1\) on \([0,\tfrac12]\), \(f_n=0\) on \([\tfrac12+\tfrac1n,1]\) and linear in between. Then \(d_1(f_n,f_m)=\tfrac12\left\lvert\tfrac1n-\tfrac1m\right\rvert\to0\), so \(\{f_n\}\) is \(d_1\)-Cauchy, but not \(d_\infty\)-Cauchy since \(d_\infty(f_n,f_{2n})\geq\tfrac12\). If \(f_n\to f\) in \(d_1\) with \(f\) continuous, then \(f=1\) on \([0,\tfrac12]\) and \(f=0\) on \((\tfrac12,1]\), which is not continuous at \(\tfrac12\). So no limit exists in \(C([0,1])\).
A metric space \(X\) is (sequentially) compact if every sequence in \(X\) has a subsequence converging to a point of \(X\). A compact metric space is complete and bounded, and in \(\mathbb{R}^n\) the compact sets are exactly the closed and bounded ones (Heine-Borel). See Compactness.