Misplaced Pages

Metric space: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 18:27, 20 July 2004 editPaul August (talk | contribs)Autopatrolled, Administrators205,573 edits Formal definition: added link for "distance"← Previous edit Latest revision as of 20:09, 8 January 2025 edit undoDavid Eppstein (talk | contribs)Autopatrolled, Administrators226,463 edits Bounded and totally bounded spaces: add to see-also 
(918 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
{{Short description|Mathematical space with a notion of distance}}
]]
{{use dmy dates|date=December 2020|cs1-dates=y}}
In ], a '''metric space''' is a ] (or "space") where a ] between points is defined.
] (a set of points) can be equipped with different metrics. In the ] the red, yellow and blue paths have the same ] (12), and are all shortest paths. In the ], the green path has length <math>6 \sqrt{2} \approx 8.49</math>, and is the unique shortest path, whereas the red, yellow, and blue paths still have length 12.]]


In ], a '''metric space''' is a ] together with a notion of '']'' between its ], usually called ]. The distance is measured by a ] called a '''metric''' or '''distance function'''.{{sfn|Čech|1969|p=42}} Metric spaces are the most general setting for studying many of the concepts of ] and ].
==History==


The most familiar example of a metric space is ] with its usual notion of distance. Other well-known examples are a ] equipped with the ] and the ]. A metric may correspond to a ], rather than physical, notion of distance: for example, the set of 100-character Unicode strings can be equipped with the ], which measures the number of characters that need to be changed to get from one string to another.
] introduced metric spaces in his work ''Sur quelques points du calcul fonctionnel'', Rendic. Circ. Mat. Palermo 22(1906) 1-74.


Since they are very general, metric spaces are a tool used in many different branches of mathematics. Many types of mathematical objects have a natural notion of distance and therefore admit the structure of a metric space, including ]s, ]s, and ]s. In ], the ] arise as elements of the ] of a metric structure on the ]. Metric spaces are also studied in their own right in '''metric geometry'''{{sfn|Burago|Burago|Ivanov|2001}} and '''analysis on metric spaces'''.{{sfn|Heinonen|2001}}
==Formal definition==


Many of the basic notions of ], including ]s, ], as well as ], ], and ], can be defined in the setting of metric spaces. Other notions, such as ], ], and ] and ]s, can be defined for metric spaces, but also in the even more general setting of ]s.
Formally, a metric space ''M'' is a set of points with an associated distance ] (also called a '''metric''')
''d'' : ''M'' × ''M'' <tt>-></tt> <b>R</b> (where <b>R</b> is the set of ]s). For all ''x'', ''y'', ''z'' in ''M'', this function is required to satisfy the following conditions:


== Definition and illustration ==
# ''d''(''x'', ''y'') &ge; 0
=== Motivation ===
# ''d''(''x'', ''x'') = 0
]
# if &nbsp; ''d''(''x'', ''y'') = 0 &nbsp; then &nbsp; ''x'' = ''y'' &nbsp;&nbsp;&nbsp; (''identity of indiscernibles'')
# ''d''(''x'', ''y'') = ''d''(''y'', ''x'') &nbsp;&nbsp;&nbsp; (''symmetry'')
# ''d''(''x'', ''z'') &le; ''d''(''x'', ''y'') + ''d''(''y'', ''z'') &nbsp;&nbsp;&nbsp; (]).


These axioms express intuitive notions about the concept of ]. For example, that the distance between distinct points is positive and the distance from ''x'' to ''y'' is the same as the distance from ''y'' to ''x''. The triangle inequality means that going from ''x'' to ''z'' directly, is no longer than going first from ''x'' to ''y'', and then from ''y'' to ''z''. In ], this is easy to see. Metric spaces allow this concept to be extended to a more abstract setting. To see the utility of different notions of distance, consider the ] as a set of points. We can measure the distance between two such points by the length of the ], "]"; this is particularly useful for shipping and aviation. We can also measure the straight-line distance between two points through the Earth's interior; this notion is, for example, natural in ], since it roughly corresponds to the length of time it takes for seismic waves to travel between those two points.


The notion of distance encoded by the metric space axioms has relatively few requirements. This generality gives metric spaces a lot of flexibility. At the same time, the notion is strong enough to encode many intuitive facts about what distance means. This means that general results about metric spaces can be applied in many different contexts.
In metric spaces, one can talk about ]s of ]s; a metric space in which every ] has a limit is said to be ].


Like many fundamental mathematical concepts, the metric on a metric space can be interpreted in many different ways. A particular metric may not be best thought of as measuring physical distance, but, instead, as the cost of changing from one state to another (as with ]s on spaces of ]s) or the degree of difference between two objects (for example, the ] between two strings of characters, or the ] between metric spaces themselves).
A metric ''d'' on ''M'' is called ] if any two points ''x'' and ''y'' in ''M'' can be joined by a ] with ] arbitrarily close to ''d''(''x'', ''y'').


== Examples == === Definition ===
Formally, a '''metric space''' is an ] {{math|(''M'', ''d'')}} where {{mvar|M}} is a set and {{mvar|d}} is a '''metric''' on {{mvar|M}}, i.e., a ]<math display="block">d\,\colon M \times M \to \mathbb{R}</math>satisfying the following axioms for all points <math>x,y,z \in M</math>:{{sfn|Burago|Burago|Ivanov|2001|p=1}}{{sfn|Gromov|2007|p=xv}}
# The distance from a point to itself is zero: <math display="block">d(x, x) = 0</math>
# (Positivity) The distance between two distinct points is always positive: <math display="block">\text{If }x \neq y\text{, then }d(x, y)>0</math>
# (]) The distance from {{mvar|x}} to {{mvar|y}} is always the same as the distance from {{mvar|y}} to {{mvar|x}}: <math display="block">d(x, y) = d(y, x)</math>
# The ] holds: <math display="block">d(x, z) \leq d(x, y) + d(y, z)</math>This is a natural property of both physical and metaphorical notions of distance: you can arrive at {{mvar|z}} from {{mvar|x}} by taking a detour through {{mvar|y}}, but this will not make your journey any shorter than the direct path.


If the metric {{mvar|d}} is unambiguous, one often refers by ] to "the metric space {{mvar|M}}".
* The trivial distance metric: ''d''(''x'',''y'') = 0 if ''x'' = ''y'' else 1.
* The ] with the distance function ''d''(''x'', ''y'') = |''y'' - ''x''| given by the ], and more generally ] with the ], are complete metric spaces.
* The ] where the distance between any two points, or vectors, is the sum of the distances between corresponding coordinates. More generally, any ] is a metric space by defining ''d''(''x'', ''y'') = ||''y'' - ''x''|| (If such a space is complete, we call it a ]).
* The ] metric on a ], given by ''d''(''x'', ''y'')=||''x''|| + ||''y''|| for distinct points ''x'' and ''y'', and ''d''(''x'', ''x'') = 0. The name alludes to the tendency of railway journeys to always proceed via ], which is identified with the origin.
* If ''X'' is some set and ''M'' is a metric space, then the set of all bounded functions ''f'' : ''X'' <tt>-></tt> ''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'') = sup<sub>''x'' in ''X''</sub> ''d''(''f''(''x''), ''g''(''x'')) for any bounded functions ''f'' and ''g''. If ''M'' is complete, then this space is complete as well.
* If ''X'' is a ] (or metric) space and ''M'' is a metric space, then the set of all bounded ] functions from ''X'' to ''M'' forms a metric space if we define the metric as above: ''d''(''f'', ''g'') = sup<sub>''x'' in ''X''</sub> ''d''(''f''(''x''), ''g''(''x'')) for any bounded continuous functions ''f'' and ''g''. If ''M'' is complete, then this space is complete as well.
* If ''M'' is a ] ], then we can turn ''M'' into a metric space by defining the distance of two points as the ] of the lengths of the paths (continuously differentiable ]s) connecting them.
* If ''G'' is an ], then the set ''V'' of vertices of ''G'' can be turned into a metric space by defining ''d''(''x'', ''y'') to be the length of the shortest path connecting the vertices ''x'' and ''y''.
* 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 ] ''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.
* The set of all (isometry classes of) compact metric spaces form a metric space with respect to ].


By taking all axioms except the second, one can show that distance is always non-negative:<math display="block">0 = d(x, x) \leq d(x, y) + d(y, x) = 2 d(x, y)</math>Therefore the second axiom can be weakened to <math display="inline">\text{If }x \neq y\text{, then }d(x, y) \neq 0</math> and combined with the first to make <math display="inline">d(x, y) = 0 \iff x=y</math>.<ref>{{Cite book |last=Gleason |first=Andrew |title=Fundamentals of Abstract Analysis |publisher=] |year=1991 |edition=1st |pages=223 |doi=10.1201/9781315275444|isbn=9781315275444 |s2cid=62222843 }}</ref>
== Further definitions and properties ==


===Simple examples===
===Metric spaces as topological spaces===
====The real numbers====
In any metric space ''M'' we can define the '''open balls''' as the sets of the form
The ]s with the distance function <math>d(x,y) = | y - x |</math> given by the ] form a metric space. Many properties of metric spaces and functions between them are generalizations of concepts in ] and coincide with those concepts when applied to the real line.
::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 subset of ''M'' which is a union of (finitely or infinitely many) open balls is called an ].
The complement of an open set is called ].
Every metric space is automatically a ], 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 ] for further details.


====Metrics on Euclidean spaces====
Since metric spaces are topological spaces, one has a notion of ] between metric spaces. Without referring to the topology, this notion can also be directly defined using limits of sequences; this is explained in the article on continuous functions.
]
The Euclidean plane <math>\R^2</math> can be equipped with many different metrics. The ] familiar from school mathematics can be defined by
<math display="block">d_2((x_1,y_1),(x_2,y_2))=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}.</math>


The ] is defined by
===Boundedness and compactness===
<math display="block">d_1((x_1,y_1),(x_2,y_2))=|x_2-x_1|+|y_2-y_1|</math>
A metric space ''M'' is called '''bounded''' if there exists some number ''r'', such that ''d''(''x'',''y'') &le; ''r'' for all ''x'' and ''y'' in ''M''. The smallest possible such ''r'' is called the '''diameter''' of ''M''. The space ''M'' is called '''pre-compact''' or '''totally bounded''' if for every ''r'' > 0 there exist finitely many open balls of radius ''r'' whose union equals ''M''. Since the set of the centres of these balls is finite, it has finite diameter, from which it follows (using the triangle inequality) that every totally bounded space is bounded. The converse does not hold, since any infinite set can be given the trivial distance metric (the first example above) under which it is bounded and yet not totally bounded. A useful characterisation of ] for metric spaces is that a metric space is ] if and only if it is complete and totally bounded.
and can be thought of as the distance you need to travel along horizontal and vertical lines to get from one point to the other, as illustrated at the top of the article.


The ''maximum'', <math>L^\infty</math>, or '']'' is defined by
Note that in the context of ]s in the space of ]s and occasionally regions in a Euclidean space '''R'''<sup>n</sup> a bounded set is referred to as "a finite interval" or "finite region". However boundedness should not in general be confused with "finite", which refers to the number of elements, not to how far the set extends; finiteness implies boundedness, but not conversely.
<math display="block">d_\infty((x_1,y_1),(x_2,y_2))=\max\{|x_2-x_1|,|y_2-y_1|\}.</math>
This distance does not have an easy explanation in terms of paths in the plane, but it still satisfies the metric space axioms. It can be thought of similarly to the number of moves a ] would have to make on a ] ] to travel from one point to another on the given space.


In fact, these three distances, while they have distinct properties, are similar in some ways. Informally, points that are close in one are close in the others, too. This observation can be quantified with the formula
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.
<math display="block">d_\infty(p,q) \leq d_2(p,q) \leq d_1(p,q) \leq 2d_\infty(p,q),</math>
which holds for every pair of points <math>p, q \in \R^2</math>.


A radically different distance can be defined by setting
===] properties and extension of continuous functions===
<math display="block">d(p,q)=\begin{cases}0, & \text{if }p=q, \\ 1, & \text{otherwise.}\end{cases}</math>
Metric spaces are ] ] and hence ] (indeed they are perfectly normal). An important consequence is that every metric space admits ] and 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 every real-valued ] map defined on a subset of a metric space can be extended to a Lipschitz-continuous map on the whole space.
Using ]s,
<math display="block">d(p,q) = </math>
In this ''discrete metric'', all distinct points are 1 unit apart: none of them are close to each other, and none of them are very far away from each other either. Intuitively, the discrete metric no longer remembers that the set is a plane, but treats it just as an undifferentiated set of points.


All of these metrics make sense on <math>\R^n</math> as well as <math>\R^2</math>.
==== Distance between points and sets ====
A simple way to construct a function separating a point from a closed set (as required for a ] space) is to consider the distance between the point and the set. If (''M'',''d'') is a metric space, ''S'' is a ] of ''M'' and ''x'' is a point of ''M'', we define the distance from ''x'' to ''S'' as
:''d''(''x'',''S'') = ] {''d''(''x'',''s'') : ''s'' &isin; ''S''}
Then ''d''(''x'', ''S'') = 0 if and only if ''x'' belongs to the ] of ''S''. Furthermore, we have the following generalization of the triangle inequality:
:''d''(''x'',''S'') &le; ''d''(''x'',''y'') + ''d''(''y'',''S'')
which in particular shows that the map ''x'' <tt>|-></tt> ''d''(''x'',''S'') is continuous.


====Subspaces====
===Identifying two metric spaces as equivalent===
Given a metric space {{math|(''M'', ''d'')}} and a ] <math>A \subseteq M</math>, we can consider {{mvar|A}} to be a metric space by measuring distances the same way we would in {{mvar|M}}. Formally, the ''induced metric'' on {{mvar|A}} is a function <math>d_A:A \times A \to \R</math> defined by
An ''']''' between two metric spaces (''M''<sub>1</sub>, ''d''<sub>1</sub>) and (''M''<sub>2</sub>, ''d''<sub>2</sub>) is a function ''f'' : ''M''<sub>1</sub> &rarr; ''M''<sub>2</sub> which preserves distances: ''d''<sub>2</sub>(''f''(''x''), ''f''(''y'')) = ''d''<sub>1</sub>(''x'', ''y'') for all ''x'', ''y'' in ''M''<sub>1</sub>. Isometries are necessarily ]. We call two spaces '''isometrically isomorphic''' if there exists a ] isometry between them. In this case, the two spaces are essentially identical.
<math display="block">d_A(x,y)=d(x,y).</math>
For example, if we take the two-dimensional sphere {{math|S<sup>2</sup>}} as a subset of <math>\R^3</math>, the Euclidean metric on <math>\R^3</math> induces the straight-line metric on {{math|S<sup>2</sup>}} described above. Two more useful examples are the open interval {{open-open|0, 1}} and the closed interval {{closed-closed|0, 1}} thought of as subspaces of the real line.


== History ==
Isometries are often used in constructions where one space is ] in another space. For instance, the ] of a metric space ''M'' involves an isometry from ''M'' into <i>M</i>', a quotient of the space Cauchy sequences on ''M''. The original space ''M'' is thus isometrically isomorphic to a subspace of a complete metric space, and it is usually identified with this subspace. Other embedding constructions show that every metric space is isometrically isomorphic to a closed subset of some ] and that every complete metric space is isometrically isomorphic to a closed subset of some ].
], in his article "On Distance", extended metric concepts beyond Euclidean geometry into domains bounded by a conic in a projective space. His ] was given by logarithm of a ]. Any projectivity leaving the conic stable also leaves the cross ratio constant, so isometries are implicit. This method provides models for ] and ], and ], in several publications, established the field of ] through the use of the ].


The idea of an abstract space with metric properties was addressed in 1906 by ]<ref>{{cite journal |last1=Fréchet |first1=M. |title=Sur quelques points du calcul fonctionnel |journal=Rendiconti del Circolo Matematico di Palermo |date=December 1906 |volume=22 |issue=1 |pages=1–72 |doi=10.1007/BF03018603|s2cid=123251660 |url=https://zenodo.org/record/1428464 }}</ref> and the term ''metric space'' was coined by ] in 1914.<ref>F. Hausdorff (1914) ''Grundzuge der Mengenlehre''</ref><ref>{{cite journal |last1=Blumberg |first1=Henry |title=Hausdorff's Grundzüge der Mengenlehre |journal=Bulletin of the American Mathematical Society |date=1927 |volume=6 |pages=778–781 |doi=10.1090/S0002-9904-1920-03378-1 |doi-access=free}}</ref><ref>Mohamed A. Khamsi & William A. Kirk (2001) ''Introduction to Metric Spaces and Fixed Point Theory'', page 14, ]</ref>
== Related concepts and alternative axiom systems ==


Fréchet's work laid the foundation for understanding ], ], and other key concepts in non-geometric spaces. This allowed mathematicians to study functions and sequences in a broader and more flexible way. This was important for the growing field of functional analysis. Mathematicians like Hausdorff and ] further refined and expanded the framework of metric spaces. Hausdorff introduced ]s as a generalization of metric spaces. Banach's work in ] heavily relied on the metric structure. Over time, metric spaces became a central part of ]. They have influenced various fields including ], ], and ]. Metric spaces continue to play a crucial role in the study of abstract mathematical concepts.
The property 1 (''d''(''x'', ''y'') &ge; 0) follows from properties 2, 4 and 5 and does not have to be required separately.


==Basic notions==
Some authors use the ] and allow the distance function ''d'' to attain the value &infin;. Every such metric can be rescaled to a finite metric (using <i>d</i>'(''x'', ''y'') = ''d''(''x'', ''y'') / (1 + ''d''(''x'', ''y'')) or ''d''<nowiki>''</nowiki>(''x'', ''y'') = min(1, ''d''(''x'', ''y''))) and the two concepts of metric space are therefore equivalent as far as notions of ] (such as ] or ]) are concerned.
A distance function is enough to define notions of closeness and convergence that were first developed in ]. Properties that depend on the structure of a metric space are referred to as ''metric properties''. Every metric space is also a ], and some metric properties can also be rephrased without reference to distance in the language of topology; that is, they are really ].


