\[ \newcommand{R}{\mathbb{R}} \newcommand{defarrow}{\quad \stackrel{\text{def}}{\Longleftrightarrow} \quad} \]

# Metric spaces

### Definition

Let \(X\) be a set and \(d \colon X \times X \to [0,\infty)\) a function such that
\[
\begin{align*}
&\mathrm{(i)} \qquad &d(x,y) &= d(y,x), \qquad&\text{(symmetry)}&\\
&\mathrm{(ii)} \qquad &d(x,y) &\leq d(x,z) + d(z,y), \qquad&\text{(triangle inequality)}&\\
&\mathrm{(iii)} \qquad &d(x, y) &= 0 \quad\text{ if only if }\quad x = y. \qquad&\text{(non-degeneracy)}&\\
\end{align*}
\]
Then the pair \((X,d)\) is called a **metric space** and the function \(d\) is called a **metric** or **distance** on \(X\).

A subset \(M \subset X\) is called a **subspace** of \(X\), written \((M,d) \subset (X,d)\), if \(M\) is endowed with the same metric as \(X\), called the **induced metric** on \(M\). Subspaces of metric spaces are themselves metric spaces.

**Ex.**

- Any set becomes a metric space when endowed with the
**discrete metric**\[ d(x,y) := \begin{cases} 1, \qquad &x \neq y,\\ 0, \qquad &x = y. \end{cases} \]

- \(\R^n\) becomes a metric space when endowed with the
**Euclidean distance**\[ d(x,y) := |x - y| = \big( (x_1-y_1)^2 +\ldots + (x_n-y_n)^2\big)^{1/2}.\] - The supremum norm induces a metric on the set of bounded and continuous functions on an interval: \[ d(f,g) = \|f-g\|_\infty = \sup_{x \in I}|f(x)-g(x)|. \] This makes \((BC(I,\mathbb R), \| \cdot \|_\infty)\) a metric space.

### ℘ Normed spaces are metric spaces

If \(\|\cdot\|\) is a norm on \(X\), then \(d(x,y) := \|x-y\|\) is a metric on \(X\).

**N.b.** Metric spaces need not be vector spaces. The set of positive real numbers, \(\R_+ = (0,\infty)\), with the metric given by \(d(x,y) := |x-y|\) is a metric space, but it is not a linear space, since it contains neither an additive identity (\(0\)) nor additive inverses (\(-x\)).