TheInfoList In
mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ...
, a metric or distance function is a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
that gives a
distance Distance is a numerical measurement ' Measurement is the number, numerical quantification (science), quantification of the variable and attribute (research), attributes of an object or event, which can be used to compare with other objects or eve ... between each pair of point elements of a set. A set with a metric is called a
metric space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gene ...
. A metric induces a
topology In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ... on a set, but not all topologies can be generated by a metric. A
topological space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gener ...
whose topology can be described by a metric is called
metrizable In topology In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), an ...
. One important source of metrics in
differential geometry Differential geometry is a Mathematics, mathematical discipline that studies the geometry of smooth shapes and smooth spaces, otherwise known as smooth manifolds, using the techniques of differential calculus, integral calculus, linear algebra a ...
are
metric tensor In the mathematical Mathematics (from Greek Greek may refer to: Greece Anything of, from, or related to Greece Greece ( el, Ελλάδα, , ), officially the Hellenic Republic, is a country located in Southeast Europe. Its population ...
s,
bilinear form In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
s that may be defined from the
tangent vector :''For a more general — but much more technical — treatment of tangent vectors, see tangent space.'' In mathematics, a tangent vector is a Vector (geometry), vector that is tangent to a curve or Surface (mathematics), surface at a given point. T ...
s of a
differentiable manifold In mathematics, a differentiable manifold (also differential manifold) is a type of manifold The real projective plane is a two-dimensional manifold that cannot be realized in three dimensions without self-intersection, shown here as Boy's surfa ...
onto a scalar. A metric tensor allows distances along curves to be determined through integration, and thus determines a metric.

# Definition

A metric on a set is a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
(called ''distance function'' or simply ''distance'') : where $\left[0,\infty\right)$ is the set of non-negative real numbers and for all $x, y, z \in X$, the following three axioms are satisfied: : A metric (as defined) is a non-negative real-valued function. This, together with axiom 1, provides a ''separation condition'', where distinct or separate points are precisely those that have a positive distance between them. The requirement that $d$ have codomain of $\left[0,\infty\right)$ is a clarifying (but unnecessary) restriction in the definition, for if we had any function $d : X \times X \to \R$ that satisfied the same three axioms, the function could be proven to still be non-negative as follows (using axioms 1, 3, and 2 in that order): $0 = d\left(x, x\right) \le d\left(x, y\right) + d\left(y, x\right) = d\left(x, y\right) + d\left(x, y\right) = 2 d\left(x, y\right)$ which implies $0 \le d\left(x, y\right)$. A metric is called an
ultrametric In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
if it satisfies the following stronger version of the ''triangle inequality'' where points can never fall 'between' other points: : $d\left(x, y\right) \leq \max\left(d\left(x, z\right), d\left(y, z\right)\right)$ for all $x, y, z \in X$ A metric on is called
intrinsic In science and engineering, an intrinsic property is a property of a specified subject that exists itself or within the subject. An extrinsic property is not essential or inherent to the subject that is being characterized. For example, mass ...
if any two points and in can be joined by a
curve In mathematics, a curve (also called a curved line in older texts) is an object similar to a line (geometry), line, but that does not have to be Linearity, straight. Intuitively, a curve may be thought of as the trace left by a moving point (geo ... with
length Length is a measure of distance Distance is a numerical measurement ' Measurement is the number, numerical quantification (science), quantification of the variable and attribute (research), attributes of an object or event, which can be us ...
arbitrarily close to . A metric ''d'' on a group ''G'' (written multiplicatively) is said to be (resp. ) if we have :$d\left(zx, zy\right) = d\left(x, y\right)$ esp. $d\left(xz,yz\right)=d\left(x,y\right)$for all ''x'', ''y'', and ''z'' in ''G''. A metric $D$ on a commutative additive group $X$ is said to be if $D\left(x, y\right) = D\left(x + z, y + z\right)$ for all $x, y, z \in X,$ or equivalently, if $D\left(x, y\right) = D\left(x - y, 0\right)$ for all $x, y \in X.$ Every
vector space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...
is also a commutative additive group and a metric on a real or complex vector space that is induced by a
norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philosophy) Norms are concepts ( sentences) of practical import, oriented to effecting an action, rat ...
is always translation invariant. A metric $D$ on a real or complex vector space $X$ is induced by a norm if and only if it is translation invariant and , where the latter means that $D\left(sx, sy\right) = , s, D\left(x, y\right)$ for all scalars $s$ and all $x, y \in X,$ in which case the function $\, x \, := D\left(x, 0\right)$ defines a norm on $X$ and the canonical metric induced by $\, \cdot \,$ is equal to $D.$

# Notes

These conditions express intuitive notions about the concept of
distance Distance is a numerical measurement ' Measurement is the number, numerical quantification (science), quantification of the variable and attribute (research), attributes of an object or event, which can be used to compare with other objects or eve ... . 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 the distance from ''x'' to ''z'' via ''y'' is at least as great as from ''x'' to ''z'' directly.
Euclid Euclid (; grc-gre, Εὐκλείδης Euclid (; grc, Εὐκλείδης – ''Eukleídēs'', ; fl. 300 BC), sometimes called Euclid of Alexandria to distinguish him from Euclid of Megara, was a Greek mathematician, often referre ... in his
work Work may refer to: * Work (human activity) Work or labor is intentional activity people perform to support themselves, others, or the needs and wants of a wider community. Alternatively, work can be viewed as the human activity that cont ...
stated that the shortest distance between two points is a line; that was the triangle inequality for his geometry.

# Examples

* The
discrete metric Discrete in science is the opposite of continuous Continuity or continuous may refer to: Mathematics * Continuity (mathematics), the opposing concept to discreteness; common examples include ** Continuous probability distribution or random vari ...
: if ''x'' = ''y'' then ''d''(''x'',''y'') = 0. Otherwise, ''d''(''x'',''y'') = 1. * The
Euclidean metric In mathematics, the Euclidean distance between two points in Euclidean space is the length of a line segment between the two points. It can be calculated from the Cartesian coordinates of the points using the Pythagorean theorem, therefore occas ...
is translation and rotation invariant. * The taxicab metric is translation invariant. * More generally, any metric induced by a
norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philosophy) Norms are concepts ( sentences) of practical import, oriented to effecting an action, rat ...
is translation invariant. * If $\left(p_n\right)_$ is a
sequence In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ... of
seminorm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no genera ...
s defining a (
locally convex In functional analysis and related areas of mathematics, locally convex topological vector spaces (LCTVS) or locally convex spaces are examples of topological vector spaces (TVS) that generalize normed spaces. They can be defined as topological spa ...
)
topological vector space In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
''E'', then $d(x,y)=\sum_^\infty \frac \frac$ is a metric defining the same
topology In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ... . (One can replace $\frac$ by any summable sequence $\left(a_n\right)$ of strictly
positive number In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
s.) * The
normed space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...
$\left(\R, , \cdot , \right)$ is a
Banach space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...
where the absolute value is a
norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philosophy) Norms are concepts ( sentences) of practical import, oriented to effecting an action, rat ...
on the real line $\R$ that induces the usual
Euclidean topologyIn mathematics, and especially general topology, the Euclidean topology is the natural topology induced on n-dimensional Euclidean space \R^n by the Euclidean distance, Euclidean metric. Definition In any metric space, the Ball (mathematics), ope ...
on $\R.$ Define a metric $D : \R \times \R \to \R$ on $\R$ by $D\left(x, y\right) = , \arctan\left(x\right) - \arctan\left(y\right),$ for all $x, y \in \R.$ Just like induced metric, the metric $D$ also induces the usual Euclidean topology on . However, $D$ is not a complete metric because the sequence $x_ = \left\left(x_i\right\right)_^$ defined by $x_i := i$ is a sequence but it does not converge to any point of . As a consequence of not converging, this sequence cannot be a Cauchy sequence in $\left(\R, , \cdot , \right)$ (i.e. it is not a Cauchy sequence with respect to the norm $\, \cdot \,$) because if it was then the fact that $\left(\R, , \cdot , \right)$ is a Banach space would imply that it converges (a contradiction). * Graph metric, a metric defined in terms of distances in a certain graph. * The
Hamming distance In information theory Information theory is the scientific study of the quantification, storage, and communication Communication (from Latin ''communicare'', meaning "to share" or "to be in relation with") is "an apparent answer to ...
in coding theory. *
Riemannian metric In differential geometry, a Riemannian manifold or Riemannian space is a real manifold, real, smooth manifold ''M'' equipped with a positive-definite Inner product space, inner product ''g'p'' on the tangent space ''T'p'M'' at each poin ...
, a type of metric function that is appropriate to impose on any
differentiable manifold In mathematics, a differentiable manifold (also differential manifold) is a type of manifold The real projective plane is a two-dimensional manifold that cannot be realized in three dimensions without self-intersection, shown here as Boy's surfa ...
. For any such
manifold In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ... , one chooses at each point ''p'' a symmetric, positive definite, bilinear form ''L'': T''p'' × T''p'' → R on the
tangent space In , the tangent space of a generalizes to higher dimensions the notion of tangent planes to surfaces in three dimensions and tangent lines to curves in two dimensions. In the context of physics the tangent space to a manifold at a point can ...
T''p'' at ''p'', doing so in a smooth manner. This form determines the length of any tangent vector v on the manifold, via the definition $\, v\, = \sqrt$. Then for any differentiable path on the manifold, its length is defined as the integral of the length of the tangent vector to the path at any point, where the integration is done with respect to the path parameter. Finally, to get a metric defined on any pair of points of the manifold, one takes the infimum, over all paths from ''x'' to ''y'', of the set of path lengths. A smooth manifold equipped with a Riemannian metric is called a
Riemannian manifold In differential geometry Differential geometry is a Mathematics, mathematical discipline that studies the geometry of smooth shapes and smooth spaces, otherwise known as smooth manifolds, using the techniques of differential calculus, integr ...
. * The
Fubini–Study metricIn mathematics, the Fubini–Study metric is a Kähler metric on projective Hilbert space, that is, on a complex projective space CP''n'' endowed with a Hermitian form. This Metric (mathematics), metric was originally described in 1904 and 1905 by G ...
on
complex projective space In mathematics, complex projective space is the projective space with respect to the field of complex numbers. By analogy, whereas the points of a real projective space label the lines through the origin of a real Euclidean space, the points of a ...
. This is an example of a Riemannian metric. *
String metric In mathematics and computer science, a string metric (also known as a string similarity metric or string distance function) is a metric (mathematics), metric that measures distance ("inverse similarity") between two string (computer science), text ...
s, such as
Levenshtein distance In information theory Information theory is the scientific study of the quantification, storage, and communication Communication (from Latin ''communicare'', meaning "to share") is the act of developing Semantics, meaning among Subject (phi ...
and other string edit distances, define a metric over
strings String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
. *
Graph edit distanceIn mathematics and computer science, graph edit distance (GED) is a Similarity measure, measure of similarity (or dissimilarity) between two Graph (discrete mathematics), graphs. The concept of graph edit distance was first formalized mathematically ...
defines a distance function between
graphs Graph may refer to: Mathematics *Graph (discrete mathematics) In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes an ...
. * The
Wasserstein metric In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
is a distance function defined between two
probability distribution In probability theory Probability theory is the branch of mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces ...
s. * The
Finsler metric is a continuous nonnegative function defined on the tangent bundle.

# Equivalence of metrics

For a given set ''X'', two metrics ''d''1 and ''d''2 are called ''topologically equivalent'' (''uniformly equivalent'') if the identity mapping is a
homeomorphism In the mathematical Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantiti ...
(
uniform isomorphism In the mathematics, mathematical field of topology a uniform isomorphism or uniform homeomorphism is a special isomorphism between uniform spaces that respects uniform property, uniform properties. Definition A function_(mathematics), function f ...
). For example, if $d$ is a metric, then $\min \left(d, 1\right)$ and $\frac$ are metrics equivalent to $d.$

# Norm induced metric

Norms on vector spaces are equivalent to certain metrics, namely homogeneous, translation-invariant ones. In other words, every norm determines a metric, and some metrics determine a norm. Given a
normed vector space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
$\left(X, \, \cdot\, \right)$ we can define a metric $d$ on $X,$ called the or simply the , by :$d\left(x,y\right) := \, x-y\, .$ The metric $d$ is said to be the norm $\, \cdot\, .$ Conversely if a metric $d$ on a
vector space In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...
$X$ satisfies the properties * Translation invariance: $d\left(x,y\right) = d\left(x+a,y+a\right)$; * Absolute homogeneity: $d\left(\alpha x, \alpha y\right) = , \alpha, d\left(x,y\right)$; then a
norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philosophy) Norms are concepts ( sentences) of practical import, oriented to effecting an action, rat ...
on $X$ may be defined by :$\, x\, := d\left(x,0\right)$ where the metric induced by this norm is the original given metric $d.$ Similarly, a
seminorm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no genera ...
induces a pseudometric (see below), and a homogeneous, translation invariant pseudometric induces a seminorm.