===The topology of a metric space===
A metric is called an ] if it satisfies the following stronger version of the ''triangle inequality'':
For any point {{mvar|x}} in a metric space {{mvar|M}} and any real number {{math|''r'' > 0}}, the ] of radius {{mvar|r}} around {{mvar|x}} is defined to be the set of points that are strictly less than distance {{mvar|r}} from {{mvar|x}}:
* For all ''x'', ''y'', ''z'' in ''M'', ''d''(''x'', ''z'') &le; max(''d''(''x'', ''y''), ''d''(''y'', ''z''))
<math display="block">B_r(x)=\{y \in M : d(x,y) < r\}.</math>
This is a natural way to define a set of points that are relatively close to {{mvar|x}}. Therefore, a set <math>N \subseteq M</math> is a ] of {{mvar|x}} (informally, it contains all points "close enough" to {{mvar|x}}) if it contains an open ball of radius {{mvar|r}} around {{mvar|x}} for some {{math|''r'' > 0}}.


An ''open set'' is a set which is a neighborhood of all its points. It follows that the open balls form a ] for a topology on {{mvar|M}}. In other words, the open sets of {{mvar|M}} are exactly the unions of open balls. As in any topology, ]s are the complements of open sets. Sets may be both open and closed as well as neither open nor closed.
If one drops property 3, one obtains ]s. Dropping property 4 instead, one obtains ]s. However, losing symmetry in this case, one usually changes property 3 such that both ''d''(''x'',''y'')=0 and ''d''(''y'',''x'')=0 are needed for ''x'' and ''y'' to be identified. All combinations of the above are possible and are referred to by their according names (such as ''quasi-pseudo-ultrametric'').


This topology does not carry all the information about the metric space. For example, the distances {{math|''d''<sub>1</sub>}}, {{math|''d''<sub>2</sub>}}, and {{math|''d''<sub>∞</sub>}} defined above all induce the same topology on <math>\R^2</math>, although they behave differently in many respects. Similarly, <math>\R</math> with the Euclidean metric and its subspace the interval {{open-open|0, 1}} with the induced metric are ] but have very different metric properties.
The requirement that the metric takes values in ]s. The reformulation of the axioms in this case leads to the construction of ]s: topological spaces with an abstract structure enabling one to compare the local topologies of different points.

Conversely, not every topological space can be given a metric. Topological spaces which are compatible with a metric are called ] and are particularly well-behaved in many ways: in particular, they are ]<ref>Rudin, Mary Ellen. {{webarchive|url=https://web.archive.org/web/20160412015215/http://www.jstor.org/stable/2035708 |date=2016-04-12 }}. Proceedings of the American Mathematical Society, Vol. 20, No. 2. (Feb., 1969), p. 603.</ref> ]s (hence ]) and ].{{efn|Balls with rational radius around a point {{mvar|x}} form a ] for that point.}} The ] gives a characterization of metrizability in terms of other topological properties, without reference to metrics.

===Convergence===
] in Euclidean space is defined as follows:
: A sequence {{math|(''x<sub>n</sub>'')}} converges to a point {{mvar|x}} if for every {{math|ε > 0}} there is an integer {{mvar|N}} such that for all {{math|''n'' > ''N''}}, {{math|''d''(''x<sub>n</sub>'', ''x'') < ε}}.
Convergence of sequences in a topological space is defined as follows:
: A sequence {{math|(''x<sub>n</sub>'')}} converges to a point {{mvar|x}} if for every open set {{mvar|U}} containing {{mvar|x}} there is an integer {{mvar|N}} such that for all {{math|''n'' > ''N''}}, <math>x_n \in U</math>.
In metric spaces, both of these definitions make sense and they are equivalent. This is a general pattern for ] of metric spaces: while they can be defined in a purely topological way, there is often a way that uses the metric which is easier to state or more familiar from real analysis.

===Completeness===
{{main|Complete metric space}}
Informally, a metric space is ''complete'' if it has no "missing points": every sequence that looks like it should converge to something actually converges.

To make this precise: a sequence {{math|(''x<sub>n</sub>'')}} in a metric space {{mvar|M}} is ] if for every {{math|ε > 0}} there is an integer {{mvar|N}} such that for all {{math|''m'', ''n'' > ''N''}}, {{math|''d''(''x<sub>m</sub>'', ''x<sub>n</sub>'') < ε}}. By the triangle inequality, any convergent sequence is Cauchy: if {{mvar|x<sub>m</sub>}} and {{mvar|x<sub>n</sub>}} are both less than {{math|ε}} away from the limit, then they are less than {{math|2ε}} away from each other. If the converse is true—every Cauchy sequence in {{mvar|M}} converges—then {{mvar|M}} is complete.

Euclidean spaces are complete, as is <math>\R^2</math> with the other metrics described above. Two examples of spaces which are not complete are {{open-open|0, 1}} and the rationals, each with the metric induced from <math>\R</math>. One can think of {{open-open|0, 1}} as "missing" its endpoints 0 and 1. The rationals are missing all the irrationals, since any irrational has a sequence of rationals converging to it in <math>\R</math> (for example, its successive decimal approximations). These examples show that completeness is ''not'' a topological property, since <math>\R</math> is complete but the homeomorphic space {{open-open|0, 1}} is not.

This notion of "missing points" can be made precise. In fact, every metric space has a unique ], which is a complete space that contains the given space as a ] subset. For example, {{closed-closed|0, 1}} is the completion of {{open-open|0, 1}}, and the real numbers are the completion of the rationals.

Since complete spaces are generally easier to work with, completions are important throughout mathematics. For example, in abstract algebra, the ] are defined as the completion of the rationals under a different metric. Completion is particularly common as a tool in ]. Often one has a set of nice functions and a way of measuring distances between them. Taking the completion of this metric space gives a new set of functions which may be less nice, but nevertheless useful because they behave similarly to the original nice functions in important ways. For example, ]s to ]s typically live in a completion (a ]) rather than the original space of nice functions for which the differential equation actually makes sense.
<!-- some factoids from the previous version of the article that did not make it in:

If <math>X</math> is a complete subset of the metric space <math>M</math>, then <math>X</math> is closed in <math>M</math>. Indeed, a space is complete if and only if it is closed in any containing metric space.

Every complete metric space is a ].
-->

===Bounded and totally bounded spaces===
]
{{See also|Bounded set|Diameter of a metric space}}
A metric space {{mvar|M}} is ''bounded'' if there is an {{mvar|r}} such that no pair of points in {{mvar|M}} is more than distance {{mvar|r}} apart.{{efn|In the context of ]s in the real line, or more generally regions in Euclidean space, bounded sets are sometimes referred to as "finite intervals" or "finite regions". However, they do not typically have a finite number of elements, and while they all have finite ], so do many unbounded sets. Therefore this terminology is imprecise.}} The least such {{mvar|r}} is called the ] of {{mvar|M}}.

The space {{mvar|M}} is called ''precompact'' or '']'' if for every {{math|''r'' > 0}} there is a finite ] of {{mvar|M}} by open balls of radius {{mvar|r}}. Every totally bounded space is bounded. To see this, start with a finite cover by {{mvar|r}}-balls for some arbitrary {{mvar|r}}. Since the subset of {{mvar|M}} consisting of the centers of these balls is finite, it has finite diameter, say {{mvar|D}}. By the triangle inequality, the diameter of the whole space is at most {{math|''D'' + 2''r''}}. The converse does not hold: an example of a metric space that is bounded but not totally bounded is <math>\R^2</math> (or any other infinite set) with the discrete metric.

===Compactness===
{{Main|Compact space}}
Compactness is a topological property which generalizes the properties of a closed and bounded subset of Euclidean space. There are several equivalent definitions of compactness in metric spaces:
# A metric space {{mvar|M}} is compact if every open cover has a finite subcover (the usual topological definition).
# A metric space {{mvar|M}} is compact if every sequence has a convergent subsequence. (For general topological spaces this is called ] and is not equivalent to compactness.)
# A metric space {{mvar|M}} is compact if it is complete and totally bounded. (This definition is written in terms of metric properties and does not make sense for a general topological space, but it is nevertheless topologically invariant since it is equivalent to compactness.)
One example of a compact space is the closed interval {{closed-closed|0, 1}}.

Compactness is important for similar reasons to completeness: it makes it easy to find limits. Another important tool is ], which shows that for any open cover of a compact space, every point is relatively deep inside one of the sets of the cover.
<!-- does this need to be in the main metric space article?

Every compact metric space is ], and is a continuous image of the ]. (The latter result is due to ] and ].)

===Locally compact and proper spaces===
A space is said to be '']'' if every point has a compact neighborhood. Euclidean spaces are locally compact, but infinite-dimensional ]s are not.

A metric space is ] if every ''closed ball'' <math>\{y\, \colon d(x,y)\leq r\}</math> is compact. A space is proper if and only if it is complete and locally compact.-->

==Functions between metric spaces==
] of types of functions between metric spaces.]]
Unlike in the case of topological spaces or algebraic structures such as ]s or ]s, there is no single "right" type of ] between metric spaces. Instead, one works with different types of functions depending on one's goals. Throughout this section, suppose that <math>(M_1,d_1)</math> and <math>(M_2,d_2)</math> are two metric spaces. The words "function" and "map" are used interchangeably.

===Isometries===
{{main|Isometry}}
One interpretation of a "structure-preserving" map is one that fully preserves the distance function:
: A function <math>f:M_1 \to M_2</math> is ''distance-preserving''{{sfn|Burago|Burago|Ivanov|2001|p=2}} if for every pair of points {{mvar|x}} and {{mvar|y}} in {{math|''M''<sub>1</sub>}}, <math display="block">d_2(f(x),f(y))=d_1(x,y).</math>
It follows from the metric space axioms that a distance-preserving function is injective. A bijective distance-preserving function is called an ''isometry''.<ref>{{harvnb|Burago|Burago|Ivanov|2001|p=2}}.<br/>Some authors refer to any distance-preserving function as an isometry, e.g. {{harvnb|Munkres|2000|p=181}}.</ref> One perhaps non-obvious example of an isometry between spaces described in this article is the map <math>f:(\R^2,d_1) \to (\R^2,d_\infty)</math> defined by
<math display="block">f(x,y)=(x+y,x-y).</math>

If there is an isometry between the spaces {{math|''M''<sub>1</sub>}} and {{math|''M''<sub>2</sub>}}, they are said to be ''isometric''. Metric spaces that are isometric are ].

===Continuous maps===
{{Main|Continuous function (topology)}}
On the other end of the spectrum, one can forget entirely about the metric structure and study ], which only preserve topological structure. There are several equivalent definitions of continuity for metric spaces. The most important are:
* '''Topological definition.''' A function <math>f\,\colon M_1\to M_2</math> is continuous if for every open set {{mvar|U}} in {{math|''M''<sub>2</sub>}}, the ] <math>f^{-1}(U)</math> is open.
* '''].''' A function <math>f\,\colon M_1\to M_2</math> is continuous if whenever a sequence {{math|(''x<sub>n</sub>'')}} converges to a point {{mvar|x}} in {{math|''M''<sub>1</sub>}}, the sequence <math>f(x_1),f(x_2),\ldots</math> converges to the point {{math|''f''(''x'')}} in {{math|''M''<sub>2</sub>}}.
: (These first two definitions are ''not'' equivalent for all topological spaces.)
* '''ε–δ definition.''' A function <math>f\,\colon M_1\to M_2</math> is continuous if for every point {{mvar|x}} in {{math|''M''<sub>1</sub>}} and every {{math|ε > 0}} there exists {{math|δ > 0}} such that for all {{mvar|y}} in {{math|''M''<sub>1</sub>}} we have <math display="block">d_1(x,y) < \delta \implies d_2(f(x),f(y)) < \varepsilon.</math>
A '']'' is a continuous bijection whose inverse is also continuous; if there is a homeomorphism between {{math|''M''<sub>1</sub>}} and {{math|''M''<sub>2</sub>}}, they are said to be ''homeomorphic''. Homeomorphic spaces are the same from the point of view of topology, but may have very different metric properties. For example, <math>\R</math> is unbounded and complete, while {{open-open|0, 1}} is bounded but not complete.

===Uniformly continuous maps===
{{main|Uniform continuity}}
A function <math>f\,\colon M_1\to M_2</math> is '']'' if for every real number {{math|ε > 0}} there exists {{math|δ > 0}} such that for all points {{mvar|x}} and {{mvar|y}} in {{math|''M''<sub>1</sub>}} such that <math>d(x,y)<\delta</math>, we have <math display="block">d_2(f(x),f(y)) < \varepsilon.</math>

The only difference between this definition and the ε–δ definition of continuity is the order of quantifiers: the choice of δ must depend only on ε and not on the point {{mvar|x}}. However, this subtle change makes a big difference. For example, uniformly continuous maps take Cauchy sequences in {{math|''M''<sub>1</sub>}} to Cauchy sequences in {{math|''M''<sub>2</sub>}}. In other words, uniform continuity preserves some metric properties which are not purely topological.

On the other hand, the ] states that if {{math|''M''<sub>1</sub>}} is compact, then every continuous map is uniformly continuous. In other words, uniform continuity cannot distinguish any non-topological features of compact metric spaces.

===Lipschitz maps and contractions===
{{Main|Lipschitz continuity}}

A ] is one that stretches distances by at most a bounded factor. Formally, given a real number {{math|''K'' > 0}}, the map <math>f\,\colon M_1\to M_2</math> is {{mvar|K}}-''Lipschitz'' if
<math display="block">d_2(f(x),f(y))\leq K d_1(x,y)\quad\text{for all}\quad x,y\in M_1.</math>
Lipschitz maps are particularly important in metric geometry, since they provide more flexibility than distance-preserving maps, but still make essential use of the metric.{{sfn|Gromov|2007|p=xvii}} For example, a curve in a metric space is ] (has finite length) if and only if it has a Lipschitz reparametrization.

A 1-Lipschitz map is sometimes called a ''nonexpanding'' or '']''. Metric maps are commonly taken to be the morphisms of the ].

A {{mvar|K}}-Lipschitz map for {{math|''K'' < 1}} is called a '']''. The ] states that if {{mvar|M}} is a complete metric space, then every contraction <math>f:M \to M</math> admits a unique ]. If the metric space {{mvar|M}} is compact, the result holds for a slightly weaker condition on {{mvar|f}}: a map <math>f:M \to M</math> admits a unique fixed point if
<math display="block"> d(f(x), f(y)) < d(x, y) \quad \mbox{for all} \quad x \ne y \in M_1.</math>

===Quasi-isometries===
{{Main|Quasi-isometry}}
A ] is a map that preserves the "large-scale structure" of a metric space. Quasi-isometries need not be continuous. For example, <math>\R^2</math> and its subspace <math>\Z^2</math> are quasi-isometric, even though one is connected and the other is discrete. The equivalence relation of quasi-isometry is important in ]: the ] states that all spaces on which a group ] are quasi-isometric.{{sfn|Margalit|Thomas|2017}}

Formally, the map <math>f\,\colon M_1\to M_2</math> is a ''quasi-isometric embedding'' if there exist constants {{math|''A'' ≥ 1}} and {{math|''B'' ≥ 0}} such that
<math display="block">\frac{1}{A} d_2(f(x),f(y))-B\leq d_1(x,y)\leq A d_2(f(x),f(y))+B \quad\text{ for all }\quad x,y\in M_1.</math>
It is a ''quasi-isometry'' if in addition it is ''quasi-surjective'', i.e. there is a constant {{math|''C'' ≥ 0}} such that every point in <math>M_2</math> is at distance at most {{mvar|C}} from some point in the image <math>f(M_1)</math>.

===Notions of metric space equivalence===
{{See also|Equivalence of metrics}}
Given two metric spaces <math>(M_1, d_1)</math> and <math>(M_2, d_2)</math>:
*They are called '''homeomorphic''' (topologically isomorphic) if there is a ] between them (i.e., a continuous ] with a continuous inverse). If <math>M_1=M_2</math> and the identity map is a homeomorphism, then <math>d_1</math> and <math>d_2</math> are said to be '''topologically equivalent'''.
*They are called '''uniformic''' (uniformly isomorphic) if there is a ] between them (i.e., a uniformly continuous bijection with a uniformly continuous inverse).
*They are called '''bilipschitz homeomorphic''' if there is a bilipschitz bijection between them (i.e., a Lipschitz bijection with a Lipschitz inverse).
*They are called '''isometric''' if there is a (bijective) ] between them. In this case, the two metric spaces are essentially identical.
*They are called '''quasi-isometric''' if there is a ] between them.

== Metric spaces with additional structure ==
=== Normed vector spaces ===
{{anchor|Norm induced metric|Relation of norms and metrics}}
{{Main|Normed vector space}}
A ] is a vector space equipped with a '']'', which is a function that measures the length of vectors. The norm of a vector {{mvar|v}} is typically denoted by <math>\lVert v \rVert</math>. Any normed vector space can be equipped with a metric in which the distance between two vectors {{mvar|x}} and {{mvar|y}} is given by
<math display="block">d(x,y):=\lVert x-y \rVert.</math>
The metric {{mvar|d}} is said to be ''induced'' by the norm <math>\lVert{\cdot}\rVert</math>. Conversely,{{sfn|Narici|Beckenstein|2011|pp=47–66}} if a metric {{mvar|d}} on a ] {{mvar|X}} is
* translation invariant: <math>d(x,y) = d(x+a,y+a)</math> for every {{mvar|x}}, {{mvar|y}}, and {{mvar|a}} in {{mvar|X}}; and
* ]: <math>d(\alpha x, \alpha y) = |\alpha| d(x,y)</math> for every {{mvar|x}} and {{mvar|y}} in {{mvar|X}} and real number {{math|α}};
then it is the metric induced by the norm
<math display="block">\lVert x \rVert := d(x,0).</math>
A similar relationship holds between ]s and ]s.

Among examples of metrics induced by a norm are the metrics {{math|''d''<sub>1</sub>}}, {{math|''d''<sub>2</sub>}}, and {{math|''d''<sub>∞</sub>}} on <math>\R^2</math>, which are induced by the ], the ], and the ], respectively. More generally, the ] allows one to see any metric space as a subspace of a normed vector space.

