In mathematics, a metric space is a non-empty set together with a metric on the set. The metric is a function that defines a concept of distance between any two members of the set, which are usually called points. The metric satisfies the following properties:
- the distance from to is zero if and only if and are the same point,
- the distance between two distinct points is positive,
- the distance from to is the same as the distance from to , and
- the distance from to is less than or equal to the distance from to via any third point .
The most familiar metric space is 3-dimensional Euclidean space. In fact, a "metric" is the generalization of the Euclidean metric arising from the four long-known properties of the Euclidean distance. The Euclidean metric defines the distance between two points as the length of the straight line segment connecting them. Other metric spaces occur for example in elliptic geometry and hyperbolic geometry, where distance on a sphere measured by angle is a metric, and the hyperboloid model of hyperbolic geometry is used by special relativity as a metric space of velocities. Some of the non-geometric metric spaces include spaces of finite strings (finite sequences of symbols from a predefined alphabet) equipped with e.g. Hamming distance or Levenshtein distance, a space of subsets of any metric space equipped with Hausdorff distance, a space of real functions integrable on a unit interval with an integral metric , or the set of probability measures on the Borel sigma-algebra of any given metric space, equipped with the Wasserstein metric Wp (). See also the section § Examples of metric spaces.