Theplane (a set of points) can be equipped with different metrics. In thetaxicab metric the red, yellow and blue paths have the samelength (12), and are all shortest paths. In theEuclidean metric, the green path has length, and is the unique shortest path, whereas the red, yellow, and blue paths still have length 12.
The most familiar example of a metric space is3-dimensional Euclidean space with its usual notion of distance. Other well-known examples are asphere equipped with theangular distance and thehyperbolic plane. A metric may correspond to ametaphorical, rather than physical, notion of distance: for example, the set of 100-character Unicode strings can be equipped with theHamming 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, includingRiemannian manifolds,normed vector spaces, andgraphs. Inabstract algebra, thep-adic numbers arise as elements of thecompletion of a metric structure on therational numbers. Metric spaces are also studied in their own right inmetric geometry[2] andanalysis on metric spaces.[3]
A diagram illustrating the great-circle distance (in cyan) and the straight-line distance (in red) between two pointsP andQ on a sphere.
To see the utility of different notions of distance, consider thesurface of the Earth as a set of points. We can measure the distance between two such points by the length of theshortest 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 inseismology, 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 withWasserstein metrics on spaces ofmeasures) or the degree of difference between two objects (for example, theHamming distance between two strings of characters, or theGromov–Hausdorff distance between metric spaces themselves).
Formally, ametric space is anordered pair(M,d) whereM is a set andd is ametric onM, i.e., afunctionsatisfying the following axioms for all points:[4][5]
The distance from a point to itself is zero:
(Positivity) The distance between two distinct points is always positive:
(Symmetry) The distance fromx toy is always the same as the distance fromy tox:
Thetriangle inequality holds:This is a natural property of both physical and metaphorical notions of distance: you can arrive atz fromx by taking a detour throughy, but this will not make your journey any shorter than the direct path.
If the metricd is unambiguous, one often refers byabuse of notation to "the metric spaceM".
By taking all axioms except the second, one can show that distance is always non-negative:Therefore the second axiom can be weakened to and combined with the first to make.[6]
Thereal numbers with the distance function given by theabsolute difference form a metric space. Many properties of metric spaces and functions between them are generalizations of concepts inreal analysis and coincide with those concepts when applied to the real line.
Comparison of Chebyshev, Euclidean and taxicab distances for the hypotenuse of a 3-4-5 triangle on a chessboard
The Euclidean plane can be equipped with many different metrics. TheEuclidean distance familiar from school mathematics can be defined by
Thetaxicab orManhattan distance is defined byand 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.
Themaximum,, orChebyshev distance is defined byThis 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 aking would have to make on achessboard 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 formulawhich holds for every pair of points.
A radically different distance can be defined by settingUsingIverson brackets,In thisdiscrete 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 can be easily extended to make sense on as well as.
Given a metric space(M,d) and asubset, we can considerA to be a metric space by measuring distances the same way we would inM. Formally, theinduced metric onA is a function defined byFor example, if we take the two-dimensional sphereS2 as a subset of, the Euclidean metric on induces the straight-line metric onS2 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.
Arthur Cayley, in his article "On Distance", extended metric concepts beyond Euclidean geometry into domains bounded by a conic in a projective space. Hisdistance was given by logarithm of across ratio. Any projectivity leaving the conic stable also leaves the cross ratio constant, so isometries are implicit. This method provides models forelliptic geometry andhyperbolic geometry, andFelix Klein, in several publications, established the field ofnon-euclidean geometry through the use of theCayley-Klein metric.
Fréchet's work laid the foundation for understandingconvergence,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 andStefan Banach further refined and expanded the framework of metric spaces. Hausdorff introducedtopological spaces as a generalization of metric spaces. Banach's work infunctional analysis heavily relied on the metric structure. Over time, metric spaces became a central part ofmodern mathematics. They have influenced various fields includingtopology,geometry, andapplied mathematics. Metric spaces continue to play a crucial role in the study of abstract mathematical concepts.
A distance function is enough to define notions of closeness and convergence that were first developed inreal analysis. Properties that depend on the structure of a metric space are referred to asmetric properties. Every metric space is also atopological space, and some metric properties can also be rephrased without reference to distance in the language of topology; that is, they are reallytopological properties.
For any pointx in a metric spaceM and any real numberr > 0, theopen ball of radiusr aroundx is defined to be the set of points that are strictly less than distancer fromx:This is a natural way to define a set of points that are relatively close tox. Therefore, a set is aneighborhood ofx (informally, it contains all points "close enough" tox) if it contains an open ball of radiusr aroundx for somer > 0.
Anopen set is a set which is a neighborhood of all its points. It follows that the open balls form abase for a topology onM. In other words, the open sets ofM 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 distancesd1,d2, andd∞ defined above all induce the same topology on, although they behave differently in many respects. Similarly, with the Euclidean metric and its subspace the interval(0, 1) with the induced metric arehomeomorphic 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 calledmetrizable and are particularly well-behaved in many ways: in particular, they areparacompact[11]Hausdorff spaces (hencenormal) andfirst-countable.[a] TheNagata–Smirnov metrization theorem gives a characterization of metrizability in terms of other topological properties, without reference to metrics.
A sequence(xn) converges to a pointx if for everyε > 0 there is an integerN such that for alln >N,d(xn,x) < ε.
Convergence of sequences in a topological space is defined as follows:
A sequence(xn) converges to a pointx if for every open setU containingx there is an integerN such that for alln >N,.
In metric spaces, both of these definitions make sense and they are equivalent. This is a general pattern fortopological 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.
Informally, a metric space iscomplete 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 spaceM isCauchy if for everyε > 0 there is an integerN such that for allm,n >N,d(xm,xn) < ε. By the triangle inequality, any convergent sequence is Cauchy: ifxm andxn are both less thanε away from the limit, then they are less than2ε away from each other. If the converse is true—every Cauchy sequence inM converges—thenM is complete.
Euclidean spaces are complete, as is 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. 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 (for example, its successive decimal approximations). These examples show that completeness isnot a topological property, since 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 uniquecompletion, which is a complete space that contains the given space as adense 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, thep-adic numbers are defined as the completion of the rationals under a different metric. Completion is particularly common as a tool infunctional 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 todifferential equations typically live in a completion (aSobolev space) rather than the original space of nice functions for which the differential equation actually makes sense.
A metric spaceM isbounded if there is anr such that no pair of points inM is more than distancer apart.[b] The least suchr is called thediameter ofM.
The spaceM is calledprecompact ortotally bounded if for everyr > 0 there is a finitecover ofM by open balls of radiusr. Every totally bounded space is bounded. To see this, start with a finite cover byr-balls for some arbitraryr. Since the subset ofM consisting of the centers of these balls is finite, it has finite diameter, sayD. By the triangle inequality, the diameter of the whole space is at mostD + 2r. The converse does not hold: an example of a metric space that is bounded but not totally bounded is (or any other infinite set) with the discrete metric.
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 spaceM is compact if every open cover has a finite subcover (the usual topological definition).
A metric spaceM is compact if every sequence has a convergent subsequence. (For general topological spaces this is calledsequential compactness and is not equivalent to compactness.)
A metric spaceM 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 isLebesgue'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.
Euler diagram of types of functions between metric spaces.
Unlike in the case of topological spaces or algebraic structures such asgroups orrings, there is no single "right" type ofstructure-preserving function between metric spaces. Instead, one works with different types of functions depending on one's goals. Throughout this section, suppose that and are two metric spaces. The words "function" and "map" are used interchangeably.
One interpretation of a "structure-preserving" map is one that fully preserves the distance function:
A function isdistance-preserving[12] if for every pair of pointsx andy inM1,
It follows from the metric space axioms that a distance-preserving function is injective. A bijective distance-preserving function is called anisometry.[13] One perhaps non-obvious example of an isometry between spaces described in this article is the map defined by
If there is an isometry between the spacesM1 andM2, they are said to beisometric. Metric spaces that are isometric areessentially identical.
On the other end of the spectrum, one can forget entirely about the metric structure and studycontinuous maps, which only preserve topological structure. There are several equivalent definitions of continuity for metric spaces. The most important are:
Topological definition. A function is continuous if for every open setU inM2, thepreimage is open.
Sequential continuity. A function is continuous if whenever a sequence(xn) converges to a pointx inM1, the sequence converges to the pointf(x) inM2.
(These first two definitions arenot equivalent for all topological spaces.)
ε–δ definition. A function is continuous if for every pointx inM1 and everyε > 0 there existsδ > 0 such that for ally inM1 we have
Ahomeomorphism is a continuous bijection whose inverse is also continuous; if there is a homeomorphism betweenM1 andM2, they are said to behomeomorphic. Homeomorphic spaces are the same from the point of view of topology, but may have very different metric properties. For example, is unbounded and complete, while(0, 1) is bounded but not complete.
A function isuniformly continuous if for every real numberε > 0 there existsδ > 0 such that for all pointsx andy inM1 such that, we have
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 pointx. However, this subtle change makes a big difference. For example, uniformly continuous maps take Cauchy sequences inM1 to Cauchy sequences inM2. In other words, uniform continuity preserves some metric properties which are not purely topological.
On the other hand, theHeine–Cantor theorem states that ifM1 is compact, then every continuous map is uniformly continuous. In other words, uniform continuity cannot distinguish any non-topological features of compact metric spaces.
ALipschitz map is one that stretches distances by at most a bounded factor. Formally, given a real numberK > 0, the map isK-Lipschitz ifLipschitz maps are particularly important in metric geometry, since they provide more flexibility than distance-preserving maps, but still make essential use of the metric.[14] For example, a curve in a metric space isrectifiable (has finite length) if and only if it has a Lipschitz reparametrization.
A 1-Lipschitz map is sometimes called anonexpanding ormetric map. Metric maps are commonly taken to be the morphisms of thecategory of metric spaces.
AK-Lipschitz map forK < 1 is called acontraction. TheBanach fixed-point theorem states that ifM is a complete metric space, then every contraction admits a uniquefixed point. If the metric spaceM is compact, the result holds for a slightly weaker condition onf: a map admits a unique fixed point if
Aquasi-isometry is a map that preserves the "large-scale structure" of a metric space. Quasi-isometries need not be continuous. For example, and its subspace are quasi-isometric, even though one is connected and the other is discrete. The equivalence relation of quasi-isometry is important ingeometric group theory: theŠvarc–Milnor lemma states that all spaces on which a groupacts geometrically are quasi-isometric.[15]
Formally, the map is aquasi-isometric embedding if there exist constantsA ≥ 1 andB ≥ 0 such thatIt is aquasi-isometry if in addition it isquasi-surjective, i.e. there is a constantC ≥ 0 such that every point in is at distance at mostC from some point in the image.
They are calledhomeomorphic (topologically isomorphic) if there is ahomeomorphism between them (i.e., a continuousbijection with a continuous inverse). If and the identity map is a homeomorphism, then and are said to betopologically equivalent.
They are calleduniformic (uniformly isomorphic) if there is auniform isomorphism between them (i.e., a uniformly continuous bijection with a uniformly continuous inverse).
They are calledbilipschitz homeomorphic if there is a bilipschitz bijection between them (i.e., a Lipschitz bijection with a Lipschitz inverse).
They are calledisometric if there is a (bijective)isometry between them. In this case, the two metric spaces are essentially identical.
They are calledquasi-isometric if there is aquasi-isometry between them.
Anormed vector space is a vector space equipped with anorm, which is a function that measures the length of vectors. The norm of a vectorv is typically denoted by. Any normed vector space can be equipped with a metric in which the distance between two vectorsx andy is given byThe metricd is said to beinduced by the norm.
then is a norm induced by the metric.A similar relationship holds betweenseminorms andpseudometrics.
Among examples of metrics induced by a norm are the metricsd1,d2, andd∞ on, which are induced by theManhattan norm, theEuclidean norm, and themaximum norm, respectively. More generally, theKuratowski 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 infunctional analysis. Completeness is particularly important in this context: a complete normed vector space is known as aBanach space. An unusual property of normed vector spaces is thatlinear transformations between them are continuous if and only if they are Lipschitz. Such transformations are known asbounded operators.
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 asupremum.
Acurve in a metric space(M,d) is a continuous function. Thelength ofγ is measured byIn general, this supremum may be infinite; a curve of finite length is calledrectifiable.[17] 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 ageodesic: a curve which is a distance-preserving function.[15] A geodesic is a shortest possible path between any two of its points.[c]
Ageodesic metric space is a metric space which admits a geodesic between any two of its points. The spaces and are both geodesic metric spaces. In, geodesics are unique, but in, there are often infinitely many geodesics between two points, as shown in the figure at the top of the article.
The spaceM is alength space (or the metricd isintrinsic) if the distance between any two pointsx andy 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 functiondintrinsic onM by setting the distance between pointsx andy to be the infimum of thed-lengths of paths between them. For instance, ifd is the straight-line distance on the sphere, thendintrinsic is the great-circle distance. However, in some casesdintrinsic may have infinite values. For example, ifM is theKoch snowflake with the subspace metricd induced from, then the resulting intrinsic distance is infinite for any pair of distinct points.
ARiemannian manifold is a space equipped with a Riemannianmetric tensor, which determines lengths oftangent vectors at every point. This can be thought of defining a notion of distance infinitesimally. In particular, a differentiable path in a Riemannian manifoldM has length defined as the integral of the length of the tangent vector to the path: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 assub-Riemannian andFinsler 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 aCAT(k) space (a synthetic condition which depends purely on the metric) if and only if itssectional curvature is bounded above byk.[20] ThusCAT(k) spaces generalize upper curvature bounds to general metric spaces.
Real analysis makes use of both the metric on and theLebesgue measure. Therefore, generalizations of many ideas from analysis naturally reside inmetric measure spaces: spaces that have both ameasure and a metric which are compatible with each other. Formally, ametric measure space is a metric space equipped with aBorel regular measure such that every ball has positive measure.[21] For example Euclidean spaces of dimensionn, and more generallyn-dimensional Riemannian manifolds, naturally have the structure of a metric measure space, equipped with theLebesgue measure. Certainfractal metric spaces such as theSierpiński gasket can be equipped with the α-dimensionalHausdorff measure where α is theHausdorff 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 ofRicci curvature beyond Riemannian manifolds. Just asCAT(k) andAlexandrov spaces generalize sectional curvature bounds,RCD spaces are a class of metric measure spaces which generalize lower bounds on Ricci curvature.[22]
Ametric space isdiscrete if its induced topology is thediscrete 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 afinite number of points) are studied incombinatorics andtheoretical computer science.[23] Embeddings in other metric spaces are particularly well-studied. For example, not every finite metric space can beisometrically embedded in a Euclidean space or inHilbert space. On the other hand, in the worst case the required distortion (bilipschitz constant) is only logarithmic in the number of points.[24][25]
For anyundirected connected graphG, the setV of vertices ofG can be turned into a metric space by defining thedistance between verticesx andy to be the length of the shortest edge path connecting them. In graph theory, this is also called theshortest-path distance or geodesic distance. Ingeometric group theory this construction is applied to theCayley graph of a (typically infinite)finitely-generated group, yielding theword metric. Up to a bilipschitz homeomorphism, the word metric depends only on the group and not on the chosen finite generating set.[15]
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 atree metric with an expected distortion of, where is the number of points in the metric space.[26]
This embedding is notable because it achieves the best possible asymptotic bound on distortion, matching the lower bound of. The tree metrics produced in this embeddingdominate 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 theGroup Steiner tree problem (a generalization of theSteiner tree problem) andBuy-at-bulk network design (a problem inNetwork 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 thek-server problem andmetrical 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 distortion bound has led to improvedapproximation ratios in several algorithmic problems, demonstrating the practical significance of this theoretical result.
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. IfX is any set andM is a metric space, then the set of allbounded functions (i.e. those functions whose image is abounded subset of) can be turned into a metric space by defining the distance between two bounded functionsf andg to be This metric is called theuniform metric or supremum metric.[27] IfM is complete, then thisfunction space is complete as well; moreover, ifX is also a topological space, then the subspace consisting of all boundedcontinuous functions fromX toM is also complete. WhenX is a subspace of, this function space is known as aclassical Wiener space.
Wasserstein metrics measure the distance between twomeasures on the same metric space. The Wasserstein distance between two measures is, roughly speaking, thecost of transporting one to the other.
The set of allm bynmatrices over somefield is a metric space with respect to therank 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 andGromov–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 letS be a subset ofM. Thedistance fromS to a pointx ofM is, informally, the distance fromx to the closest point ofS. However, since there may not be a single closest point, it is defined via aninfimum:In particular, if and only ifx belongs to theclosure ofS. Furthermore, distances between points and sets satisfy a version of the triangle inequality:and therefore the map defined by is continuous. Incidentally, this shows that metric spaces arecompletely regular.
Given two subsetsS andT ofM, theirHausdorff distance isInformally, two setsS andT are close to each other in the Hausdorff distance if no element ofS is too far fromT and vice versa. For example, ifS is an open set in Euclidean spaceT is anε-net insideS, then. In general, the Hausdorff distance 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 ofM.
The Gromov–Hausdorff metric defines a distance between (isometry classes of) compact metric spaces. TheGromov–Hausdorff distance between compact spacesX andY is the infimum of the Hausdorff distance over all metric spacesZ that containX andY as subspaces. While the exact value of the Gromov–Hausdorff distance is rarely useful to know, the resulting topology has found many applications.
Given a metric space(X,d) and an increasingconcave function such thatf(t) = 0 if and only ift = 0, then is also a metric onX. Iff(t) =tα for some real numberα < 1, such a metric is known as asnowflake ofd.[28]
Thetight span of a metric space is another metric space which can be thought of as an abstract version of theconvex hull.
Theknight's move metric, the minimal number of knight's moves to reach one point in from another, is a metric on.
TheBritish Rail metric (also called the "post office metric" or the "French railway metric") on anormed vector space is given by for distinct points and, and. More generally can be replaced with a function taking an arbitrary set to non-negative reals and taking the value at most once: then the metric is defined on by for distinct points and, and. The name alludes to the tendency of railway journeys to proceed via London (or Paris) irrespective of their final destination.
If are metric spaces, andN is theEuclidean norm on, then is a metric space, where theproduct metric is defined byand the induced topology agrees with theproduct topology. By the equivalence of norms in finite dimensions, a topologically equivalent metric is obtained ifN is thetaxicab norm, ap-norm, themaximum norm, or any other norm which is non-decreasing as the coordinates of a positiven-tuple increase (yielding the triangle inequality).
Similarly, a metric on the topological product of countably many metric spaces can be obtained using the metric
The topological product of uncountably many metric spaces need not be metrizable. For example, an uncountable product of copies of is notfirst-countable and thus is not metrizable.
IfM is a metric space with metricd, and is anequivalence relation onM, then we can endow the quotient set with a pseudometric. The distance between two equivalence classes and is defined aswhere theinfimum is taken over all finite sequences and with,,.[30] In general this will only define apseudometric, i.e. does not necessarily imply that. However, for some equivalence relations (e.g., those given by gluing together polyhedra along faces), is a metric.
The quotient metric is characterized by the followinguniversal property. If is a metric (i.e. 1-Lipschitz) map between metric spaces satisfyingf(x) =f(y) whenever, then the induced function, given by, is a metric map
The quotient metric does not always induce thequotient topology. For example, the topological quotient of the metric space identifying all points of the form is not metrizable since it is notfirst-countable, but the quotient metric is a well-defined metric on the same set which induces acoarser topology. Moreover, different metrics on the original topological space (a disjoint union of countably many intervals) lead to different topologies on the quotient.[31]
A topological space issequential if and only if it is a (topological) quotient of a metric space.[32]
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 ofcategory theory.
Continuity spaces are a generalization of metric spaces andposets that can be used to unify the notions of metric spaces anddomains.
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, infunctional analysis pseudometrics often come fromseminorms on vector spaces, and so it is natural to call them "semimetrics". This conflicts with the use of the term intopology.
Some authors define metrics so as to allow the distance functiond to attain the value ∞, i.e. distances are non-negative numbers on theextended real number line.[4] Such a function is also called anextended metric or "∞-metric". Every extended metric can be replaced by a real-valued metric that is topologically equivalent. This can be done using asubadditive monotonically increasing bounded function which is zero at zero, e.g. or.
Metrics valued in structures other than the real numbers
More generaldirected sets. In the absence of an addition operation, the triangle inequality does not make sense and is replaced with anultrametric inequality. This leads to the notion of ageneralized ultrametric.[33]
Apseudometric on is a function which satisfies the axioms for a metric, except that instead of the second (identity of indiscernibles) only for all is required.[34] In other words, the axioms for a pseudometric are:
.
In some contexts, pseudometrics are referred to assemimetrics[35] because of their relation toseminorms.
Occasionally, aquasimetric is defined as a function that satisfies all axioms for a metric with the possible exception of symmetry.[36] The name of this generalisation is not entirely standardized.[37]
Quasimetrics are common in real life. For example, given a setX of mountain villages, the typical walking times between elements ofX form a quasimetric because travel uphill takes longer than travel downhill. Another example is thelength of car rides in a city with one-way streets: here, a shortest path from pointA to pointB goes along a different set of streets than a shortest path fromB toA and may have a different length.
A quasimetric on the reals can be defined by settingThe 1 may be replaced, for example, by infinity or by or any othersubadditive function ofy-x. This quasimetric describes the cost of modifying a metal stick: it is easy to reduce its size byfiling it down, but it is difficult or impossible to grow it.
Given a quasimetric onX, one can define anR-ball aroundx to be the set. As in the case of a metric, such balls form a basis for a topology onX, 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.
In ametametric, 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:
Metametrics appear in the study ofGromov hyperbolic metric spaces and their boundaries. Thevisual metametric on such a space satisfies for points on the boundary, but otherwise is approximately the distance from to the boundary. Metametrics were first defined by Jussi Väisälä.[38] In other work, a function satisfying these axioms is called apartial metric[39][40] or adislocated metric.[34]
Asemimetric on is a function that satisfies the first three axioms, but not necessarily the triangle inequality:
Some authors work with a weaker form of the triangle inequality, such as:
ρ-relaxed triangle inequality
ρ-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 asquasimetrics,[41]nearmetrics[42] orinframetrics.[43]
The ρ-inframetric inequalities were introduced to modelround-trip delay times in theinternet.[43] The triangle inequality implies the 2-inframetric inequality, and theultrametric inequality is exactly the 1-inframetric inequality.
Relaxing the last three axioms leads to the notion of apremetric, i.e. a function satisfying the following conditions:
This is not a standard term. Sometimes it is used to refer to other generalizations of metrics such as pseudosemimetrics[44] or pseudometrics;[45] in translations of Russian books it sometimes appears as "prametric".[46] A premetric that satisfies symmetry, i.e. a pseudosemimetric, is also called a distance.[47]
Any premetric gives rise to a topology as follows. For a positive real, the-ball centered at a point is defined as
A set is calledopen if for any point in the set there is an-ball centered at which is contained in the set. Every premetric space is a topological space, and in fact asequential space.In general, the-balls themselves need not be open sets with respect to this topology. As for metrics, the distance between two sets and, is defined as
This defines a premetric on thepower 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 apreclosure operator as follows:
The prefixespseudo-,quasi- andsemi- can also be combined, e.g., apseudoquasimetric (sometimes calledhemimetric) relaxes both the indiscernibility axiom and the symmetry axiom and is simply a premetric satisfying the triangle inequality. For pseudoquasimetric spaces the open-balls form a basis of open sets. A very basic example of a pseudoquasimetric space is the set with the premetric given by and The associated topological space is theSierpiński space.
Sets equipped with an extended pseudoquasimetric were studied byWilliam Lawvere as "generalized metric spaces".[48] From acategorical point of view, the extended pseudometric spaces and the extended pseudoquasimetric spaces, along with their corresponding nonexpansive maps, are the best behaved of themetric 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 asenriched categories. The ordered set can be seen as acategory with onemorphism if and none otherwise. Using+ as thetensor product and 0 as theidentity makes this category into amonoidal category.Every (extended pseudoquasi-)metric space can now be viewed as a category enriched over:
The objects of the category are the points ofM.
For every pair of pointsx andy such that, there is a single morphism which is assigned the object of.
The triangle inequality and the fact that for all pointsx derive from the properties of composition and identity in an enriched category.
Since is a poset, alldiagrams that are required for an enriched category commute automatically.
The notion of a metric can be generalized from a distance between two elements to a number assigned to a multiset of elements. Amultiset is a generalization of the notion of aset in which an element can occur more than once. Define the multiset union as follows: if an elementx occursm times inX andn times inY then it occursm +n times inU. A functiond on the set of nonempty finite multisets of elements of a setM is a metric[49] if
By considering the cases of axioms 1 and 2 in which the multisetX has two elements and the case of axiom 3 in which the multisetsX,Y, andZ 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.
^Balls with rational radius around a pointx form aneighborhood basis for that point.
^In the context ofintervals 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 finitevolume, so do many unbounded sets. Therefore this terminology is imprecise.
^This differs from usage inRiemannian geometry, where geodesics are only locally shortest paths. Some authors define geodesics in metric spaces in the same way.[18][19]
^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.S2CID119129867.
^Linial, Nathan (2003). "Finite metric-spaces—combinatorics, geometry and algorithms".Proceedings of the ICM, Beijing 2002. Vol. 3. pp. 573–586.arXiv:math/0304466.
^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.
^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.
^SeeBurago, Burago & Ivanov 2001, Example 3.1.17, although in this book the quotient is incorrectly claimed to be homeomorphic to the topological quotient.
Lawvere, F. William (December 1973). "Metric spaces, generalized logic, and closed categories".Rendiconti del Seminario Matematico e Fisico di Milano.43 (1):135–166.doi:10.1007/BF02924844.S2CID1845177.
Smyth, M. (1988), "Quasi uniformities: reconciling domains with metric spaces", in Main, M.; Melton, A.; Mislove, M.; Schmidt, D. (eds.),Mathematical Foundations of Programming Language Semantics, Lecture Notes in Computer Science, vol. 298, Springer-Verlag, pp. 236–253,doi:10.1007/3-540-19020-1_12,ISBN978-3-540-19020-2