Skip to content

Metric Spaces

METRIC SPACE
A metric space is a pair (X,d)(X,d), where XX is a set and d ⁣:X×X→[0,∞)d \colon X \times X \to [0,\infty) is a function satisfying, for all x,y,z∈Xx,y,z \in X:
  • Positivity: d(x,y)≥0d(x,y) \geq 0, and d(x,y)=0d(x,y)=0 if and only if x=yx=y.
  • Symmetry: d(x,y)=d(y,x)d(x,y)=d(y,x).
  • Triangle inequality: d(x,y)≤d(x,z)+d(z,y)d(x,y) \leq d(x,z)+d(z,y).
The function dd is called a metric on XX.

Metric Axioms

Positivity

The positivity axiom says that distance cannot be negative. It also says that the only way two points can have distance zero is when they are the same point:
d(x,y)=0  ⟺  x=y.\begin{equation*}d(x,y) = 0 \iff x=y.\end{equation*}

Symmetry

The symmetry axiom means that the order of the two points does not matter:
d(x,y)=d(y,x).\begin{equation*}d(x,y)=d(y,x).\end{equation*}

Triangle Inequality

The triangle inequality says that going from xx to yy directly is no longer than going through a third point zz:
d(x,y)≤d(x,z)+d(z,y).\begin{equation*}d(x,y) \leq d(x,z)+d(z,y).\end{equation*}

Examples

Euclidean Space

The Euclidean metric on Rn\mathbb{R}^n.
On Rn\mathbb{R}^n, the standard metric is
d(x,y)=∑i=1n(xi−yi)2.\begin{equation*}d(x,y)=\sqrt{\sum_{i=1}^n (x_i-y_i)^2}.\end{equation*}
This is the usual straight-line distance between two points.
\quad Proof. Positivity is clear since each (xi−yi)2(x_i-y_i)^2 is nonnegative. Moreover, d(x,y)=0d(x,y)=0 exactly when every term (xi−yi)2(x_i-y_i)^2 is zero, which is equivalent to xi=yix_i=y_i for every ii, hence x=yx=y. Symmetry follows from
(xi−yi)2=(yi−xi)2.\begin{equation*}(x_i-y_i)^2=(y_i-x_i)^2.\end{equation*}
For the triangle inequality, put u=x−zu=x-z and v=z−yv=z-y. By the Cauchy-Schwarz inequality,
∥u+v∥22=∥u∥22+2u⋅v+∥v∥22≤(∥u∥2+∥v∥2)2.\begin{equation*}\|u+v\|_2^2=\|u\|_2^2+2u\cdot v+\|v\|_2^2\leq \bigl(\|u\|_2+\|v\|_2\bigr)^2.\end{equation*}
Taking square roots gives d(x,y)≤d(x,z)+d(z,y)d(x,y)\leq d(x,z)+d(z,y).

Continuous Functions

The uniform metric on C[a,b]C[a,b].
On the space C[a,b]C[a,b] of continuous real-valued functions on [a,b][a,b], one natural metric is
d(f,g)=max⁡t∈[a,b]∣f(t)−g(t)∣.\begin{equation*}d(f,g)=\max_{t\in[a,b]} |f(t)-g(t)|.\end{equation*}
This measures the largest vertical separation between the two functions on the interval.
\quad Proof. Positivity follows from ∣f(t)−g(t)∣≥0|f(t)-g(t)|\geq 0 for every tt. If d(f,g)=0d(f,g)=0, then ∣f(t)−g(t)∣=0|f(t)-g(t)|=0 for every t∈[a,b]t\in[a,b], so f=gf=g; the converse is immediate. Symmetry follows from
∣f(t)−g(t)∣=∣g(t)−f(t)∣.\begin{equation*}|f(t)-g(t)|=|g(t)-f(t)|.\end{equation*}
For the triangle inequality, for every t∈[a,b]t\in[a,b] we have
∣f(t)−h(t)∣≤∣f(t)−g(t)∣+∣g(t)−h(t)∣≤d(f,g)+d(g,h).\begin{equation*}|f(t)-h(t)|\leq |f(t)-g(t)|+|g(t)-h(t)|\leq d(f,g)+d(g,h).\end{equation*}
Taking the maximum over t∈[a,b]t\in[a,b] gives d(f,h)≤d(f,g)+d(g,h)d(f,h)\leq d(f,g)+d(g,h).

Discrete Space

The discrete metric on an arbitrary set.
On any set XX, the discrete metric is defined by
d(x,y)={0,x=y,1,x≠y.\begin{equation*}d(x,y)=\begin{cases}0, & x=y,\\1, & x\neq y.\end{cases}\end{equation*}
This metric only distinguishes whether two points are equal or different.
\quad Proof. Positivity holds because dd only takes the values 00 and 11, and by definition d(x,y)=0d(x,y)=0 exactly when x=yx=y. Symmetry follows because the condition x=yx=y is symmetric in xx and yy, and so is the condition x≠yx\neq y. For the triangle inequality, if x=yx=y, then d(x,y)=0d(x,y)=0 and the inequality is immediate. If x≠yx\neq y, then for any z∈Xz\in X at least one of x≠zx\neq z or z≠yz\neq y must hold; otherwise x=z=yx=z=y. Hence
d(x,z)+d(z,y)≥1=d(x,y),\begin{equation*}d(x,z)+d(z,y)\geq 1=d(x,y),\end{equation*}
which proves the triangle inequality.

References

  • [Rudin1976]Rudin, Walter. Principles of Mathematical Analysis. Third edition. McGraw-Hill, 1976.