# Metrics on multisets

We can generalize the notion of a metric from a distance between two elements to a distance between two nonempty finite multisets of elements. A
multiset In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
is a generalization of the notion of a set such that an element can occur more than once. Define $Z=XY$ if $Z$ is the multiset consisting of the elements of the multisets $X$ and $Y$, that is, if $x$ occurs once in $X$ and once in $Y$ then it occurs twice in $Z$. A distance function $d$ on the set of nonempty finite multisets is a metric if # $d\left(X\right)=0$ if all elements of $X$ are equal and $d\left(X\right) > 0$ otherwise (
positive definitenessIn mathematics, positive definiteness is a property of any object to which a bilinear form or a sesquilinear form may be naturally associated, which is positive-definite bilinear form, positive-definite. See, in particular: * Positive-definite bilin ...
), that is, ( non-negativity plus
identity of indiscernibles The identity of indiscernibles is an ontology, ontological principle that states that there cannot be separate object (philosophy), objects or wikt:entity, entities that have all their property (philosophy), properties in common. That is, entities ' ...
) # $d\left(X\right)$ is invariant under all permutations of $X$ (
symmetry Symmetry (from Greek#REDIRECT Greek Greek may refer to: Greece Anything of, from, or related to Greece Greece ( el, Ελλάδα, , ), officially the Hellenic Republic, is a country located in Southeast Europe. Its population is appro ... ) # $d\left(XY\right) \leq d\left(XZ\right)+d\left(ZY\right)$ (
triangle inequality In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ... ) Note that the familiar metric between two elements results if the multiset $X$ has two elements in 1 and 2 and the multisets $X,Y,Z$ have one element each in 3. For instance if $X$ consists of two occurrences of $x$, then $d\left(X\right)=0$ according to 1. A simple example is the set of all nonempty finite multisets $X$ of integers with $d\left(X\right)=\max\- \min\$. More complex examples are
information distanceInformation distance is the distance between two finite objects (represented as computer files) expressed as the number of bits in the shortest program which transforms one object into the other one or vice versa on a universal computer. This is an ...
in multisets; and
normalized compression distance Normalized compression distance (NCD) is a way of measuring the similarity between two objects, be it two documents, two letters, two emails, two music scores, two languages, two programs, two pictures, two systems, two genomes, to name a few. Suc ...
(NCD) in multisets.

