Skip to content

Metric Spaces

A metric space is a set together with a rule for measuring distance between any two of its points. This rule is abstract enough to describe ordinary Euclidean distance, distances between functions, and many other notions of closeness.
Let XX be a set. A function d ⁣:X×X[0,)d \colon X \times X \to [0,\infty) is called a metric on XX if for all x,y,zXx,y,z \in X it satisfies the following three axioms:
The distance is nonnegative, and zero distance identifies equal points.
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*}
The distance from xx to yy equals the distance from yy to xx.
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*}
The direct distance is no larger than the distance through an intermediate point.
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*}
The Euclidean metric on Rn\mathbb{R}^n.
On Rn\mathbb{R}^n, the standard metric is
d(x,y)=i=1n(xiyi)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 (xiyi)2(x_i-y_i)^2 is nonnegative. Moreover, d(x,y)=0d(x,y)=0 exactly when every term (xiyi)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
(xiyi)2=(yixi)2.\begin{equation*}(x_i-y_i)^2=(y_i-x_i)^2.\end{equation*}
For the triangle inequality, put u=xzu=x-z and v=zyv=z-y. By the Cauchy-Schwarz inequality,
u+v22=u22+2uv+v22(u2+v2)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).
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)=maxt[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).
The discrete metric on an arbitrary set.
On any set XX, the discrete metric is defined by
d(x,y)={0,x=y,1,xy.\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 xyx\neq y. For the triangle inequality, if x=yx=y, then d(x,y)=0d(x,y)=0 and the inequality is immediate. If xyx\neq y, then for any zXz\in X at least one of xzx\neq z or zyz\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, New York, 1976.