Metric space

HomePage | Recent changes | View source | Discuss this page | Page history | Log in |

Printable version | Privacy policy

A metric space is a space where a distance between points is defined. Formally, a metric space is a set of points M with an associated distance function d : M × M -> R (where R is the set of real numbers) that satisfies three conditions.

  1. For all x, y in M, d(x, y) >= 0, with equality if and only if x = y.
  2. For all x, y in M, d(x, y) = d(y, x).
  3. For all x, y, z in M, d(x, z) <= d(x, y) + d(y, z); this is the triangle inequality.

The distance function is usually called a metric. The triangle inequality means that if you go from x to z directly, that is no longer than going first from x to y, and then from y to z. In Euclidean geometry, this is easy to see. Metric spaces allow this concept to be extended to a more abstract setting.

In any metric space M we can define the open balls as the sets of the form

B(x; r) = {y in M : d(x,y) < r},

where x is in M and r is a positive real number, called the radius of the ball. A set which is a union of open balls is called an open set. (Note that the union can be infinite or finite.) A complement of an open set is called closed. Every metric space is automatically a topological space, the topology being the set of all open sets. A topological space which can arise in this way from a metric space is called a metrizable space; see the article on metrization theorems for further details.

Metric spaces are normal Hausdorff spaces; an important consequence is that every continuous real-valued function defined on a closed subset of a metric space can be extended to a continuous map on the whole space. It is also true that any real-valued Lipschitz-continuous map defined on a subset of a metric space can be extended to a Lipschitz-continuous map on the whole space.

A metric space in which every Cauchy sequence converges is said to be complete. A metric space is bounded if it is equal to some open ball. It is totally bounded if for every r > 0 it is the union of finitely many open balls of radius r. It is not difficult to see that every totally bounded metric space is bounded. It can be shown that a metric space is compact if and only if it is complete and totally bounded.

By restricting the metric, any subset of a metric space is a metric space itself. We call such a subset complete, bounded, totally bounded or compact if it, considered as a metric space, has the corresponding property.


  • The real numbers with the distance function d(x, y) = |y - x|, and more generally Euclidean n-space, are complete metric spaces.
  • More generally still, any normed vector space is a metric space by defining d(x, y) = ||y - x||. It the space is complete, we call it a Banach space.
  • If X is some set and M is a metric space, then the set of all bounded functions f : X -> M (i.e. those functions whose image is a bounded subset of M) can be turned into a metric space by defining d(f, g) = supx in X d(f(x), g(x)) for any bounded functions f and g.
  • If M is a metric space, we can turn the set K(M) of all compact subsets of M into a metric space by defining the Hausdorff distance d(X, Y) = inf{r : for every x in X there exists a y in Y with d(x, y) < r and for every y in Y there exists an x in X such that d(x, y) < r)}. In this metric, two elements are close to each other if every element of one set is close to some element of the other set. One can show that K(M) is complete if M is complete.

Some metrics satisfy a stronger version of the triangle inequality:

  1. For all x, y, z in M, d(x, z) <= max(d(x, y), d(y, z))

These metrics are called super-metrics. An equivalent condition is that every triangle has at least two equal sides. The p-adic numbers are a super-metric space.

See also: contraction mapping.