# Generalized metrics

There are numerous ways of relaxing the axioms of metrics, 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 Functional analysis is a branch of mathematical analysis Analysis is the branch of mathematics dealing with Limit (mathematics), limits and related theories, such as Derivative, differentiation, Integral, integration, Measure (mathematics), ...
pseudometrics often come from
seminorm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no genera ...
s on vector spaces, and so it is natural to call them "semimetrics". This conflicts with the use of the term in
topology In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ... .

## Extended metrics

Some authors allow the distance function ''d'' to attain the value ∞, i.e. distances are non-negative numbers on the
extended real number line In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and t ...
. Such a function is called an ''extended metric'' or "∞-metric". Every extended metric can be transformed to a finite metric such that the metric spaces are equivalent as far as notions of
topology In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ... (such as continuity or
convergence Convergence may refer to: Arts and media Literature *Convergence (book series), ''Convergence'' (book series), edited by Ruth Nanda Anshen *Convergence (comics), "Convergence" (comics), two separate story lines published by DC Comics: **A four-par ...
) are concerned. This can be done using a
subadditiveIn mathematics, subadditivity is a property of a function that states, roughly, that evaluating the function for the sum of two element (set), elements of the Domain of a function, domain always returns something less than or equal to the sum of the ...
monotonically increasing bounded function which is zero at zero, e.g. ''d''′(''x'', ''y'') = ''d''(''x'', ''y'') / (1 + ''d''(''x'', ''y'')) or ''d''″(''x'', ''y'') = min(1, ''d''(''x'', ''y'')). The requirement that the metric take values in can even be relaxed to consider metrics with values in other
directed set In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...
s. The reformulation of the axioms in this case leads to the construction of
uniform space In the mathematical Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ...
s: topological spaces with an abstract structure enabling one to compare the local topologies of different points.