Infinite-dimensional normed vector spaces, particularly spaces of functions, are studied in ]. Completeness is particularly important in this context: a complete normed vector space is known as a ]. An unusual property of normed vector spaces is that ]s between them are continuous if and only if they are Lipschitz. Such transformations are known as ]s.

=== Length spaces ===
].]]
{{Main|Intrinsic metric}}
A ] in a metric space {{math|(''M'', ''d'')}} is a continuous function <math>\gamma: \to M</math>. The ] of {{math|γ}} is measured by
<math display="block">L(\gamma)=\sup_{0=x_0<x_1<\cdots<x_n=T} \left\{\sum_{k=1}^n d(\gamma(x_{k-1}),\gamma(x_k))\right\}.</math>
In general, this supremum may be infinite; a curve of finite length is called ''rectifiable''.{{sfn|Burago|Burago|Ivanov|2001|loc=Definition 2.3.1}} Suppose that the length of the curve {{math|γ}} is equal to the distance between its endpoints—that is, it is the shortest possible path between its endpoints. After reparametrization by arc length, {{math|γ}} becomes a '']'': a curve which is a distance-preserving function.{{sfn|Margalit|Thomas|2017}} A geodesic is a shortest possible path between any two of its points.{{efn|This differs from usage in ], where geodesics are only locally shortest paths. Some authors define geodesics in metric spaces in the same way.{{sfn|Burago|Burago|Ivanov|2001|loc=Definition 2.5.27}}{{sfn|Gromov|2007|loc=Definition 1.9}}}}

A ''geodesic metric space'' is a metric space which admits a geodesic between any two of its points. The spaces <math>(\R^2,d_1)</math> and <math>(\R^2,d_2)</math> are both geodesic metric spaces. In <math>(\R^2,d_2)</math>, geodesics are unique, but in <math>(\R^2,d_1)</math>, there are often infinitely many geodesics between two points, as shown in the figure at the top of the article.

The space {{mvar|M}} is a '']'' (or the metric {{mvar|d}} is ''intrinsic'') if the distance between any two points {{mvar|x}} and {{mvar|y}} is the infimum of lengths of paths between them. Unlike in a geodesic metric space, the infimum does not have to be attained. An example of a length space which is not geodesic is the Euclidean plane minus the origin: the points {{math|(1, 0)}} and {{math|(-1, 0)}} can be joined by paths of length arbitrarily close to 2, but not by a path of length 2. An example of a metric space which is not a length space is given by the straight-line metric on the sphere: the straight line between two points through the center of the Earth is shorter than any path along the surface.

Given any metric space {{math|(''M'', ''d'')}}, one can define a new, intrinsic distance function {{math|''d''<sub>intrinsic</sub>}} on {{mvar|M}} by setting the distance between points {{mvar|x}} and {{mvar|y}} to be the infimum of the {{mvar|d}}-lengths of paths between them. For instance, if {{mvar|d}} is the straight-line distance on the sphere, then {{math|''d''<sub>intrinsic</sub>}} is the great-circle distance. However, in some cases {{math|''d''<sub>intrinsic</sub>}} may have infinite values. For example, if {{mvar|M}} is the ] with the subspace metric {{mvar|d}} induced from <math>\R^2</math>, then the resulting intrinsic distance is infinite for any pair of distinct points.

=== Riemannian manifolds ===
{{Main|Riemannian manifold}}
A ] is a space equipped with a Riemannian ], which determines lengths of ] at every point. This can be thought of defining a notion of distance infinitesimally. In particular, a differentiable path <math>\gamma: \to M</math> in a Riemannian manifold {{mvar|M}} has length defined as the integral of the length of the tangent vector to the path:
<math display="block">L(\gamma)=\int_0^T |\dot\gamma(t)|dt.</math>
On a connected Riemannian manifold, one then defines the distance between two points as the infimum of lengths of smooth paths between them. This construction generalizes to other kinds of infinitesimal metrics on manifolds, such as ] and ].

The Riemannian metric is uniquely determined by the distance function; this means that in principle, all information about a Riemannian manifold can be recovered from its distance function. One direction in metric geometry is finding purely metric (]) formulations of properties of Riemannian manifolds. For example, a Riemannian manifold is a ] (a synthetic condition which depends purely on the metric) if and only if its ] is bounded above by {{mvar|k}}.{{sfn|Burago|Burago|Ivanov|2001|p=127}} Thus {{math|CAT(''k'')}} spaces generalize upper curvature bounds to general metric spaces.

=== Metric measure spaces ===

Real analysis makes use of both the metric on <math>\R^n</math> and the ]. Therefore, generalizations of many ideas from analysis naturally reside in ]s: spaces that have both a ] and a metric which are compatible with each other. Formally, a ''metric measure space'' is a metric space equipped with a ] such that every ball has positive measure.{{sfn|Heinonen|2007|p=191}} For example Euclidean spaces of dimension {{mvar|n}}, and more generally {{mvar|n}}-dimensional Riemannian manifolds, naturally have the structure of a metric measure space, equipped with the ]. Certain ] metric spaces such as the ] can be equipped with the α-dimensional ] where α is the ]. In general, however, a metric space may not have an "obvious" choice of measure.

One application of metric measure spaces is generalizing the notion of ] beyond Riemannian manifolds. Just as {{math|CAT(''k'')}} and ]s generalize sectional curvature bounds, ]s are a class of metric measure spaces which generalize lower bounds on Ricci curvature.<ref>{{cite journal |last1=Gigli |first1=Nicola |title=Lecture notes on differential calculus on RCD spaces |journal=Publications of the Research Institute for Mathematical Sciences |date=18 October 2018 |volume=54 |issue=4 |pages=855–918 |doi=10.4171/PRIMS/54-4-4 |arxiv=1703.06829|s2cid=119129867 }}</ref>

== Further examples and applications ==
=== Graphs and finite metric spaces ===
A {{visible anchor|metric space is ''discrete''|Discrete metric space}} if its induced topology is the ]. Although many concepts, such as completeness and compactness, are not interesting for such spaces, they are nevertheless an object of study in several branches of mathematics. In particular, {{visible anchor|finite metric spaces|Finite metric space}} (those having a ] number of points) are studied in ] and ].<ref>{{cite book |chapter=Finite metric-spaces—combinatorics, geometry and algorithms |last1=Linial |first1=Nathan |author-link1=Nati Linial |title=Proceedings of the ICM, Beijing 2002 |year=2003 |volume=3 |pages=573–586 |arxiv=math/0304466}}</ref> Embeddings in other metric spaces are particularly well-studied. For example, not every finite metric space can be ] in a Euclidean space or in ]. On the other hand, in the worst case the required distortion (bilipschitz constant) is only logarithmic in the number of points.<ref>{{cite journal|doi=10.1007/BF02776078|doi-access=|title=On lipschitz embedding of finite metric spaces in Hilbert space|year=1985|last1=Bourgain|first1=J. |author-link1=Jean Bourgain |journal=]|volume=52|issue=1–2|pages=46–52|s2cid=121649019}}</ref><ref>] and ], ed. . {{webarchive|url=https://web.archive.org/web/20101226232112/http://kam.mff.cuni.cz/~matousek/metrop.ps |date=2010-12-26 }}.</ref>

For any ] {{mvar|G}}, the set {{mvar|V}} of vertices of {{mvar|G}} can be turned into a metric space by defining the ] between vertices {{mvar|x}} and {{mvar|y}} to be the length of the shortest edge path connecting them. This is also called ''shortest-path distance'' or ''geodesic distance''. In ] this construction is applied to the ] of a (typically infinite) ], yielding the ]. Up to a bilipschitz homeomorphism, the word metric depends only on the group and not on the chosen finite generating set.{{sfn|Margalit|Thomas|2017}}

=== Metric embeddings and approximations ===

An important area of study in finite metric spaces is the embedding of complex metric spaces into simpler ones while controlling the distortion of distances. This is particularly useful in computer science and discrete mathematics, where algorithms often perform more efficiently on simpler structures like tree metrics.

A significant result in this area is that any finite metric space can be probabilistically embedded into a ''tree metric'' with an expected distortion of <math>O(log n)</math>, where <math>n</math> is the number of points in the metric space.<ref>{{cite journal|last1=Fakcharoenphol|first1=J.|last2=Rao|first2=S.|last3=Talwar|first3=K.|year=2004|title=A tight bound on approximating arbitrary metrics by tree metrics|journal=Journal of Computer and System Sciences|volume=69|issue=3|pages=485–497|doi=10.1016/j.jcss.2004.04.011}}</ref>

This embedding is notable because it achieves the best possible asymptotic bound on distortion, matching the lower bound of <math>\Omega(log n)</math>. The tree metrics produced in this embedding ''dominate'' the original metrics, meaning that distances in the tree are greater than or equal to those in the original space. This property is particularly useful for designing approximation algorithms, as it allows for the preservation of distance-related properties while simplifying the underlying structure.

The result has significant implications for various computational problems:

* '''Network design''': Improves approximation algorithms for problems like the ''Group Steiner tree problem'' (a generalization of the '']'') and ''Buy-at-bulk network design'' (a problem in '']'') by simplifying the metric space to a tree metric.
* '''Clustering''': Enhances algorithms for clustering problems where hierarchical clustering can be performed more efficiently on tree metrics.
* '''Online algorithms''': Benefits problems like the '']'' and '']'' by providing better competitive ratios through simplified metrics.

The technique involves constructing a hierarchical decomposition of the original metric space and converting it into a tree metric via a randomized algorithm. The <math>O(log n)</math> distortion bound has led to improved ]s in several algorithmic problems, demonstrating the practical significance of this theoretical result.

=== Distances between mathematical objects ===
In modern mathematics, one often studies spaces whose points are themselves mathematical objects. A distance function on such a space generally aims to measure the dissimilarity between two objects. Here are some examples:
* '''Functions to a metric space.''' If {{mvar|X}} is any set and {{mvar|M}} is a metric space, then the set of all ]s <math>f \colon X \to M</math> (i.e. those functions whose image is a ] of <math>M</math>) can be turned into a metric space by defining the distance between two bounded functions {{mvar|f}} and {{mvar|g}} to be <math display="block">d(f,g) = \sup_{x \in X} d(f(x),g(x)).</math> This metric is called the ] or supremum metric.{{sfn|Ó Searcóid|2006|p=107}} If {{mvar|M}} is complete, then this ] is complete as well; moreover, if {{mvar|X}} is also a topological space, then the subspace consisting of all bounded ] functions from {{mvar|X}} to {{mvar|M}} is also complete. When {{mvar|X}} is a subspace of <math>\R^n</math>, this function space is known as a ].
* ''']s and ]s.''' There are many ways of measuring distances between ], which may represent ]s in ] or ]s in ]. ''Edit distances'' attempt to measure the number of changes necessary to get from one string to another. For example, the ] measures the minimal number of substitutions needed, while the ] measures the minimal number of deletions, insertions, and substitutions; both of these can be thought of as distances in an appropriate graph.
* ] is a measure of dissimilarity between two ], defined as the minimal number of ] required to transform one graph into another.
* ]s measure the distance between two ]s on the same metric space. The Wasserstein distance between two measures is, roughly speaking, the ] one to the other.
* The set of all {{mvar|m}} by {{mvar|n}} ] over some ] is a metric space with respect to the ] distance <math>d(A,B) = \mathrm{rank}(B - A)</math>.
* The ] in ] measures the difference between ] in a game.

=== Hausdorff and Gromov–Hausdorff distance ===
The idea of spaces of mathematical objects can also be applied to subsets of a metric space, as well as metric spaces themselves. ] and ] define metrics on the set of compact subsets of a metric space and the set of compact metric spaces, respectively.

{{anchor|Distance to a set}}
Suppose {{math|(''M'', ''d'')}} is a metric space, and let {{mvar|S}} be a subset of {{mvar|M}}. The ''distance from {{mvar|S}} to a point {{mvar|x}} of {{mvar|M}}'' is, informally, the distance from {{mvar|x}} to the closest point of {{mvar|S}}. However, since there may not be a single closest point, it is defined via an ]:
<math display="block">d(x,S) = \inf\{d(x,s) : s \in S \}.</math>
In particular, <math>d(x, S)=0</math> if and only if {{mvar|x}} belongs to the ] of {{mvar|S}}. Furthermore, distances between points and sets satisfy a version of the triangle inequality:
<math display="block">d(x,S) \leq d(x,y) + d(y,S),</math>
and therefore the map <math>d_S:M \to \R</math> defined by <math>d_S(x)=d(x,S)</math> is continuous. Incidentally, this shows that metric spaces are ].

Given two subsets {{mvar|S}} and {{mvar|T}} of {{mvar|M}}, their ''Hausdorff distance'' is
<math display="block">d_H(S,T) = \max \{ \sup\{d(s,T) : s \in S \} , \sup\{ d(t,S) : t \in T \} \}.</math>
Informally, two sets {{mvar|S}} and {{mvar|T}} are close to each other in the Hausdorff distance if no element of {{mvar|S}} is too far from {{mvar|T}} and vice versa. For example, if {{mvar|S}} is an open set in Euclidean space {{mvar|T}} is an ] inside {{mvar|S}}, then <math>d_H(S,T)<\varepsilon</math>. In general, the Hausdorff distance <math>d_H(S,T)</math> can be infinite or zero. However, the Hausdorff distance between two distinct compact sets is always positive and finite. Thus the Hausdorff distance defines a metric on the set of compact subsets of {{mvar|M}}.

The Gromov–Hausdorff metric defines a distance between (isometry classes of) compact metric spaces. The ''Gromov–Hausdorff distance'' between compact spaces {{mvar|X}} and {{mvar|Y}} is the infimum of the Hausdorff distance over all metric spaces {{mvar|Z}} that contain {{mvar|X}} and {{mvar|Y}} as subspaces. While the exact value of the Gromov–Hausdorff distance is rarely useful to know, the resulting topology has found many applications.

=== Miscellaneous examples === <!-- the goal is to remove these or incorporate them under the various subheadings -->
* Given a metric space {{math|(''X'', ''d'')}} and an increasing ] <math>f \colon [0,\infty) \to [0,\infty)</math> such that {{math|''f''(''t'') {{=}} 0}} if and only if {{math|''t'' {{=}} 0}}, then <math>d_f(x,y)=f(d(x,y))</math> is also a metric on {{mvar|X}}. If {{math|''f''(''t'') {{=}} ''t''<sup>α</sup>}} for some real number {{math|α < 1}}, such a metric is known as a '''snowflake''' of {{mvar|d}}.<ref>{{cite conference |last1=Gottlieb |first1=Lee-Ad |last2=Solomon |first2=Shay |title=Light spanners for snowflake metrics |conference=SOCG '14: Proceedings of the thirtieth annual symposium on Computational geometry |date=8 June 2014 |pages=387–395 |doi=10.1145/2582112.2582140|arxiv=1401.5014 }}</ref>
* The ] of a metric space is another metric space which can be thought of as an abstract version of the ].
* The ''knight's move metric'', the minimal number of knight's moves to reach one point in <math>\mathbb{Z}^2</math> from another, is a metric on <math>\mathbb{Z}^2</math>.
* {{anchor|SNCF}}The ] metric (also called the "post office metric" or the "]") on a ] is given by <math>d(x,y) = \lVert x \rVert + \lVert y \rVert</math> for distinct points <math>x</math> and <math>y</math>, and <math>d(x,x) = 0</math>. More generally <math>\lVert \cdot \rVert</math> can be replaced with a function <math>f</math> taking an arbitrary set <math>S</math> to non-negative reals and taking the value <math>0</math> at most once: then the metric is defined on <math>S</math> by <math>d(x,y) = f(x) + f(y)</math> for distinct points <math>x</math> and <math>y</math>, and {{nowrap|<math>d(x,x) = 0</math>.}} The name alludes to the tendency of railway journeys to proceed via London (or Paris) irrespective of their final destination.<!-- source? -->
* The ] used for calculating the distances between ]s in ]<ref>{{Cite journal|last1=Robinson|first1=D.F.|last2=Foulds|first2=L.R.|date=February 1981|title=Comparison of phylogenetic trees|url=https://linkinghub.elsevier.com/retrieve/pii/0025556481900432|journal=Mathematical Biosciences|language=en|volume=53|issue=1–2|pages=131–147|doi=10.1016/0025-5564(81)90043-2|s2cid=121156920 |url-access=subscription}}</ref>

==Constructions==
===Product metric spaces===
{{main|Product metric}}
If <math>(M_1,d_1),\ldots,(M_n,d_n)</math> are metric spaces, and {{mvar|N}} is the ] on <math>\mathbb R^n</math>, then <math>\bigl(M_1 \times \cdots \times M_n, d_\times\bigr)</math> is a metric space, where the ] is defined by
<math display="block">d_\times\bigl((x_1,\ldots,x_n),(y_1,\ldots,y_n)\bigr) = N\bigl(d_1(x_1,y_1),\ldots,d_n(x_n,y_n)\bigr),</math>
and the induced topology agrees with the ]. By the equivalence of norms in finite dimensions, a topologically equivalent metric is obtained if {{mvar|N}} is the ], a ], the ], or any other norm which is non-decreasing as the coordinates of a positive {{mvar|n}}-tuple increase (yielding the triangle inequality).

Similarly, a metric on the topological product of countably many metric spaces can be obtained using the metric
<math display="block">d(x,y)=\sum_{i=1}^\infty \frac1{2^i}\frac{d_i(x_i,y_i)}{1+d_i(x_i,y_i)}.</math>

The topological product of uncountably many metric spaces need not be metrizable. For example, an uncountable product of copies of <math>\mathbb{R}</math> is not ] and thus is not metrizable.

===Quotient metric spaces===
If {{mvar|M}} is a metric space with metric {{mvar|d}}, and <math>\sim</math> is an ] on {{mvar|M}}, then we can endow the quotient set <math>M/\!\sim</math> with a pseudometric. The distance between two equivalence classes <math></math> and <math></math> is defined as
<math display="block">d'(,) = \inf\{d(p_1,q_1)+d(p_2,q_2)+\dotsb+d(p_{n},q_{n})\},</math>
where the ] is taken over all finite sequences <math>(p_1, p_2, \dots, p_n)</math> and <math>(q_1, q_2, \dots, q_n)</math> with <math>p_1 \sim x</math>, <math>q_n \sim y</math>, <math>q_i \sim p_{i+1}, i=1,2,\dots, n-1</math>.{{sfn|Burago|Burago|Ivanov|2001|loc=Definition 3.1.12}} In general this will only define a ], i.e. <math>d'(,)=0</math> does not necessarily imply that <math>=</math>. However, for some equivalence relations (e.g., those given by gluing together polyhedra along faces), <math>d'</math> is a metric.