## Pseudometrics

A ''pseudometric'' on ''X'' is a function $d: X \times X \to \R$ which satisfies the axioms for a metric, except that instead of the second (identity of indiscernibles) only for all ''x'' is required. In other words, the axioms for a pseudometric are: # ''d''(''x'', ''y'') ≥ 0 # ''d''(''x'', ''x'') = 0 (but possibly ''d''(''x'', ''y'') = 0 for some distinct values ''x'' ≠ ''y''.) # ''d''(''x'', ''y'') = ''d''(''y'', ''x'') # ''d''(''x'', ''z'') ≤ ''d''(''x'', ''y'') + ''d''(''y'', ''z''). In some contexts, pseudometrics are referred to as ''semimetrics'' because of their relation to
seminorm In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no genera ...
s.

## 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. # ''d''(''x'', ''y'') ≥ 0 (''positivity'') # ''d''(''x'', ''y'') = 0   if and only if   ''x'' = ''y'' (''positive definiteness'') # ''d''(''x'', ''y'') = ''d''(''y'', ''x'') (''symmetry'', dropped) # ''d''(''x'', ''z'') ≤ ''d''(''x'', ''y'') + ''d''(''y'', ''z'') (''triangle inequality'') 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 up hill takes longer than travel down hill. Another example is a
taxicab geometry A taxicab geometry is a form of geometry Geometry (from the grc, γεωμετρία; ' "earth", ' "measurement") is, with , one of the oldest branches of . It is concerned with properties of space that are related with distance, shape, si ...
topology having one-way streets, where a path from point ''A'' to point ''B'' comprises a different set of streets than a path from ''B'' to ''A''. A quasimetric on the reals can be defined by setting :''d''(''x'', ''y'') = ''x'' − ''y'' if ''x'' ≥ ''y'', and :''d''(''x'', ''y'') = 1 otherwise. The 1 may be replaced by infinity or by $1 + 10^$. The topological space underlying this quasimetric space is the
Sorgenfrey line In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...
. This space describes the process of filing down a metal stick: it is easy to reduce its size, but it is difficult or impossible to grow it. If ''d'' is a quasimetric on ''X'', a metric ''d''' on ''X'' can be formed by taking :''d'''(''x'', ''y'') = (''d''(''x'', ''y'') + ''d''(''y'', ''x'')).