The quotient metric <math>d'</math> is characterized by the following ]. If <math>f\,\colon(M,d)\to(X,\delta)</math> is a metric (i.e. 1-Lipschitz) map between metric spaces satisfying {{math|''f''(''x'') {{=}} ''f''(''y'')}} whenever <math>x \sim y</math>, then the induced function <math>\overline{f}\,\colon {M/\sim}\to X</math>, given by <math>\overline{f}()=f(x)</math>, is a metric map <math>\overline{f}\,\colon (M/\sim,d')\to (X,\delta).</math>

The quotient metric does not always induce the ]. For example, the topological quotient of the metric space <math>\N \times </math> identifying all points of the form <math>(n, 0)</math> is not metrizable since it is not ], but the quotient metric is a well-defined metric on the same set which induces a ]. Moreover, different metrics on the original topological space (a disjoint union of countably many intervals) lead to different topologies on the quotient.<ref>See {{harvnb|Burago|Burago|Ivanov|2001|loc=Example 3.1.17}}, although in this book the quotient <math>\N \times /\N \times \{0\}</math> is incorrectly claimed to be homeomorphic to the topological quotient.</ref>

A topological space is ] if and only if it is a (topological) quotient of a metric space.<ref>Goreham, Anthony. {{webarchive|url=https://web.archive.org/web/20110604232111/http://at.yorku.ca/p/a/a/o/51.pdf |date=2011-06-04 }}. Honours' Dissertation, Queen's College, Oxford (April, 2001), p. 14</ref>

==Generalizations of metric spaces==

There are several notions of spaces which have less structure than a metric space, but more than a topological space.
* ]s are spaces in which distances are not defined, but uniform continuity is.
* ]s are spaces in which point-to-set distances are defined, instead of point-to-point distances. They have particularly good properties from the point of view of ].
* ]s are a generalization of metric spaces and ]s that can be used to unify the notions of metric spaces and ]s.

There are also numerous ways of relaxing the axioms for a metric, giving rise to various notions of generalized metric spaces. These generalizations can also be combined. The terminology used to describe them is not completely standardized. Most notably, in ] pseudometrics often come from ]s on vector spaces, and so it is natural to call them "semimetrics". This conflicts with the use of the term in ].

=== Extended metrics ===
Some authors define metrics so as to allow the distance function {{mvar|d}} to attain the value ∞, i.e. distances are non-negative numbers on the ].{{sfn|Burago|Burago|Ivanov|2001|p=1}} Such a function is also called an ''extended metric'' or "∞-metric". Every extended metric can be replaced by a real-valued metric that is topologically equivalent. This can be done using a ] monotonically increasing bounded function which is zero at zero, e.g. <math>d'(x, y) = d(x, y) / (1 + d(x, y))</math> or <math>d''(x, y) = \min(1, d(x, y))</math>.

=== Metrics valued in structures other than the real numbers ===
The requirement that the metric take values in <math>[0,\infty)</math> can be relaxed to consider metrics with values in other structures, including:
* ]s, yielding the notion of a ].
* More general ]s. In the absence of an addition operation, the triangle inequality does not make sense and is replaced with an ]. This leads to the notion of a ''generalized ultrametric''.{{sfn|Hitzler|Seda|2016|loc=Definition 4.3.1}}
These generalizations still induce a ] on the space.

===Pseudometrics===
{{Main|Pseudometric space}}
A ''pseudometric'' on <math>X</math> is a function <math>d: X \times X \to \R</math> which satisfies the axioms for a metric, except that instead of the second (identity of indiscernibles) only <math>d(x,x)=0</math> for all ''<math>x</math>'' is required.{{sfn|Hitzler|Seda|2016|loc=Definition 4.2.1}} In other words, the axioms for a pseudometric are:

# <math>d(x, y) \geq 0</math>
# <math>d(x,x)=0</math>
# <math>d(x,y)=d(y,x)</math>
# <math>d(x,z)\leq d(x,y) + d(y,z)</math>.

In some contexts, pseudometrics are referred to as ''semimetrics''{{sfn|Burago|Burago|Ivanov|2001|loc=Definition 1.1.4}} because of their relation to ]s.

===Quasimetrics===
Occasionally, a '''quasimetric''' is defined as a function that satisfies all axioms for a metric with the possible exception of symmetry.<ref>{{harvtxt|Steen|Seebach|1995}}; {{harvtxt|Smyth|1988}}</ref> The name of this generalisation is not entirely standardized.<ref>{{harvtxt|Rolewicz|1987}} calls them "semimetrics". That same term is also frequently used for two other generalizations of metrics.</ref>

# <math>d(x, y) \geq 0</math>
# <math>d(x,y)=0 \iff x=y </math>
# <math>d(x,z) \leq d(x,y) + d(y,z)</math>

Quasimetrics are common in real life. For example, given a set {{mvar|X}} of mountain villages, the typical walking times between elements of {{mvar|X}} form a quasimetric because travel uphill takes longer than travel downhill. Another example is the ] in a city with one-way streets: here, a shortest path from point {{mvar|A}} to point {{mvar|B}} goes along a different set of streets than a shortest path from {{mvar|B}} to {{mvar|A}} and may have a different length.

A quasimetric on the reals can be defined by setting
<math display="block">d(x,y)=\begin{cases}
x-y & \text{if }x\geq y,\\
1 & \text{otherwise.}
\end{cases}</math>
The 1 may be replaced, for example, by infinity or by <math>1 + \sqrt{y-x}</math> or any other ] function of {{math|''y''-''x''}}. This quasimetric describes the cost of modifying a metal stick: it is easy to reduce its size by ], but it is difficult or impossible to grow it.

Given a quasimetric on {{mvar|X}}, one can define an {{mvar|R}}-ball around {{mvar|x}} to be the set <math>\{y \in X | d(x,y) \leq R\}</math>. As in the case of a metric, such balls form a basis for a topology on {{mvar|X}}, but this topology need not be metrizable. For example, the topology induced by the quasimetric on the reals described above is the (reversed) ].

===Metametrics or partial metrics===

In a ''metametric'', all the axioms of a metric are satisfied except that the distance between identical points is not necessarily zero. In other words, the axioms for a metametric are:

# <math>d(x,y)\geq 0</math>
# <math>d(x,y)=0 \implies x=y</math>
# <math>d(x,y)=d(y,x)</math>
# <math>d(x,z)\leq d(x,y)+d(y,z).</math>

Metametrics appear in the study of ] and their boundaries. The ''visual metametric'' on such a space satisfies <math>d(x,x)=0</math> for points <math>x</math> on the boundary, but otherwise <math>d(x,x)</math> is approximately the distance from ''<math>x</math>'' to the boundary. Metametrics were first defined by Jussi Väisälä.{{sfn|Väisälä|2005}} In other work, a function satisfying these axioms is called a ''partial metric''<ref>{{cite web|url=http://www.dcs.warwick.ac.uk/pmetric/|title=Partial metrics: welcome|website=www.dcs.warwick.ac.uk|access-date=2 May 2018|url-status=live|archive-url=https://web.archive.org/web/20170727003912/http://www.dcs.warwick.ac.uk/pmetric/|archive-date=27 July 2017}}</ref><ref>{{cite journal |last1=Bukatin |first1=Michael |last2=Kopperman |first2=Ralph |last3=Matthews |first3=Steve |last4=Pajoohesh |first4=Homeira |title=Partial Metric Spaces |journal=American Mathematical Monthly |date=1 October 2009 |volume=116 |issue=8 |pages=708–718 |doi=10.4169/193009709X460831 |s2cid=13969183 |url=https://www.dcs.warwick.ac.uk/pmetric/monthly708-718.pdf}}</ref> or a ''dislocated metric''.{{sfn|Hitzler|Seda|2016|loc=Definition 4.2.1}}

===Semimetrics===
A '''semimetric''' on <math>X</math> is a function <math>d: X \times X \to \R</math> that satisfies the first three axioms, but not necessarily the triangle inequality:

# <math>d(x,y)\geq 0</math>
# <math>d(x,y)=0 \iff x=y</math>
# <math>d(x,y)=d(y,x)</math>

Some authors work with a weaker form of the triangle inequality, such as:

:{|
|<math>d(x,z)\leq \rho\,(d(x,y)+d(y,z))</math>
|ρ-relaxed triangle inequality
|-
|<math>d(x,z)\leq \rho\,\max\{d(x,y),d(y,z)\}</math>
|ρ-inframetric inequality
|}

The ρ-inframetric inequality implies the ρ-relaxed triangle inequality (assuming the first axiom), and the ρ-relaxed triangle inequality implies the 2ρ-inframetric inequality. Semimetrics satisfying these equivalent conditions have sometimes been referred to as ''quasimetrics'',{{sfn|Xia|2009}} ''nearmetrics''{{sfn|Xia|2008}} or '''inframetrics'''.{{sfn|Fraigniaud|Lebhar|Viennot|2008}}

The ρ-inframetric inequalities were introduced to model ]s in the ].{{sfn|Fraigniaud|Lebhar|Viennot|2008}} The triangle inequality implies the 2-inframetric inequality, and the ] is exactly the 1-inframetric inequality.

===Premetrics===
Relaxing the last three axioms leads to the notion of a '''premetric''', i.e. a function satisfying the following conditions:

# <math>d(x,y)\geq 0</math>
# <math>d(x,x)=0</math>

This is not a standard term. Sometimes it is used to refer to other generalizations of metrics such as pseudosemimetrics{{sfn|Buldygin|Kozachenko|2000}} or pseudometrics;{{sfn|Helemskii|2006}} in translations of Russian books it sometimes appears as "prametric".<ref>{{harvtxt|Arkhangel'skii|Pontryagin|1990}}; {{harvtxt|Aldrovandi|Pereira|2017}}</ref> A premetric that satisfies symmetry, i.e. a pseudosemimetric, is also called a distance.{{sfn|Deza|Laurent|1997}}

Any premetric gives rise to a topology as follows. For a positive real <math>r</math>, the {{Nobr|<math>r</math>-ball}} centered at a point <math>p</math> is defined as
:<math>B_r(p)=\{ x | d(x,p) < r \}.</math>
A set is called ''open'' if for any point ''<math>p</math>'' in the set there is an {{Nobr|<math>r</math>-ball}} centered at ''<math>p</math>'' which is contained in the set. Every premetric space is a topological space, and in fact a ].<!--I copied this claim from ] without checking-->
In general, the {{Nobr|<math>r</math>-balls}} themselves need not be open sets with respect to this topology.
As for metrics, the distance between two sets <math>A</math> and ''<math>B</math>'', is defined as
:<math>d(A,B)=\underset{x\in A, y\in B}\inf d(x,y).</math>
This defines a premetric on the ] of a premetric space. If we start with a (pseudosemi-)metric space, we get a pseudosemimetric, i.e. a symmetric premetric.
Any premetric gives rise to a ] <math>cl</math> as follows:
:<math>cl(A)=\{ x | d(x,A) = 0 \}.</math>

===Pseudoquasimetrics===
The prefixes ''pseudo-'', ''quasi-'' and ''semi-'' can also be combined, e.g., a '''pseudoquasimetric''' (sometimes called '''hemimetric''') relaxes both the indiscernibility axiom and the symmetry axiom and is simply a premetric satisfying the triangle inequality. For pseudoquasimetric spaces the open {{Nobr|<math>r</math>-balls}} form a basis of open sets. A very basic example of a pseudoquasimetric space is the set <math>\{0,1\}</math> with the premetric given by <math>d(0,1) = 1</math> and <math>d(1,0) = 0.</math> The associated topological space is the ].

Sets equipped with an extended pseudoquasimetric were studied by ] as "generalized metric spaces".<ref>{{harvtxt|Lawvere|1973}}; {{harvtxt|Vickers|2005}}</ref> From a ] point of view, the extended pseudometric spaces and the extended pseudoquasimetric spaces, along with their corresponding nonexpansive maps, are the best behaved of the ]. One can take arbitrary products and coproducts and form quotient objects within the given category. If one drops "extended", one can only take finite products and coproducts. If one drops "pseudo", one cannot take quotients.

Lawvere also gave an alternate definition of such spaces as ]. The ordered set <math>(\mathbb{R},\geq)</math> can be seen as a ] with one ] <math>a\to b</math> if <math>a\geq b</math> and none otherwise. Using {{math|+}} as the ] and 0 as the ] makes this category into a ] <math>R^*</math>.
Every (extended pseudoquasi-)metric space <math>(M,d)</math> can now be viewed as a category <math>M^*</math> enriched over <math>R^*</math>:
* The objects of the category are the points of {{mvar|M}}.
* For every pair of points {{mvar|x}} and {{mvar|y}} such that <math>d(x,y)<\infty</math>, there is a single morphism which is assigned the object <math>d(x,y)</math> of <math>R^*</math>.
* The triangle inequality and the fact that <math>d(x,x)=0</math> for all points {{mvar|x}} derive from the properties of composition and identity in an enriched category.
* Since <math>R^*</math> is a poset, all ] that are required for an enriched category commute automatically.

===Metrics on multisets===
The notion of a metric can be generalized from a distance between two elements to a number assigned to a multiset of elements. A ] is a generalization of the notion of a ] in which an element can occur more than once. Define the multiset union <math>U=XY</math> as follows: if an element {{mvar|x}} occurs {{mvar|m}} times in {{mvar|X}} and {{mvar|n}} times in {{mvar|Y}} then it occurs {{math|''m'' + ''n''}} times in {{mvar|U}}. A function {{mvar|d}} on the set of nonempty finite multisets of elements of a set {{mvar|M}} is a metric{{sfn|Vitányi|2011}} if
# <math>d(X)=0</math> if all elements of {{mvar|X}} are equal and <math>d(X) > 0</math> otherwise (])
# <math>d(X)</math> depends only on the (unordered) multiset {{mvar|X}} (])
# <math>d(XY) \leq d(XZ)+d(ZY)</math> (])
By considering the cases of axioms 1 and 2 in which the multiset {{mvar|X}} has two elements and the case of axiom 3 in which the multisets {{mvar|X}}, {{mvar|Y}}, and {{mvar|Z}} have one element each, one recovers the usual axioms for a metric. That is, every multiset metric yields an ordinary metric when restricted to sets of two elements.

A simple example is the set of all nonempty finite multisets <math>X</math> of integers with <math>d(X)=\max (X)- \min (X)</math>. More complex examples are ] in multisets;{{sfn|Vitányi|2011}} and ] (NCD) in multisets.{{sfn|Cohen|Vitányi|2012}}