## Metametrics

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: # ''d''(''x'', ''y'') ≥ 0 # ''d''(''x'', ''y'') = 0 implies ''x'' = ''y'' (but not vice versa.) # ''d''(''x'', ''y'') = ''d''(''y'', ''x'') # ''d''(''x'', ''z'') ≤ ''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 for points ''x'' on the boundary, but otherwise ''d''(''x'', ''x'') is approximately the distance from ''x'' to the boundary. Metametrics were first defined by Jussi Väisälä.

## Semimetrics

A semimetric on ''X'' is a function $d: X \times X \to \R$ that satisfies the first three axioms, but not necessarily the triangle inequality: # ''d''(''x'', ''y'') ≥ 0 # ''d''(''x'', ''y'') = 0   if and only if   ''x'' = ''y'' # ''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'')) (ρ-relaxed triangle inequality) : ''d''(''x'', ''z'') ≤ ρ 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 time In telecommunication Telecommunication is the transmission of information by various types of technologies over wire A wire is a single usually cylindrical A cylinder (from Greek Greek may refer to: Greece Anything of, from, or re ...
s in the
internet The Internet (or internet) is the global system of interconnected computer networks that uses the Internet protocol suite (TCP/IP) to communicate between networks and devices. It is a ''internetworking, network of networks'' that consist ... . The triangle inequality implies the 2-inframetric inequality, and the
ultrametric inequality In mathematics, an ultrametric space is a metric space in which the triangle inequality is strengthened to d(x,z)\leq\max\left\. Sometimes the associated metric is also called a non-Archimedean metric or super-metric. Although some of the theorems f ...
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: # ''d''(''x'', ''y'') ≥ 0 # ''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'', the ''r''-ball centered at a point ''p'' is defined as :''Br''(''p'') = . A set is called ''open'' if for any point ''p'' in the set there is an ''r''-ball centered at ''p'' which is contained in the set. Every premetric space is a topological space, and in fact a
sequential space In topology s, which have only one surface and one edge, are a kind of object studied in topology. In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical struc ...
. In general, the ''r''-balls themselves need not be open sets with respect to this topology. As for metrics, the distance between two sets ''A'' and ''B'', is defined as :''d''(''A'', ''B'') = inf''x''∊''A'', ''y''∊''B'' ''d''(''x'', ''y''). This defines a premetric on the
power set In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities an ...
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 operatorIn topology s, which have only one surface and one edge, are a kind of object studied in topology. In mathematics, topology (from the Greek language, Greek words , and ) is concerned with the properties of a mathematical object, geometric object ...
''cl'' as follows: :''cl''(''A'') = .

## 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''-balls form a basis of open sets. A very basic example of a pseudoquasimetric space is the set with the premetric given by ''d''(0,1) = 1 and ''d''(1,0) = 0. The associated topological space is the Sierpiński space. Sets equipped with an extended pseudoquasimetric were studied by
William Lawvere Francis William Lawvere (; born February 9, 1937) is a mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number ... 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.
Approach spaceIn topology s, which have only one surface and one edge, are a kind of object studied in topology. In mathematics, topology (from the Greek language, Greek words , and ) is concerned with the properties of a mathematical object, geometric object ...
s are a generalization of metric spaces that maintains these good categorical properties.

## Łukaszyk-Karmowski distance

Łukaszyk-Karmowski distance is a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
defining a
distance Distance is a numerical measurement Measurement is the quantification (science), quantification of variable and attribute (research), attributes of an object or event, which can be used to compare with other objects or events. The scope and ...
between two
random variable A random variable is a variable whose values depend on outcomes of a random In common parlance, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no ...
s or two
random vector In probability Probability is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculu ...
s. The axioms of this function are: # ''d''(''x'', ''y'') > 0 # ''d''(''x'', ''y'') = ''d''(''y'', ''x'') # ''d''(''x'', ''z'') ≤ ''d''(''x'', ''y'') + ''d''(''y'', ''z''). This distance function satisfies the
identity of indiscernibles The identity of indiscernibles is an ontology, ontological principle that states that there cannot be separate object (philosophy), objects or wikt:entity, entities that have all their property (philosophy), properties in common. That is, entities ' ...
condition
if and only if In logic Logic is an interdisciplinary field which studies truth and reasoning. Informal logic seeks to characterize Validity (logic), valid arguments informally, for instance by listing varieties of fallacies. Formal logic represents st ...
both arguments are described by idealized
Dirac delta In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities ...
density
probability distribution functionA probability distribution function is some function that may be used to define a particular probability distribution. Depending upon which text is consulted, the term may refer to: * a cumulative distribution function * a probability mass function * ...
s.

## Important cases of generalized metrics

In
differential geometry Differential geometry is a Mathematics, mathematical discipline that studies the geometry of smooth shapes and smooth spaces, otherwise known as smooth manifolds, using the techniques of differential calculus, integral calculus, linear algebra a ...
, one considers a
metric tensor In the mathematical Mathematics (from Greek Greek may refer to: Greece Anything of, from, or related to Greece Greece ( el, Ελλάδα, , ), officially the Hellenic Republic, is a country located in Southeast Europe. Its population ...
, which can be thought of as an "infinitesimal" quadratic metric function. This is defined as a nondegenerate symmetric
bilinear form In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
on the
tangent space In , the tangent space of a generalizes to higher dimensions the notion of tangent planes to surfaces in three dimensions and tangent lines to curves in two dimensions. In the context of physics the tangent space to a manifold at a point can ...
of a
manifold In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities a ... with an appropriate
differentiability In calculus Calculus, originally called infinitesimal calculus or "the calculus of infinitesimal In mathematics, infinitesimals or infinitesimal numbers are quantities that are closer to zero than any standard real number, but are not zero. T ...
requirement. While these are not metric functions as defined in this article, they induce what is called a pseudo-semimetric function by integration of its square root along a path through the manifold. If one imposes the positive-definiteness requirement of an
inner product In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and ...
on the metric tensor, this restricts to the case of a
Riemannian manifold In differential geometry Differential geometry is a Mathematics, mathematical discipline that studies the geometry of smooth shapes and smooth spaces, otherwise known as smooth manifolds, using the techniques of differential calculus, integr ...
, and the path integration yields a metric. In
general relativity General relativity, also known as the general theory of relativity, is the geometric Geometry (from the grc, γεωμετρία; '' geo-'' "earth", '' -metron'' "measurement") is, with arithmetic, one of the oldest branches of mathema ...
the related concept is a
metric tensor (general relativity) In general relativity General relativity, also known as the general theory of relativity, is the differential geometry, geometric scientific theory, theory of gravitation published by Albert Einstein in 1915 and is the current description of g ...
which expresses the structure of a
pseudo-Riemannian manifold In differential geometry Differential geometry is a Mathematics, mathematical discipline that uses the techniques of differential calculus, integral calculus, linear algebra and multilinear algebra to study problems in geometry. The Differenti ...
. Though the term "metric" is used, the fundamental idea is different because there are non-zero
null vector In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
s in the tangent space of these manifolds, and vectors can have negative squared norms. This generalized view of "metrics", in which zero distance does ''not'' imply identity, has crept into some mathematical writing too:: "This bilinear form is variously called the ''Lorentz metric'', or ''Minkowski metric'' or ''metric tensor''"; : "We call this scalar product the ''Lorentz metric''"