==See also== ==See also==
* {{Annotated link|Acoustic metric}}
*]
* {{Annotated link|Complete metric space}}
*]
* {{annotated link|Diversity (mathematics)}}
*]
* ]
*], ] and ]
* {{annotated link|Hilbert's fourth problem}}
*]
* {{annotated link|Metric tree}}
* {{annotated link|Minkowski distance}}
* {{Annotated link|Signed distance function}}
* {{Annotated link|Similarity measure}}
* {{annotated link|Space (mathematics)}}
* {{annotated link|Ultrametric space}}

==Notes==
{{notelist}}

==Citations==
{{reflist}}

==References==
{{refbegin}}
*{{citation
| last1 = Aldrovandi | first1 = Ruben
| last2 = Pereira | first2 = José Geraldo
| edition = 2nd
| isbn = 978-981-3146-81-5
| location = Hackensack, New Jersey
| mr = 3561561
| page = 20
| publisher = World Scientific
| title = An Introduction to Geometrical Physics
| url = https://books.google.com/books?id=NWhtDQAAQBAJ&pg=PA20
| year = 2017}}
*{{citation
| last1 = Arkhangel'skii | first1 = A. V. | author1-link = Alexander Arhangelskii
| last2 = Pontryagin | first2 = L. S. | author2-link = Lev Pontryagin
| isbn = 3-540-18178-4
| publisher = ]
| series = Encyclopaedia of Mathematical Sciences
| title = General Topology I: Basic Concepts and Constructions Dimension Theory
| year = 1990}}
* {{cite book |last1=Bryant |first1=Victor |title=Metric spaces: Iteration and application |date=1985 |publisher=Cambridge University Press |isbn=0-521-31897-1}}
*{{citation
| last1 = Buldygin | first1 = V. V.
| last2 = Kozachenko | first2 = Yu. V.
| doi = 10.1090/mmono/188
| isbn = 0-8218-0533-9
| mr = 1743716
| page = 129
| publisher = American Mathematical Society | location = Providence, Rhode Island
| series = Translations of Mathematical Monographs
| title = Metric Characterization of Random Variables and Random Processes
| url = https://books.google.com/books?id=ePDXvIhdEjoC&pg=PA129
| volume = 188
| year = 2000| url-access = subscription
}}
* {{cite book |last1=Burago |first1=Dmitri |author-link1=Dmitri Burago |last2=Burago |first2=Yuri |author-link2=Yuri Dmitrievich Burago |last3=Ivanov |first3=Sergei |author-link3=Sergei Ivanov (mathematician) |title=A course in metric geometry |date=2001 |publisher=American Mathematical Society |location=Providence, RI |isbn=0-8218-2129-6}}
* {{cite book |last1=Čech |first1=Eduard |author-link1=Eduard Čech |title=Point Sets |date=1969 |publisher=Academic Press |isbn=0121648508}}
*{{citation
| last1 = Cohen | first1 = Andrew R.
| last2 = Vitányi | first2 = Paul M. B. | author2-link = Paul Vitányi
| arxiv = 1212.5711
| doi = 10.1109/TPAMI.2014.2375175
| issue = 8
| journal = IEEE Transactions on Pattern Analysis and Machine Intelligence
| pages = 1602–1614
| pmc = 4566858
| pmid = 26352998
| title = Normalized compression distance of multisets with applications
| volume = 37
| year = 2012}}
*{{citation
| last1 = Deza | first1 = Michel Marie | author1-link = Michel Deza
| last2 = Laurent | first2 = Monique | author2-link = Monique Laurent
| doi = 10.1007/978-3-642-04295-9
| isbn = 3-540-61611-X
| mr = 1460488
| page = 27
| publisher = Springer-Verlag, Berlin
| series = Algorithms and Combinatorics
| title = Geometry of Cuts and Metrics
| url = https://books.google.com/books?id=XujvCAAAQBAJ&pg=PA27
| volume = 15
| year = 1997}}
*{{citation
| last1 = Fraigniaud | first1 = P.
| last2 = Lebhar | first2 = E.
| last3 = Viennot | first3 = L.
| citeseerx = 10.1.1.113.6748
| contribution = The inframetric model for the internet
| doi = 10.1109/INFOCOM.2008.163
| isbn = 978-1-4244-2026-1
| pages = 1085–1093
| s2cid = 5733968
| title = 2008 IEEE INFOCOM - The 27th Conference on Computer Communications
| year = 2008}}
* {{cite book |last1=Gromov |first1=Mikhael |author-link1=Mikhael Gromov (mathematician) |title=Metric structures for Riemannian and non-Riemannian spaces |title-link=Metric Structures for Riemannian and Non-Riemannian Spaces |date=2007 |publisher=Birkhäuser |location=Boston |isbn=978-0-8176-4582-3}}
* {{cite book |last1=Heinonen |first1=Juha |author-link1=Juha Heinonen |title=Lectures on analysis on metric spaces |date=2001 |publisher=Springer |location=New York |isbn=0-387-95104-0}}
* {{cite journal |last1=Heinonen |first1=Juha |author-link1=Juha Heinonen |title=Nonsmooth calculus |journal=Bulletin of the American Mathematical Society |date=24 January 2007 |volume=44 |issue=2 |pages=163–232 |doi=10.1090/S0273-0979-07-01140-8|doi-access=free }}
*{{citation
| last = Helemskii | first = A. Ya.
| doi = 10.1090/mmono/233
| isbn = 978-0-8218-4098-6
| mr = 2248303
| page = 14
| publisher = American Mathematical Society | location = Providence, Rhode Island
| series = Translations of Mathematical Monographs
| title = Lectures and Exercises on Functional Analysis
| url = https://books.google.com/books?id=wjzZCLzx6hUC&pg=PA14
| volume = 233
| year = 2006| doi-access = free
}}
* {{cite book|first1=Pascal |last1=Hitzler |first2=Anthony |last2=Seda |title=Mathematical Aspects of Logic Programming Semantics|url=https://library.oapen.org/handle/20.500.12657/40111 |date=19 April 2016|publisher=CRC Press|hdl=20.500.12657/40111 |isbn=978-1-4398-2962-2|author1-link=Pascal Hitzler}}
* {{cite journal |last1=Lawvere |first1=F. William |title=Metric spaces, generalized logic, and closed categories |journal=Rendiconti del Seminario Matematico e Fisico di Milano |date=December 1973 |volume=43 |issue=1 |pages=135–166 |doi=10.1007/BF02924844|s2cid=1845177 }}
* {{cite book |chapter=Office Hour 7. Quasi-isometries |chapter-url=https://books.google.com/books?id=UV3yDQAAQBAJ&pg=PA125 |last1=Margalit |first1=Dan |author-link1=Dan Margalit (mathematician) |last2=Thomas |first2=Anne |title=Office hours with a geometric group theorist |date=2017 |publisher=Princeton University Press |isbn=978-1-4008-8539-8 |pages=125–145|jstor=j.ctt1vwmg8g.11 }}
* {{Munkres Topology|edition=2}}
* {{Narici Beckenstein Topological Vector Spaces|edition=2|mode=cs2}}
* {{cite book |last1=Ó Searcóid |first1=Mícheál |title=Metric spaces |date=2006 |publisher=Springer |location=London |isbn=1-84628-369-8}}
* {{cite book |last1=Papadopoulos |first1=Athanase |title=Metric spaces, convexity, and non-positive curvature |date=2014 |publisher=] |location=Zürich, Switzerland |isbn=978-3-03719-132-3 |edition=Second}}
*{{cite book
| last = Rolewicz | first = Stefan
| isbn = 90-277-2186-6
| publisher = ]
| title = Functional Analysis and Control Theory: Linear Systems
| year = 1987}}
* {{Cite book |last=Rudin |first=Walter |author-link=Walter Rudin |title=Principles of Mathematical Analysis |title-link=Principles of Mathematical Analysis |date=1976 |isbn=0-07-054235-X |publisher=McGraw-Hill |edition=Third |location=New York |oclc=1502474}}
*{{citation
| last = Smyth | first = M.
| title = Mathematical Foundations of Programming Language Semantics
| editor1-last = Main | editor1-first = M.
| editor2-last = Melton | editor2-first = A.
| editor3-last = Mislove | editor3-first = M.
| editor4-last = Schmidt | editor4-first = D.
| contribution = Quasi uniformities: reconciling domains with metric spaces
| doi = 10.1007/3-540-19020-1_12
| pages = 236–253
| publisher = Springer-Verlag
| series = Lecture Notes in Computer Science
| date = 1988
| volume = 298
| isbn = 978-3-540-19020-2
}}
*{{cite book
| last1 = Steen | first1 = Lynn Arthur
| last2 = Seebach | first2 = J. Arthur Jr.
| isbn = 978-0-486-68735-3
| mr = 507446
| publisher = ]
| title = Counterexamples in Topology | title-link=Counterexamples in Topology
| year = 1995 | orig-year = 1978}}
*{{cite journal
| last = Vitányi | first = Paul M. B. | author-link = Paul Vitányi
| arxiv = 0905.3347
| doi = 10.1109/TIT.2011.2110130
| issue = 4
| journal = IEEE Transactions on Information Theory
| pages = 2451–2456
| s2cid = 6302496
| title = Information distance in multiples
| volume = 57
| year = 2011}}
*{{cite journal
| last = Väisälä | first = Jussi
| doi = 10.1016/j.exmath.2005.01.010
| issue = 3
| journal = Expositiones Mathematicae
| mr = 2164775
| pages = 187–231
| title = Gromov hyperbolic spaces
| url = http://www.helsinki.fi/~jvaisala/grobok.pdf
| volume = 23
| year = 2005| doi-access = free
}}
*{{cite journal
| last = Vickers | first = Steven
| issue = 15
| journal = Theory and Applications of Categories
| mr = 2182680
| pages = 328–356
| title = Localic completion of generalized metric spaces, I
| url = https://www.tac.mta.ca/tac/volumes/14/15/14-15abs.html
| volume = 14
| year = 2005}}
* {{mathworld|urlname=ProductMetric|title=Product Metric}}
*{{cite journal
| last = Xia | first = Qinglan
| arxiv = 0807.3377
| issue = 2
| journal = Journal of Geometric Analysis
| pages = 452–479
| title = The geodesic problem in nearmetric spaces
| volume = 19
| year = 2008| doi = 10.1007/s12220-008-9065-4
| s2cid = 17475581
}}
*{{cite journal
| last = Xia | first = Q.
| arxiv = 0807.3377
| s2cid = 17475581
| doi = 10.1007/s12220-008-9065-4
| issue = 2
| journal = Journal of Geometric Analysis
| pages = 452–479
| title = The geodesic problem in quasimetric spaces
| volume = 19
| year = 2009}}
{{refend}}

== External links ==
* {{Springer |title=Metric space |id=p/m063680}}
* at ].

{{Metric spaces}}
{{Topology}}
{{Authority control}}

<!-- content dump from ], to be merged in gradually -->
<!--

A metric is called an ] if it satisfies the following stronger version of the ''triangle inequality'' for all <math>x,y,z\in X</math>:
:<math>d(x, y) \leq \max \{ d(x, z), d(y, z) \}.</math>

A metric ''<math>d</math>'' on a group ''<math>G</math>'' (written multiplicatively) is said to be {{em|left-invariant}} (resp. {{em|right-invariant}}) if for all <math>x, y, z \in G</math>
:<math>d(zx, zy) = d(x, y)</math> .
A metric <math>d</math> on a commutative additive group <math>X</math> is said to be {{em|translation invariant}} if for all <math>x,y,z\in X</math>
:<math>d(x, y) = d(x + z, y + z),</math>or equivalently <math>d(x, y) = d(x - y, 0).</math>

== Examples ==
* The ] <math>(\R, {|\cdot |})</math> is a ] where the absolute value is a ] on the real line <math>\R</math> that induces the usual ] on <math>\R.</math> Define a metric <math>d : \R \times \R \to \R</math> on <math>\R</math> by <math>d(x, y) = {|\arctan(x) - \arctan(y)|}</math> for all <math>x,y\in\R.</math> Just like {{nowrap|<math>{|\cdot |}</math>{{hsp}}'s}} induced metric, the metric <math>d</math> also induces the usual Euclidean topology on <math>\R</math>. However, <math>d</math> is not a complete metric because the sequence <math>x_{\bull} = \left(x_i\right)_{i=1}^{\infty}</math> defined by <math>x_i := i</math> is a ] but it does not converge to any point of <math>\R</math>. As a consequence of not converging, this {{nobr|<math>d</math>-Cauchy}} sequence cannot be a Cauchy sequence in <math>(\R, {|\cdot |})</math> (i.e. it is not a Cauchy sequence with respect to the norm <math>{\|\cdot \|}</math>) because if it was {{nowrap|<math>| \cdot |</math>-Cauchy,}} then the fact that <math>(\R, {|\cdot |})</math> is a Banach space would imply that it converges (a contradiction).{{sfn|Narici|Beckenstein|2011|pp=47–51}}

== Equivalence of metrics ==

For a given set ''X'', two metrics <math>d_1</math> and <math>d_2</math> are called ''topologically equivalent'' (''uniformly equivalent'') if the identity mapping
:<math>{\rm id}: (X,d_1)\to (X,d_2)</math>
is a ] (]).

For example, if <math>d</math> is a metric, then <math>\min (d, 1)</math> and <math>\frac{d}{1+d}</math> are metrics equivalent to <math>d.</math>

{{See also|Metric space#Notions of metric space equivalence}}

== References ==
{{refbegin|30em}}
*{{citation
| last = Čech | first = Eduard | author-link = Eduard Čech
| location = New York
| page = 42
| publisher = Academic Press
| title = Point Sets
| year = 1969}}
*{{citation
| last = Cecil | first = Thomas E.
| edition = 2nd
| isbn = 978-0-387-74655-5
| mr = 2361414
| page = 9
| publisher = Springer | location = New York
| series = Universitext
| title = Lie Sphere Geometry: With Applications to Submanifolds
| url = https://books.google.com/books?id=bT3rBwAAQBAJ&pg=PA9
| year = 2008}}
*{{citation
| last = Lawvere | first = F. William | author-link =
William Lawvere
| issue = 1
| journal = Reprints in Theory and Applications of Categories
| mr = 1925933
| pages = 1–37
| title = Metric spaces, generalized logic, and closed categories
| url = http://tac.mta.ca/tac/reprints/articles/1/tr1.pdf
| year = 2002}}; reprinted with added commentary from {{citation
| last = Lawvere | first = F. William
| doi = 10.1007/BF02924844
| journal = Rendiconti del Seminario Matematico e Fisico di Milano
| mr = 352214
| pages = 135–166 (1974)
| title = Metric spaces, generalized logic, and closed categories
| volume = 43
| year = 1973}}
*{{citation
| last = Parrott | first = Stephen
| doi = 10.1007/978-1-4612-4684-8
| isbn = 0-387-96435-5
| mr = 867408
| page = 4
| publisher = Springer-Verlag | location = New York
| title = Relativistic Electrodynamics and Differential Geometry
| url = https://books.google.com/books?id=NUnxBwAAQBAJ&pg=PA4
| year = 1987}}


-->
]
]
]
]
]
]
]
]
]
]
]
] ]
]

Latest revision as of 20:09, 8 January 2025

Mathematical space with a notion of distance

The plane (a set of points) can be equipped with different metrics. In the taxicab metric the red, yellow and blue paths have the same length (12), and are all shortest paths. In the Euclidean metric, the green path has length 6 2 8.49 {\displaystyle 6{\sqrt {2}}\approx 8.49} , and is the unique shortest path, whereas the red, yellow, and blue paths still have length 12.

In mathematics, a metric space is a set together with a notion of distance between its elements, usually called points. The distance is measured by a function called a metric or distance function. Metric spaces are the most general setting for studying many of the concepts of mathematical analysis and geometry.

The most familiar example of a metric space is 3-dimensional Euclidean space with its usual notion of distance. Other well-known examples are a sphere equipped with the angular distance and the hyperbolic plane. A metric may correspond to a metaphorical, rather than physical, notion of distance: for example, the set of 100-character Unicode strings can be equipped with the Hamming distance, which measures the number of characters that need to be changed to get from one string to another.

Since they are very general, metric spaces are a tool used in many different branches of mathematics. Many types of mathematical objects have a natural notion of distance and therefore admit the structure of a metric space, including Riemannian manifolds, normed vector spaces, and graphs. In abstract algebra, the p-adic numbers arise as elements of the completion of a metric structure on the rational numbers. Metric spaces are also studied in their own right in metric geometry and analysis on metric spaces.

Many of the basic notions of mathematical analysis, including balls, completeness, as well as uniform, Lipschitz, and Hölder continuity, can be defined in the setting of metric spaces. Other notions, such as continuity, compactness, and open and closed sets, can be defined for metric spaces, but also in the even more general setting of topological spaces.

Definition and illustration

Motivation

A diagram illustrating the great-circle distance (in cyan) and the straight-line distance (in red) between two points P and Q on a sphere.

To see the utility of different notions of distance, consider the surface of the Earth as a set of points. We can measure the distance between two such points by the length of the shortest path along the surface, "as the crow flies"; this is particularly useful for shipping and aviation. We can also measure the straight-line distance between two points through the Earth's interior; this notion is, for example, natural in seismology, since it roughly corresponds to the length of time it takes for seismic waves to travel between those two points.

The notion of distance encoded by the metric space axioms has relatively few requirements. This generality gives metric spaces a lot of flexibility. At the same time, the notion is strong enough to encode many intuitive facts about what distance means. This means that general results about metric spaces can be applied in many different contexts.

Like many fundamental mathematical concepts, the metric on a metric space can be interpreted in many different ways. A particular metric may not be best thought of as measuring physical distance, but, instead, as the cost of changing from one state to another (as with Wasserstein metrics on spaces of measures) or the degree of difference between two objects (for example, the Hamming distance between two strings of characters, or the Gromov–Hausdorff distance between metric spaces themselves).

Definition

Formally, a metric space is an ordered pair (M, d) where M is a set and d is a metric on M, i.e., a function d : M × M R {\displaystyle d\,\colon M\times M\to \mathbb {R} } satisfying the following axioms for all points x , y , z M {\displaystyle x,y,z\in M} :

  1. The distance from a point to itself is zero: d ( x , x ) = 0 {\displaystyle d(x,x)=0}
  2. (Positivity) The distance between two distinct points is always positive: If  x y , then  d ( x , y ) > 0 {\displaystyle {\text{If }}x\neq y{\text{, then }}d(x,y)>0}
  3. (Symmetry) The distance from x to y is always the same as the distance from y to x: d ( x , y ) = d ( y , x ) {\displaystyle d(x,y)=d(y,x)}
  4. The triangle inequality holds: d ( x , z ) d ( x , y ) + d ( y , z ) {\displaystyle d(x,z)\leq d(x,y)+d(y,z)} This is a natural property of both physical and metaphorical notions of distance: you can arrive at z from x by taking a detour through y, but this will not make your journey any shorter than the direct path.

If the metric d is unambiguous, one often refers by abuse of notation to "the metric space M".

By taking all axioms except the second, one can show that distance is always non-negative: 0 = d ( x , x ) d ( x , y ) + d ( y , x ) = 2 d ( x , y ) {\displaystyle 0=d(x,x)\leq d(x,y)+d(y,x)=2d(x,y)} Therefore the second axiom can be weakened to If  x y , then  d ( x , y ) 0 {\textstyle {\text{If }}x\neq y{\text{, then }}d(x,y)\neq 0} and combined with the first to make d ( x , y ) = 0 x = y {\textstyle d(x,y)=0\iff x=y} .

Simple examples

The real numbers

The real numbers with the distance function d ( x , y ) = | y x | {\displaystyle d(x,y)=|y-x|} given by the absolute difference form a metric space. Many properties of metric spaces and functions between them are generalizations of concepts in real analysis and coincide with those concepts when applied to the real line.

Metrics on Euclidean spaces

Comparison of Chebyshev, Euclidean and taxicab distances for the hypotenuse of a 3-4-5 triangle on a chessboard

The Euclidean plane R 2 {\displaystyle \mathbb {R} ^{2}} can be equipped with many different metrics. The Euclidean distance familiar from school mathematics can be defined by d 2 ( ( x 1 , y 1 ) , ( x 2 , y 2 ) ) = ( x 2 x 1 ) 2 + ( y 2 y 1 ) 2 . {\displaystyle d_{2}((x_{1},y_{1}),(x_{2},y_{2}))={\sqrt {(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}}}.}

The taxicab or Manhattan distance is defined by d 1 ( ( x 1 , y 1 ) , ( x 2 , y 2 ) ) = | x 2 x 1 | + | y 2 y 1 | {\displaystyle d_{1}((x_{1},y_{1}),(x_{2},y_{2}))=|x_{2}-x_{1}|+|y_{2}-y_{1}|} and can be thought of as the distance you need to travel along horizontal and vertical lines to get from one point to the other, as illustrated at the top of the article.

The maximum, L {\displaystyle L^{\infty }} , or Chebyshev distance is defined by d ( ( x 1 , y 1 ) , ( x 2 , y 2 ) ) = max { | x 2 x 1 | , | y 2 y 1 | } . {\displaystyle d_{\infty }((x_{1},y_{1}),(x_{2},y_{2}))=\max\{|x_{2}-x_{1}|,|y_{2}-y_{1}|\}.} This distance does not have an easy explanation in terms of paths in the plane, but it still satisfies the metric space axioms. It can be thought of similarly to the number of moves a king would have to make on a chess board to travel from one point to another on the given space.

In fact, these three distances, while they have distinct properties, are similar in some ways. Informally, points that are close in one are close in the others, too. This observation can be quantified with the formula d ( p , q ) d 2 ( p , q ) d 1 ( p , q ) 2 d ( p , q ) , {\displaystyle d_{\infty }(p,q)\leq d_{2}(p,q)\leq d_{1}(p,q)\leq 2d_{\infty }(p,q),} which holds for every pair of points p , q R 2 {\displaystyle p,q\in \mathbb {R} ^{2}} .

A radically different distance can be defined by setting d ( p , q ) = { 0 , if  p = q , 1 , otherwise. {\displaystyle d(p,q)={\begin{cases}0,&{\text{if }}p=q,\\1,&{\text{otherwise.}}\end{cases}}} Using Iverson brackets, d ( p , q ) = [ p q ] {\displaystyle d(p,q)=} In this discrete metric, all distinct points are 1 unit apart: none of them are close to each other, and none of them are very far away from each other either. Intuitively, the discrete metric no longer remembers that the set is a plane, but treats it just as an undifferentiated set of points.

All of these metrics make sense on R n {\displaystyle \mathbb {R} ^{n}} as well as R 2 {\displaystyle \mathbb {R} ^{2}} .

Subspaces

Given a metric space (M, d) and a subset A M {\displaystyle A\subseteq M} , we can consider A to be a metric space by measuring distances the same way we would in M. Formally, the induced metric on A is a function d A : A × A R {\displaystyle d_{A}:A\times A\to \mathbb {R} } defined by d A ( x , y ) = d ( x , y ) . {\displaystyle d_{A}(x,y)=d(x,y).} For example, if we take the two-dimensional sphere S as a subset of R 3 {\displaystyle \mathbb {R} ^{3}} , the Euclidean metric on R 3 {\displaystyle \mathbb {R} ^{3}} induces the straight-line metric on S described above. Two more useful examples are the open interval (0, 1) and the closed interval [0, 1] thought of as subspaces of the real line.

History

Arthur Cayley, in his article "On Distance", extended metric concepts beyond Euclidean geometry into domains bounded by a conic in a projective space. His distance was given by logarithm of a cross ratio. Any projectivity leaving the conic stable also leaves the cross ratio constant, so isometries are implicit. This method provides models for elliptic geometry and hyperbolic geometry, and Felix Klein, in several publications, established the field of non-euclidean geometry through the use of the Cayley-Klein metric.

The idea of an abstract space with metric properties was addressed in 1906 by René Maurice Fréchet and the term metric space was coined by Felix Hausdorff in 1914.

Fréchet's work laid the foundation for understanding convergence, continuity, and other key concepts in non-geometric spaces. This allowed mathematicians to study functions and sequences in a broader and more flexible way. This was important for the growing field of functional analysis. Mathematicians like Hausdorff and Stefan Banach further refined and expanded the framework of metric spaces. Hausdorff introduced topological spaces as a generalization of metric spaces. Banach's work in functional analysis heavily relied on the metric structure. Over time, metric spaces became a central part of modern mathematics. They have influenced various fields including topology, geometry, and applied mathematics. Metric spaces continue to play a crucial role in the study of abstract mathematical concepts.

Basic notions

A distance function is enough to define notions of closeness and convergence that were first developed in real analysis. Properties that depend on the structure of a metric space are referred to as metric properties. Every metric space is also a topological space, and some metric properties can also be rephrased without reference to distance in the language of topology; that is, they are really topological properties.

The topology of a metric space

For any point x in a metric space M and any real number r > 0, the open ball of radius r around x is defined to be the set of points that are strictly less than distance r from x: B r ( x ) = { y M : d ( x , y ) < r } . {\displaystyle B_{r}(x)=\{y\in M:d(x,y)<r\}.} This is a natural way to define a set of points that are relatively close to x. Therefore, a set N M {\displaystyle N\subseteq M} is a neighborhood of x (informally, it contains all points "close enough" to x) if it contains an open ball of radius r around x for some r > 0.

An open set is a set which is a neighborhood of all its points. It follows that the open balls form a base for a topology on M. In other words, the open sets of M are exactly the unions of open balls. As in any topology, closed sets are the complements of open sets. Sets may be both open and closed as well as neither open nor closed.

This topology does not carry all the information about the metric space. For example, the distances d1, d2, and d defined above all induce the same topology on R 2 {\displaystyle \mathbb {R} ^{2}} , although they behave differently in many respects. Similarly, R {\displaystyle \mathbb {R} } with the Euclidean metric and its subspace the interval (0, 1) with the induced metric are homeomorphic but have very different metric properties.

Conversely, not every topological space can be given a metric. Topological spaces which are compatible with a metric are called metrizable and are particularly well-behaved in many ways: in particular, they are paracompact Hausdorff spaces (hence normal) and first-countable. The Nagata–Smirnov metrization theorem gives a characterization of metrizability in terms of other topological properties, without reference to metrics.

Convergence

Convergence of sequences in Euclidean space is defined as follows:

A sequence (xn) converges to a point x if for every ε > 0 there is an integer N such that for all n > N, d(xn, x) < ε.

Convergence of sequences in a topological space is defined as follows:

A sequence (xn) converges to a point x if for every open set U containing x there is an integer N such that for all n > N, x n U {\displaystyle x_{n}\in U} .

In metric spaces, both of these definitions make sense and they are equivalent. This is a general pattern for topological properties of metric spaces: while they can be defined in a purely topological way, there is often a way that uses the metric which is easier to state or more familiar from real analysis.

Completeness

Main article: Complete metric space

Informally, a metric space is complete if it has no "missing points": every sequence that looks like it should converge to something actually converges.

To make this precise: a sequence (xn) in a metric space M is Cauchy if for every ε > 0 there is an integer N such that for all m, n > N, d(xm, xn) < ε. By the triangle inequality, any convergent sequence is Cauchy: if xm and xn are both less than ε away from the limit, then they are less than 2ε away from each other. If the converse is true—every Cauchy sequence in M converges—then M is complete.

Euclidean spaces are complete, as is R 2 {\displaystyle \mathbb {R} ^{2}} with the other metrics described above. Two examples of spaces which are not complete are (0, 1) and the rationals, each with the metric induced from R {\displaystyle \mathbb {R} } . One can think of (0, 1) as "missing" its endpoints 0 and 1. The rationals are missing all the irrationals, since any irrational has a sequence of rationals converging to it in R {\displaystyle \mathbb {R} } (for example, its successive decimal approximations). These examples show that completeness is not a topological property, since R {\displaystyle \mathbb {R} } is complete but the homeomorphic space (0, 1) is not.

This notion of "missing points" can be made precise. In fact, every metric space has a unique completion, which is a complete space that contains the given space as a dense subset. For example, [0, 1] is the completion of (0, 1), and the real numbers are the completion of the rationals.

Since complete spaces are generally easier to work with, completions are important throughout mathematics. For example, in abstract algebra, the p-adic numbers are defined as the completion of the rationals under a different metric. Completion is particularly common as a tool in functional analysis. Often one has a set of nice functions and a way of measuring distances between them. Taking the completion of this metric space gives a new set of functions which may be less nice, but nevertheless useful because they behave similarly to the original nice functions in important ways. For example, weak solutions to differential equations typically live in a completion (a Sobolev space) rather than the original space of nice functions for which the differential equation actually makes sense.

Bounded and totally bounded spaces

Diameter of a set.
See also: Bounded set and Diameter of a metric space

A metric space M is bounded if there is an r such that no pair of points in M is more than distance r apart. The least such r is called the diameter of M.

The space M is called precompact or totally bounded if for every r > 0 there is a finite cover of M by open balls of radius r. Every totally bounded space is bounded. To see this, start with a finite cover by r-balls for some arbitrary r. Since the subset of M consisting of the centers of these balls is finite, it has finite diameter, say D. By the triangle inequality, the diameter of the whole space is at most D + 2r. The converse does not hold: an example of a metric space that is bounded but not totally bounded is R 2 {\displaystyle \mathbb {R} ^{2}} (or any other infinite set) with the discrete metric.

Compactness

Main article: Compact space

Compactness is a topological property which generalizes the properties of a closed and bounded subset of Euclidean space. There are several equivalent definitions of compactness in metric spaces:

  1. A metric space M is compact if every open cover has a finite subcover (the usual topological definition).
  2. A metric space M is compact if every sequence has a convergent subsequence. (For general topological spaces this is called sequential compactness and is not equivalent to compactness.)
  3. A metric space M is compact if it is complete and totally bounded. (This definition is written in terms of metric properties and does not make sense for a general topological space, but it is nevertheless topologically invariant since it is equivalent to compactness.)

One example of a compact space is the closed interval [0, 1].

Compactness is important for similar reasons to completeness: it makes it easy to find limits. Another important tool is Lebesgue's number lemma, which shows that for any open cover of a compact space, every point is relatively deep inside one of the sets of the cover.

Functions between metric spaces

Euler diagram of types of functions between metric spaces.

Unlike in the case of topological spaces or algebraic structures such as groups or rings, there is no single "right" type of structure-preserving function between metric spaces. Instead, one works with different types of functions depending on one's goals. Throughout this section, suppose that ( M 1 , d 1 ) {\displaystyle (M_{1},d_{1})} and ( M 2 , d 2 ) {\displaystyle (M_{2},d_{2})} are two metric spaces. The words "function" and "map" are used interchangeably.

Isometries

Main article: Isometry

One interpretation of a "structure-preserving" map is one that fully preserves the distance function:

A function f : M 1 M 2 {\displaystyle f:M_{1}\to M_{2}} is distance-preserving if for every pair of points x and y in M1, d 2 ( f ( x ) , f ( y ) ) = d 1 ( x , y ) . {\displaystyle d_{2}(f(x),f(y))=d_{1}(x,y).}

It follows from the metric space axioms that a distance-preserving function is injective. A bijective distance-preserving function is called an isometry. One perhaps non-obvious example of an isometry between spaces described in this article is the map f : ( R 2 , d 1 ) ( R 2 , d ) {\displaystyle f:(\mathbb {R} ^{2},d_{1})\to (\mathbb {R} ^{2},d_{\infty })} defined by f ( x , y ) = ( x + y , x y ) . {\displaystyle f(x,y)=(x+y,x-y).}

If there is an isometry between the spaces M1 and M2, they are said to be isometric. Metric spaces that are isometric are essentially identical.

Continuous maps

Main article: Continuous function (topology)

On the other end of the spectrum, one can forget entirely about the metric structure and study continuous maps, which only preserve topological structure. There are several equivalent definitions of continuity for metric spaces. The most important are:

  • Topological definition. A function f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is continuous if for every open set U in M2, the preimage f 1 ( U ) {\displaystyle f^{-1}(U)} is open.
  • Sequential continuity. A function f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is continuous if whenever a sequence (xn) converges to a point x in M1, the sequence f ( x 1 ) , f ( x 2 ) , {\displaystyle f(x_{1}),f(x_{2}),\ldots } converges to the point f(x) in M2.
(These first two definitions are not equivalent for all topological spaces.)
  • ε–δ definition. A function f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is continuous if for every point x in M1 and every ε > 0 there exists δ > 0 such that for all y in M1 we have d 1 ( x , y ) < δ d 2 ( f ( x ) , f ( y ) ) < ε . {\displaystyle d_{1}(x,y)<\delta \implies d_{2}(f(x),f(y))<\varepsilon .}

A homeomorphism is a continuous bijection whose inverse is also continuous; if there is a homeomorphism between M1 and M2, they are said to be homeomorphic. Homeomorphic spaces are the same from the point of view of topology, but may have very different metric properties. For example, R {\displaystyle \mathbb {R} } is unbounded and complete, while (0, 1) is bounded but not complete.

Uniformly continuous maps

Main article: Uniform continuity

A function f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is uniformly continuous if for every real number ε > 0 there exists δ > 0 such that for all points x and y in M1 such that d ( x , y ) < δ {\displaystyle d(x,y)<\delta } , we have d 2 ( f ( x ) , f ( y ) ) < ε . {\displaystyle d_{2}(f(x),f(y))<\varepsilon .}

The only difference between this definition and the ε–δ definition of continuity is the order of quantifiers: the choice of δ must depend only on ε and not on the point x. However, this subtle change makes a big difference. For example, uniformly continuous maps take Cauchy sequences in M1 to Cauchy sequences in M2. In other words, uniform continuity preserves some metric properties which are not purely topological.

On the other hand, the Heine–Cantor theorem states that if M1 is compact, then every continuous map is uniformly continuous. In other words, uniform continuity cannot distinguish any non-topological features of compact metric spaces.

Lipschitz maps and contractions

Main article: Lipschitz continuity

A Lipschitz map is one that stretches distances by at most a bounded factor. Formally, given a real number K > 0, the map f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is K-Lipschitz if d 2 ( f ( x ) , f ( y ) ) K d 1 ( x , y ) for all x , y M 1 . {\displaystyle d_{2}(f(x),f(y))\leq Kd_{1}(x,y)\quad {\text{for all}}\quad x,y\in M_{1}.} Lipschitz maps are particularly important in metric geometry, since they provide more flexibility than distance-preserving maps, but still make essential use of the metric. For example, a curve in a metric space is rectifiable (has finite length) if and only if it has a Lipschitz reparametrization.

A 1-Lipschitz map is sometimes called a nonexpanding or metric map. Metric maps are commonly taken to be the morphisms of the category of metric spaces.

A K-Lipschitz map for K < 1 is called a contraction. The Banach fixed-point theorem states that if M is a complete metric space, then every contraction f : M M {\displaystyle f:M\to M} admits a unique fixed point. If the metric space M is compact, the result holds for a slightly weaker condition on f: a map f : M M {\displaystyle f:M\to M} admits a unique fixed point if d ( f ( x ) , f ( y ) ) < d ( x , y ) for all x y M 1 . {\displaystyle d(f(x),f(y))<d(x,y)\quad {\mbox{for all}}\quad x\neq y\in M_{1}.}

Quasi-isometries

Main article: Quasi-isometry

A quasi-isometry is a map that preserves the "large-scale structure" of a metric space. Quasi-isometries need not be continuous. For example, R 2 {\displaystyle \mathbb {R} ^{2}} and its subspace Z 2 {\displaystyle \mathbb {Z} ^{2}} are quasi-isometric, even though one is connected and the other is discrete. The equivalence relation of quasi-isometry is important in geometric group theory: the Švarc–Milnor lemma states that all spaces on which a group acts geometrically are quasi-isometric.

Formally, the map f : M 1 M 2 {\displaystyle f\,\colon M_{1}\to M_{2}} is a quasi-isometric embedding if there exist constants A ≥ 1 and B ≥ 0 such that 1 A d 2 ( f ( x ) , f ( y ) ) B d 1 ( x , y ) A d 2 ( f ( x ) , f ( y ) ) + B  for all  x , y M 1 . {\displaystyle {\frac {1}{A}}d_{2}(f(x),f(y))-B\leq d_{1}(x,y)\leq Ad_{2}(f(x),f(y))+B\quad {\text{ for all }}\quad x,y\in M_{1}.} It is a quasi-isometry if in addition it is quasi-surjective, i.e. there is a constant C ≥ 0 such that every point in M 2 {\displaystyle M_{2}} is at distance at most C from some point in the image f ( M 1 ) {\displaystyle f(M_{1})} .

Notions of metric space equivalence

See also: Equivalence of metrics

Given two metric spaces ( M 1 , d 1 ) {\displaystyle (M_{1},d_{1})} and ( M 2 , d 2 ) {\displaystyle (M_{2},d_{2})} :

  • They are called homeomorphic (topologically isomorphic) if there is a homeomorphism between them (i.e., a continuous bijection with a continuous inverse). If M 1 = M 2 {\displaystyle M_{1}=M_{2}} and the identity map is a homeomorphism, then d 1 {\displaystyle d_{1}} and d 2 {\displaystyle d_{2}} are said to be topologically equivalent.
  • They are called uniformic (uniformly isomorphic) if there is a uniform isomorphism between them (i.e., a uniformly continuous bijection with a uniformly continuous inverse).
  • They are called bilipschitz homeomorphic if there is a bilipschitz bijection between them (i.e., a Lipschitz bijection with a Lipschitz inverse).
  • They are called isometric if there is a (bijective) isometry between them. In this case, the two metric spaces are essentially identical.
  • They are called quasi-isometric if there is a quasi-isometry between them.

Metric spaces with additional structure

Normed vector spaces

Main article: Normed vector space

A normed vector space is a vector space equipped with a norm, which is a function that measures the length of vectors. The norm of a vector v is typically denoted by v {\displaystyle \lVert v\rVert } . Any normed vector space can be equipped with a metric in which the distance between two vectors x and y is given by d ( x , y ) := x y . {\displaystyle d(x,y):=\lVert x-y\rVert .} The metric d is said to be induced by the norm {\displaystyle \lVert {\cdot }\rVert } . Conversely, if a metric d on a vector space X is

  • translation invariant: d ( x , y ) = d ( x + a , y + a ) {\displaystyle d(x,y)=d(x+a,y+a)} for every x, y, and a in X; and
  • absolutely homogeneous: d ( α x , α y ) = | α | d ( x , y ) {\displaystyle d(\alpha x,\alpha y)=|\alpha |d(x,y)} for every x and y in X and real number α;

then it is the metric induced by the norm x := d ( x , 0 ) . {\displaystyle \lVert x\rVert :=d(x,0).} A similar relationship holds between seminorms and pseudometrics.

Among examples of metrics induced by a norm are the metrics d1, d2, and d on R 2 {\displaystyle \mathbb {R} ^{2}} , which are induced by the Manhattan norm, the Euclidean norm, and the maximum norm, respectively. More generally, the Kuratowski embedding allows one to see any metric space as a subspace of a normed vector space.

Infinite-dimensional normed vector spaces, particularly spaces of functions, are studied in functional analysis. Completeness is particularly important in this context: a complete normed vector space is known as a Banach space. An unusual property of normed vector spaces is that linear transformations between them are continuous if and only if they are Lipschitz. Such transformations are known as bounded operators.

Length spaces

One possible approximation for the arc length of a curve. The approximation is never longer than the arc length, justifying the definition of arc length as a supremum.
Main article: Intrinsic metric

A curve in a metric space (M, d) is a continuous function γ : [ 0 , T ] M {\displaystyle \gamma :\to M} . The length of γ is measured by L ( γ ) = sup 0 = x 0 < x 1 < < x n = T { k = 1 n d ( γ ( x k 1 ) , γ ( x k ) ) } . {\displaystyle L(\gamma )=\sup _{0=x_{0}<x_{1}<\cdots <x_{n}=T}\left\{\sum _{k=1}^{n}d(\gamma (x_{k-1}),\gamma (x_{k}))\right\}.} In general, this supremum may be infinite; a curve of finite length is called rectifiable. Suppose that the length of the curve γ is equal to the distance between its endpoints—that is, it is the shortest possible path between its endpoints. After reparametrization by arc length, γ becomes a geodesic: a curve which is a distance-preserving function. A geodesic is a shortest possible path between any two of its points.

A geodesic metric space is a metric space which admits a geodesic between any two of its points. The spaces ( R 2 , d 1 ) {\displaystyle (\mathbb {R} ^{2},d_{1})} and ( R 2 , d 2 ) {\displaystyle (\mathbb {R} ^{2},d_{2})} are both geodesic metric spaces. In ( R 2 , d 2 ) {\displaystyle (\mathbb {R} ^{2},d_{2})} , geodesics are unique, but in ( R 2 , d 1 ) {\displaystyle (\mathbb {R} ^{2},d_{1})} , there are often infinitely many geodesics between two points, as shown in the figure at the top of the article.

The space M is a length space (or the metric d is intrinsic) if the distance between any two points x and y is the infimum of lengths of paths between them. Unlike in a geodesic metric space, the infimum does not have to be attained. An example of a length space which is not geodesic is the Euclidean plane minus the origin: the points (1, 0) and (-1, 0) can be joined by paths of length arbitrarily close to 2, but not by a path of length 2. An example of a metric space which is not a length space is given by the straight-line metric on the sphere: the straight line between two points through the center of the Earth is shorter than any path along the surface.

Given any metric space (M, d), one can define a new, intrinsic distance function dintrinsic on M by setting the distance between points x and y to be the infimum of the d-lengths of paths between them. For instance, if d is the straight-line distance on the sphere, then dintrinsic is the great-circle distance. However, in some cases dintrinsic may have infinite values. For example, if M is the Koch snowflake with the subspace metric d induced from R 2 {\displaystyle \mathbb {R} ^{2}} , then the resulting intrinsic distance is infinite for any pair of distinct points.

Riemannian manifolds

Main article: Riemannian manifold

A Riemannian manifold is a space equipped with a Riemannian metric tensor, which determines lengths of tangent vectors at every point. This can be thought of defining a notion of distance infinitesimally. In particular, a differentiable path γ : [ 0 , T ] M {\displaystyle \gamma :\to M} in a Riemannian manifold M has length defined as the integral of the length of the tangent vector to the path: L ( γ ) = 0 T | γ ˙ ( t ) | d t . {\displaystyle L(\gamma )=\int _{0}^{T}|{\dot {\gamma }}(t)|dt.} On a connected Riemannian manifold, one then defines the distance between two points as the infimum of lengths of smooth paths between them. This construction generalizes to other kinds of infinitesimal metrics on manifolds, such as sub-Riemannian and Finsler metrics.

The Riemannian metric is uniquely determined by the distance function; this means that in principle, all information about a Riemannian manifold can be recovered from its distance function. One direction in metric geometry is finding purely metric ("synthetic") formulations of properties of Riemannian manifolds. For example, a Riemannian manifold is a CAT(k) space (a synthetic condition which depends purely on the metric) if and only if its sectional curvature is bounded above by k. Thus CAT(k) spaces generalize upper curvature bounds to general metric spaces.

Metric measure spaces

Real analysis makes use of both the metric on R n {\displaystyle \mathbb {R} ^{n}} and the Lebesgue measure. Therefore, generalizations of many ideas from analysis naturally reside in metric measure spaces: spaces that have both a measure and a metric which are compatible with each other. Formally, a metric measure space is a metric space equipped with a Borel regular measure such that every ball has positive measure. For example Euclidean spaces of dimension n, and more generally n-dimensional Riemannian manifolds, naturally have the structure of a metric measure space, equipped with the Lebesgue measure. Certain fractal metric spaces such as the Sierpiński gasket can be equipped with the α-dimensional Hausdorff measure where α is the Hausdorff dimension. In general, however, a metric space may not have an "obvious" choice of measure.

One application of metric measure spaces is generalizing the notion of Ricci curvature beyond Riemannian manifolds. Just as CAT(k) and Alexandrov spaces generalize sectional curvature bounds, RCD spaces are a class of metric measure spaces which generalize lower bounds on Ricci curvature.

Further examples and applications

Graphs and finite metric spaces

A metric space is discrete if its induced topology is the discrete topology. Although many concepts, such as completeness and compactness, are not interesting for such spaces, they are nevertheless an object of study in several branches of mathematics. In particular, finite metric spaces (those having a finite number of points) are studied in combinatorics and theoretical computer science. Embeddings in other metric spaces are particularly well-studied. For example, not every finite metric space can be isometrically embedded in a Euclidean space or in Hilbert space. On the other hand, in the worst case the required distortion (bilipschitz constant) is only logarithmic in the number of points.

For any undirected connected graph G, the set V of vertices of G can be turned into a metric space by defining the distance between vertices x and y to be the length of the shortest edge path connecting them. This is also called shortest-path distance or geodesic distance. In geometric group theory this construction is applied to the Cayley graph of a (typically infinite) finitely-generated group, yielding the word metric. Up to a bilipschitz homeomorphism, the word metric depends only on the group and not on the chosen finite generating set.

Metric embeddings and approximations

An important area of study in finite metric spaces is the embedding of complex metric spaces into simpler ones while controlling the distortion of distances. This is particularly useful in computer science and discrete mathematics, where algorithms often perform more efficiently on simpler structures like tree metrics.

A significant result in this area is that any finite metric space can be probabilistically embedded into a tree metric with an expected distortion of O ( l o g n ) {\displaystyle O(logn)} , where n {\displaystyle n} is the number of points in the metric space.

This embedding is notable because it achieves the best possible asymptotic bound on distortion, matching the lower bound of Ω ( l o g n ) {\displaystyle \Omega (logn)} . The tree metrics produced in this embedding dominate the original metrics, meaning that distances in the tree are greater than or equal to those in the original space. This property is particularly useful for designing approximation algorithms, as it allows for the preservation of distance-related properties while simplifying the underlying structure.

The result has significant implications for various computational problems:

  • Network design: Improves approximation algorithms for problems like the Group Steiner tree problem (a generalization of the Steiner tree problem) and Buy-at-bulk network design (a problem in Network planning and design) by simplifying the metric space to a tree metric.
  • Clustering: Enhances algorithms for clustering problems where hierarchical clustering can be performed more efficiently on tree metrics.
  • Online algorithms: Benefits problems like the k-server problem and metrical task system by providing better competitive ratios through simplified metrics.

The technique involves constructing a hierarchical decomposition of the original metric space and converting it into a tree metric via a randomized algorithm. The O ( l o g n ) {\displaystyle O(logn)} distortion bound has led to improved approximation ratios in several algorithmic problems, demonstrating the practical significance of this theoretical result.

Distances between mathematical objects

In modern mathematics, one often studies spaces whose points are themselves mathematical objects. A distance function on such a space generally aims to measure the dissimilarity between two objects. Here are some examples:

  • Functions to a metric space. If X is any set and M is a metric space, then the set of all bounded functions f : X M {\displaystyle f\colon X\to M} (i.e. those functions whose image is a bounded subset of M {\displaystyle M} ) can be turned into a metric space by defining the distance between two bounded functions f and g to be d ( f , g ) = sup x X d ( f ( x ) , g ( x ) ) . {\displaystyle d(f,g)=\sup _{x\in X}d(f(x),g(x)).} This metric is called the uniform metric or supremum metric. If M is complete, then this function space is complete as well; moreover, if X is also a topological space, then the subspace consisting of all bounded continuous functions from X to M is also complete. When X is a subspace of R n {\displaystyle \mathbb {R} ^{n}} , this function space is known as a classical Wiener space.
  • String metrics and edit distances. There are many ways of measuring distances between strings of characters, which may represent sentences in computational linguistics or code words in coding theory. Edit distances attempt to measure the number of changes necessary to get from one string to another. For example, the Hamming distance measures the minimal number of substitutions needed, while the Levenshtein distance measures the minimal number of deletions, insertions, and substitutions; both of these can be thought of as distances in an appropriate graph.
  • Graph edit distance is a measure of dissimilarity between two graphs, defined as the minimal number of graph edit operations required to transform one graph into another.
  • Wasserstein metrics measure the distance between two measures on the same metric space. The Wasserstein distance between two measures is, roughly speaking, the cost of transporting one to the other.
  • The set of all m by n matrices over some field is a metric space with respect to the rank distance d ( A , B ) = r a n k ( B A ) {\displaystyle d(A,B)=\mathrm {rank} (B-A)} .
  • The Helly metric in game theory measures the difference between strategies in a game.

Hausdorff and Gromov–Hausdorff distance

The idea of spaces of mathematical objects can also be applied to subsets of a metric space, as well as metric spaces themselves. Hausdorff and Gromov–Hausdorff distance define metrics on the set of compact subsets of a metric space and the set of compact metric spaces, respectively.

Suppose (M, d) is a metric space, and let S be a subset of M. The distance from S to a point x of M is, informally, the distance from x to the closest point of S. However, since there may not be a single closest point, it is defined via an infimum: d ( x , S ) = inf { d ( x , s ) : s S } . {\displaystyle d(x,S)=\inf\{d(x,s):s\in S\}.} In particular, d ( x , S ) = 0 {\displaystyle d(x,S)=0} if and only if x belongs to the closure of S. Furthermore, distances between points and sets satisfy a version of the triangle inequality: d ( x , S ) d ( x , y ) + d ( y , S ) , {\displaystyle d(x,S)\leq d(x,y)+d(y,S),} and therefore the map d S : M R {\displaystyle d_{S}:M\to \mathbb {R} } defined by d S ( x ) = d ( x , S ) {\displaystyle d_{S}(x)=d(x,S)} is continuous. Incidentally, this shows that metric spaces are completely regular.

Given two subsets S and T of M, their Hausdorff distance is d H ( S , T ) = max { sup { d ( s , T ) : s S } , sup { d ( t , S ) : t T } } . {\displaystyle d_{H}(S,T)=\max\{\sup\{d(s,T):s\in S\},\sup\{d(t,S):t\in T\}\}.} Informally, two sets S and T are close to each other in the Hausdorff distance if no element of S is too far from T and vice versa. For example, if S is an open set in Euclidean space T is an ε-net inside S, then d H ( S , T ) < ε {\displaystyle d_{H}(S,T)<\varepsilon } . In general, the Hausdorff distance d H ( S , T ) {\displaystyle d_{H}(S,T)} can be infinite or zero. However, the Hausdorff distance between two distinct compact sets is always positive and finite. Thus the Hausdorff distance defines a metric on the set of compact subsets of M.

The Gromov–Hausdorff metric defines a distance between (isometry classes of) compact metric spaces. The Gromov–Hausdorff distance between compact spaces X and Y is the infimum of the Hausdorff distance over all metric spaces Z that contain X and Y as subspaces. While the exact value of the Gromov–Hausdorff distance is rarely useful to know, the resulting topology has found many applications.

Miscellaneous examples

  • Given a metric space (X, d) and an increasing concave function f : [ 0 , ) [ 0 , ) {\displaystyle f\colon [0,\infty )\to [0,\infty )} such that f(t) = 0 if and only if t = 0, then d f ( x , y ) = f ( d ( x , y ) ) {\displaystyle d_{f}(x,y)=f(d(x,y))} is also a metric on X. If f(t) = t for some real number α < 1, such a metric is known as a snowflake of d.
  • The tight span of a metric space is another metric space which can be thought of as an abstract version of the convex hull.
  • The knight's move metric, the minimal number of knight's moves to reach one point in Z 2 {\displaystyle \mathbb {Z} ^{2}} from another, is a metric on Z 2 {\displaystyle \mathbb {Z} ^{2}} .
  • The British Rail metric (also called the "post office metric" or the "French railway metric") on a normed vector space is given by d ( x , y ) = x + y {\displaystyle d(x,y)=\lVert x\rVert +\lVert y\rVert } for distinct points x {\displaystyle x} and y {\displaystyle y} , and d ( x , x ) = 0 {\displaystyle d(x,x)=0} . More generally {\displaystyle \lVert \cdot \rVert } can be replaced with a function f {\displaystyle f} taking an arbitrary set S {\displaystyle S} to non-negative reals and taking the value 0 {\displaystyle 0} at most once: then the metric is defined on S {\displaystyle S} by d ( x , y ) = f ( x ) + f ( y ) {\displaystyle d(x,y)=f(x)+f(y)} for distinct points x {\displaystyle x} and y {\displaystyle y} , and d ( x , x ) = 0 {\displaystyle d(x,x)=0} . The name alludes to the tendency of railway journeys to proceed via London (or Paris) irrespective of their final destination.
  • The Robinson–Foulds metric used for calculating the distances between Phylogenetic trees in Phylogenetics

Constructions

Product metric spaces

Main article: Product metric

If ( M 1 , d 1 ) , , ( M n , d n ) {\displaystyle (M_{1},d_{1}),\ldots ,(M_{n},d_{n})} are metric spaces, and N is the Euclidean norm on R n {\displaystyle \mathbb {R} ^{n}} , then ( M 1 × × M n , d × ) {\displaystyle {\bigl (}M_{1}\times \cdots \times M_{n},d_{\times }{\bigr )}} is a metric space, where the product metric is defined by d × ( ( x 1 , , x n ) , ( y 1 , , y n ) ) = N ( d 1 ( x 1 , y 1 ) , , d n ( x n , y n ) ) , {\displaystyle d_{\times }{\bigl (}(x_{1},\ldots ,x_{n}),(y_{1},\ldots ,y_{n}){\bigr )}=N{\bigl (}d_{1}(x_{1},y_{1}),\ldots ,d_{n}(x_{n},y_{n}){\bigr )},} and the induced topology agrees with the product topology. By the equivalence of norms in finite dimensions, a topologically equivalent metric is obtained if N is the taxicab norm, a p-norm, the maximum norm, or any other norm which is non-decreasing as the coordinates of a positive n-tuple increase (yielding the triangle inequality).

Similarly, a metric on the topological product of countably many metric spaces can be obtained using the metric d ( x , y ) = i = 1 1 2 i d i ( x i , y i ) 1 + d i ( x i , y i ) . {\displaystyle d(x,y)=\sum _{i=1}^{\infty }{\frac {1}{2^{i}}}{\frac {d_{i}(x_{i},y_{i})}{1+d_{i}(x_{i},y_{i})}}.}

The topological product of uncountably many metric spaces need not be metrizable. For example, an uncountable product of copies of R {\displaystyle \mathbb {R} } is not first-countable and thus is not metrizable.

Quotient metric spaces

If M is a metric space with metric d, and {\displaystyle \sim } is an equivalence relation on M, then we can endow the quotient set M / {\displaystyle M/\!\sim } with a pseudometric. The distance between two equivalence classes [ x ] {\displaystyle } and [ y ] {\displaystyle } is defined as d ( [ x ] , [ y ] ) = inf { d ( p 1 , q 1 ) + d ( p 2 , q 2 ) + + d ( p n , q n ) } , {\displaystyle d'(,)=\inf\{d(p_{1},q_{1})+d(p_{2},q_{2})+\dotsb +d(p_{n},q_{n})\},} where the infimum is taken over all finite sequences ( p 1 , p 2 , , p n ) {\displaystyle (p_{1},p_{2},\dots ,p_{n})} and ( q 1 , q 2 , , q n ) {\displaystyle (q_{1},q_{2},\dots ,q_{n})} with p 1 x {\displaystyle p_{1}\sim x} , q n y {\displaystyle q_{n}\sim y} , q i p i + 1 , i = 1 , 2 , , n 1 {\displaystyle q_{i}\sim p_{i+1},i=1,2,\dots ,n-1} . In general this will only define a pseudometric, i.e. d ( [ x ] , [ y ] ) = 0 {\displaystyle d'(,)=0} does not necessarily imply that [ x ] = [ y ] {\displaystyle =} . However, for some equivalence relations (e.g., those given by gluing together polyhedra along faces), d {\displaystyle d'} is a metric.

The quotient metric d {\displaystyle d'} is characterized by the following universal property. If f : ( M , d ) ( X , δ ) {\displaystyle f\,\colon (M,d)\to (X,\delta )} is a metric (i.e. 1-Lipschitz) map between metric spaces satisfying f(x) = f(y) whenever x y {\displaystyle x\sim y} , then the induced function f ¯ : M / X {\displaystyle {\overline {f}}\,\colon {M/\sim }\to X} , given by f ¯ ( [ x ] ) = f ( x ) {\displaystyle {\overline {f}}()=f(x)} , is a metric map f ¯ : ( M / , d ) ( X , δ ) . {\displaystyle {\overline {f}}\,\colon (M/\sim ,d')\to (X,\delta ).}

The quotient metric does not always induce the quotient topology. For example, the topological quotient of the metric space N × [ 0 , 1 ] {\displaystyle \mathbb {N} \times } identifying all points of the form ( n , 0 ) {\displaystyle (n,0)} is not metrizable since it is not first-countable, but the quotient metric is a well-defined metric on the same set which induces a coarser topology. Moreover, different metrics on the original topological space (a disjoint union of countably many intervals) lead to different topologies on the quotient.

A topological space is sequential if and only if it is a (topological) quotient of a metric space.

Generalizations of metric spaces

There are several notions of spaces which have less structure than a metric space, but more than a topological space.

  • Uniform spaces are spaces in which distances are not defined, but uniform continuity is.
  • Approach spaces are spaces in which point-to-set distances are defined, instead of point-to-point distances. They have particularly good properties from the point of view of category theory.
  • Continuity spaces are a generalization of metric spaces and posets that can be used to unify the notions of metric spaces and domains.

There are also numerous ways of relaxing the axioms for a metric, giving rise to various notions of generalized metric spaces. These generalizations can also be combined. The terminology used to describe them is not completely standardized. Most notably, in functional analysis pseudometrics often come from seminorms on vector spaces, and so it is natural to call them "semimetrics". This conflicts with the use of the term in topology.

Extended metrics

Some authors define metrics so as to allow the distance function d to attain the value ∞, i.e. distances are non-negative numbers on the extended real number line. Such a function is also called an extended metric or "∞-metric". Every extended metric can be replaced by a real-valued metric that is topologically equivalent. This can be done using a subadditive monotonically increasing bounded function which is zero at zero, e.g. d ( x , y ) = d ( x , y ) / ( 1 + d ( x , y ) ) {\displaystyle d'(x,y)=d(x,y)/(1+d(x,y))} or d ( x , y ) = min ( 1 , d ( x , y ) ) {\displaystyle d''(x,y)=\min(1,d(x,y))} .

Metrics valued in structures other than the real numbers

The requirement that the metric take values in [ 0 , ) {\displaystyle [0,\infty )} can be relaxed to consider metrics with values in other structures, including:

These generalizations still induce a uniform structure on the space.

Pseudometrics

Main article: Pseudometric space

A pseudometric on X {\displaystyle X} is a function d : X × X R {\displaystyle d:X\times X\to \mathbb {R} } which satisfies the axioms for a metric, except that instead of the second (identity of indiscernibles) only d ( x , x ) = 0 {\displaystyle d(x,x)=0} for all x {\displaystyle x} is required. In other words, the axioms for a pseudometric are:

  1. d ( x , y ) 0 {\displaystyle d(x,y)\geq 0}
  2. d ( x , x ) = 0 {\displaystyle d(x,x)=0}
  3. d ( x , y ) = d ( y , x ) {\displaystyle d(x,y)=d(y,x)}
  4. d ( x , z ) d ( x , y ) + d ( y , z ) {\displaystyle d(x,z)\leq d(x,y)+d(y,z)} .

In some contexts, pseudometrics are referred to as semimetrics because of their relation to seminorms.

Quasimetrics

Occasionally, a quasimetric is defined as a function that satisfies all axioms for a metric with the possible exception of symmetry. The name of this generalisation is not entirely standardized.

  1. d ( x , y ) 0 {\displaystyle d(x,y)\geq 0}
  2. d ( x , y ) = 0 x = y {\displaystyle d(x,y)=0\iff x=y}
  3. d ( x , z ) d ( x , y ) + d ( y , z ) {\displaystyle d(x,z)\leq d(x,y)+d(y,z)}

Quasimetrics are common in real life. For example, given a set X of mountain villages, the typical walking times between elements of X form a quasimetric because travel uphill takes longer than travel downhill. Another example is the length of car rides in a city with one-way streets: here, a shortest path from point A to point B goes along a different set of streets than a shortest path from B to A and may have a different length.

A quasimetric on the reals can be defined by setting d ( x , y ) = { x y if  x y , 1 otherwise. {\displaystyle d(x,y)={\begin{cases}x-y&{\text{if }}x\geq y,\\1&{\text{otherwise.}}\end{cases}}} The 1 may be replaced, for example, by infinity or by 1 + y x {\displaystyle 1+{\sqrt {y-x}}} or any other subadditive function of y-x. This quasimetric describes the cost of modifying a metal stick: it is easy to reduce its size by filing it down, but it is difficult or impossible to grow it.

Given a quasimetric on X, one can define an R-ball around x to be the set { y X | d ( x , y ) R } {\displaystyle \{y\in X|d(x,y)\leq R\}} . As in the case of a metric, such balls form a basis for a topology on X, but this topology need not be metrizable. For example, the topology induced by the quasimetric on the reals described above is the (reversed) Sorgenfrey line.

Metametrics or partial metrics

In a metametric, all the axioms of a metric are satisfied except that the distance between identical points is not necessarily zero. In other words, the axioms for a metametric are:

  1. d ( x , y ) 0 {\displaystyle d(x,y)\geq 0}
  2. d ( x , y ) = 0 x = y {\displaystyle d(x,y)=0\implies x=y}
  3. d ( x , y ) = d ( y , x ) {\displaystyle d(x,y)=d(y,x)}
  4. d ( x , z ) d ( x , y ) + d ( y , z ) . {\displaystyle d(x,z)\leq d(x,y)+d(y,z).}

Metametrics appear in the study of Gromov hyperbolic metric spaces and their boundaries. The visual metametric on such a space satisfies d ( x , x ) = 0 {\displaystyle d(x,x)=0} for points x {\displaystyle x} on the boundary, but otherwise d ( x , x ) {\displaystyle d(x,x)} is approximately the distance from x {\displaystyle x} to the boundary. Metametrics were first defined by Jussi Väisälä. In other work, a function satisfying these axioms is called a partial metric or a dislocated metric.

Semimetrics

A semimetric on X {\displaystyle X} is a function d : X × X R {\displaystyle d:X\times X\to \mathbb {R} } that satisfies the first three axioms, but not necessarily the triangle inequality:

  1. d ( x , y ) 0 {\displaystyle d(x,y)\geq 0}
  2. d ( x , y ) = 0 x = y {\displaystyle d(x,y)=0\iff x=y}
  3. d ( x , y ) = d ( y , x ) {\displaystyle d(x,y)=d(y,x)}

Some authors work with a weaker form of the triangle inequality, such as:

d ( x , z ) ρ ( d ( x , y ) + d ( y , z ) ) {\displaystyle d(x,z)\leq \rho \,(d(x,y)+d(y,z))} ρ-relaxed triangle inequality
d ( x , z ) ρ max { d ( x , y ) , d ( y , z ) } {\displaystyle d(x,z)\leq \rho \,\max\{d(x,y),d(y,z)\}} ρ-inframetric inequality

The ρ-inframetric inequality implies the ρ-relaxed triangle inequality (assuming the first axiom), and the ρ-relaxed triangle inequality implies the 2ρ-inframetric inequality. Semimetrics satisfying these equivalent conditions have sometimes been referred to as quasimetrics, nearmetrics or inframetrics.

The ρ-inframetric inequalities were introduced to model round-trip delay times in the internet. The triangle inequality implies the 2-inframetric inequality, and the ultrametric inequality is exactly the 1-inframetric inequality.

Premetrics

Relaxing the last three axioms leads to the notion of a premetric, i.e. a function satisfying the following conditions:

  1. d ( x , y ) 0 {\displaystyle d(x,y)\geq 0}
  2. d ( x , x ) = 0 {\displaystyle d(x,x)=0}

This is not a standard term. Sometimes it is used to refer to other generalizations of metrics such as pseudosemimetrics or pseudometrics; in translations of Russian books it sometimes appears as "prametric". A premetric that satisfies symmetry, i.e. a pseudosemimetric, is also called a distance.

Any premetric gives rise to a topology as follows. For a positive real r {\displaystyle r} , the r {\displaystyle r} -ball centered at a point p {\displaystyle p} is defined as

B r ( p ) = { x | d ( x , p ) < r } . {\displaystyle B_{r}(p)=\{x|d(x,p)<r\}.}

A set is called open if for any point p {\displaystyle p} in the set there is an r {\displaystyle r} -ball centered at p {\displaystyle p} which is contained in the set. Every premetric space is a topological space, and in fact a sequential space. In general, the r {\displaystyle r} -balls themselves need not be open sets with respect to this topology. As for metrics, the distance between two sets A {\displaystyle A} and B {\displaystyle B} , is defined as

d ( A , B ) = inf x A , y B d ( x , y ) . {\displaystyle d(A,B)={\underset {x\in A,y\in B}{\inf }}d(x,y).}

This defines a premetric on the power set of a premetric space. If we start with a (pseudosemi-)metric space, we get a pseudosemimetric, i.e. a symmetric premetric. Any premetric gives rise to a preclosure operator c l {\displaystyle cl} as follows:

c l ( A ) = { x | d ( x , A ) = 0 } . {\displaystyle cl(A)=\{x|d(x,A)=0\}.}

Pseudoquasimetrics

The prefixes pseudo-, quasi- and semi- can also be combined, e.g., a pseudoquasimetric (sometimes called hemimetric) relaxes both the indiscernibility axiom and the symmetry axiom and is simply a premetric satisfying the triangle inequality. For pseudoquasimetric spaces the open r {\displaystyle r} -balls form a basis of open sets. A very basic example of a pseudoquasimetric space is the set { 0 , 1 } {\displaystyle \{0,1\}} with the premetric given by d ( 0 , 1 ) = 1 {\displaystyle d(0,1)=1} and d ( 1 , 0 ) = 0. {\displaystyle d(1,0)=0.} The associated topological space is the Sierpiński space.

Sets equipped with an extended pseudoquasimetric were studied by William Lawvere as "generalized metric spaces". From a categorical point of view, the extended pseudometric spaces and the extended pseudoquasimetric spaces, along with their corresponding nonexpansive maps, are the best behaved of the metric space categories. One can take arbitrary products and coproducts and form quotient objects within the given category. If one drops "extended", one can only take finite products and coproducts. If one drops "pseudo", one cannot take quotients.

Lawvere also gave an alternate definition of such spaces as enriched categories. The ordered set ( R , ) {\displaystyle (\mathbb {R} ,\geq )} can be seen as a category with one morphism a b {\displaystyle a\to b} if a b {\displaystyle a\geq b} and none otherwise. Using + as the tensor product and 0 as the identity makes this category into a monoidal category R {\displaystyle R^{*}} . Every (extended pseudoquasi-)metric space ( M , d ) {\displaystyle (M,d)} can now be viewed as a category M {\displaystyle M^{*}} enriched over R {\displaystyle R^{*}} :

  • The objects of the category are the points of M.
  • For every pair of points x and y such that d ( x , y ) < {\displaystyle d(x,y)<\infty } , there is a single morphism which is assigned the object d ( x , y ) {\displaystyle d(x,y)} of R {\displaystyle R^{*}} .
  • The triangle inequality and the fact that d ( x , x ) = 0 {\displaystyle d(x,x)=0} for all points x derive from the properties of composition and identity in an enriched category.
  • Since R {\displaystyle R^{*}} is a poset, all diagrams that are required for an enriched category commute automatically.

Metrics on multisets

The notion of a metric can be generalized from a distance between two elements to a number assigned to a multiset of elements. A multiset is a generalization of the notion of a set in which an element can occur more than once. Define the multiset union U = X Y {\displaystyle U=XY} as follows: if an element x occurs m times in X and n times in Y then it occurs m + n times in U. A function d on the set of nonempty finite multisets of elements of a set M is a metric if

  1. d ( X ) = 0 {\displaystyle d(X)=0} if all elements of X are equal and d ( X ) > 0 {\displaystyle d(X)>0} otherwise (positive definiteness)
  2. d ( X ) {\displaystyle d(X)} depends only on the (unordered) multiset X (symmetry)
  3. d ( X Y ) d ( X Z ) + d ( Z Y ) {\displaystyle d(XY)\leq d(XZ)+d(ZY)} (triangle inequality)

By considering the cases of axioms 1 and 2 in which the multiset X has two elements and the case of axiom 3 in which the multisets X, Y, and Z have one element each, one recovers the usual axioms for a metric. That is, every multiset metric yields an ordinary metric when restricted to sets of two elements.

A simple example is the set of all nonempty finite multisets X {\displaystyle X} of integers with d ( X ) = max ( X ) min ( X ) {\displaystyle d(X)=\max(X)-\min(X)} . More complex examples are information distance in multisets; and normalized compression distance (NCD) in multisets.

See also

Notes

  1. Balls with rational radius around a point x form a neighborhood basis for that point.
  2. In the context of intervals in the real line, or more generally regions in Euclidean space, bounded sets are sometimes referred to as "finite intervals" or "finite regions". However, they do not typically have a finite number of elements, and while they all have finite volume, so do many unbounded sets. Therefore this terminology is imprecise.
  3. This differs from usage in Riemannian geometry, where geodesics are only locally shortest paths. Some authors define geodesics in metric spaces in the same way.

Citations

  1. Čech 1969, p. 42.
  2. Burago, Burago & Ivanov 2001.
  3. Heinonen 2001.
  4. ^ Burago, Burago & Ivanov 2001, p. 1.
  5. Gromov 2007, p. xv.
  6. Gleason, Andrew (1991). Fundamentals of Abstract Analysis (1st ed.). Taylor & Francis. p. 223. doi:10.1201/9781315275444. ISBN 9781315275444. S2CID 62222843.
  7. Fréchet, M. (December 1906). "Sur quelques points du calcul fonctionnel". Rendiconti del Circolo Matematico di Palermo. 22 (1): 1–72. doi:10.1007/BF03018603. S2CID 123251660.
  8. F. Hausdorff (1914) Grundzuge der Mengenlehre
  9. Blumberg, Henry (1927). "Hausdorff's Grundzüge der Mengenlehre". Bulletin of the American Mathematical Society. 6: 778–781. doi:10.1090/S0002-9904-1920-03378-1.
  10. Mohamed A. Khamsi & William A. Kirk (2001) Introduction to Metric Spaces and Fixed Point Theory, page 14, John Wiley & Sons
  11. Rudin, Mary Ellen. A new proof that metric spaces are paracompact Archived 2016-04-12 at the Wayback Machine. Proceedings of the American Mathematical Society, Vol. 20, No. 2. (Feb., 1969), p. 603.
  12. Burago, Burago & Ivanov 2001, p. 2.
  13. Burago, Burago & Ivanov 2001, p. 2.
    Some authors refer to any distance-preserving function as an isometry, e.g. Munkres 2000, p. 181.
  14. Gromov 2007, p. xvii.
  15. ^ Margalit & Thomas 2017.
  16. Narici & Beckenstein 2011, pp. 47–66.
  17. Burago, Burago & Ivanov 2001, Definition 2.3.1.
  18. Burago, Burago & Ivanov 2001, Definition 2.5.27.
  19. Gromov 2007, Definition 1.9.
  20. Burago, Burago & Ivanov 2001, p. 127.
  21. Heinonen 2007, p. 191.
  22. Gigli, Nicola (2018-10-18). "Lecture notes on differential calculus on RCD spaces". Publications of the Research Institute for Mathematical Sciences. 54 (4): 855–918. arXiv:1703.06829. doi:10.4171/PRIMS/54-4-4. S2CID 119129867.
  23. Linial, Nathan (2003). "Finite metric-spaces—combinatorics, geometry and algorithms". Proceedings of the ICM, Beijing 2002. Vol. 3. pp. 573–586. arXiv:math/0304466.
  24. Bourgain, J. (1985). "On lipschitz embedding of finite metric spaces in Hilbert space". Israel Journal of Mathematics. 52 (1–2): 46–52. doi:10.1007/BF02776078. S2CID 121649019.
  25. Jiří Matoušek and Assaf Naor, ed. "Open problems on embeddings of finite metric spaces". Archived 2010-12-26 at the Wayback Machine.
  26. Fakcharoenphol, J.; Rao, S.; Talwar, K. (2004). "A tight bound on approximating arbitrary metrics by tree metrics". Journal of Computer and System Sciences. 69 (3): 485–497. doi:10.1016/j.jcss.2004.04.011.
  27. Ó Searcóid 2006, p. 107.
  28. Gottlieb, Lee-Ad; Solomon, Shay (2014-06-08). Light spanners for snowflake metrics. SOCG '14: Proceedings of the thirtieth annual symposium on Computational geometry. pp. 387–395. arXiv:1401.5014. doi:10.1145/2582112.2582140.
  29. Robinson, D.F.; Foulds, L.R. (February 1981). "Comparison of phylogenetic trees". Mathematical Biosciences. 53 (1–2): 131–147. doi:10.1016/0025-5564(81)90043-2. S2CID 121156920.
  30. Burago, Burago & Ivanov 2001, Definition 3.1.12.
  31. See Burago, Burago & Ivanov 2001, Example 3.1.17, although in this book the quotient N × [ 0 , 1 ] / N × { 0 } {\displaystyle \mathbb {N} \times /\mathbb {N} \times \{0\}} is incorrectly claimed to be homeomorphic to the topological quotient.
  32. Goreham, Anthony. Sequential convergence in Topological Spaces Archived 2011-06-04 at the Wayback Machine. Honours' Dissertation, Queen's College, Oxford (April, 2001), p. 14
  33. Hitzler & Seda 2016, Definition 4.3.1.
  34. ^ Hitzler & Seda 2016, Definition 4.2.1.
  35. Burago, Burago & Ivanov 2001, Definition 1.1.4.
  36. Steen & Seebach (1995); Smyth (1988)
  37. Rolewicz (1987) calls them "semimetrics". That same term is also frequently used for two other generalizations of metrics.
  38. Väisälä 2005.
  39. "Partial metrics: welcome". www.dcs.warwick.ac.uk. Archived from the original on 2017-07-27. Retrieved 2018-05-02.
  40. Bukatin, Michael; Kopperman, Ralph; Matthews, Steve; Pajoohesh, Homeira (2009-10-01). "Partial Metric Spaces" (PDF). American Mathematical Monthly. 116 (8): 708–718. doi:10.4169/193009709X460831. S2CID 13969183.
  41. Xia 2009.
  42. Xia 2008.
  43. ^ Fraigniaud, Lebhar & Viennot 2008.
  44. Buldygin & Kozachenko 2000.
  45. Helemskii 2006.
  46. Arkhangel'skii & Pontryagin (1990); Aldrovandi & Pereira (2017)
  47. Deza & Laurent 1997.
  48. Lawvere (1973); Vickers (2005)
  49. ^ Vitányi 2011.
  50. Cohen & Vitányi 2012.

References

External links

Metric spaces (Category)
Basic concepts
Main results
Maps
Types of
metric spaces
Sets
Examples
Manifolds
Functional analysis
and Measure theory
General topology
Related
Generalizations
Topology
Fields Computer graphics rendering of a Klein bottle
Key concepts
Metrics and properties
Key results
Categories: