# Metric (mathematics)

In mathematics, a **metric** or **distance function** is a function that gives a distance between each pair of point elements of a set. A set with a metric is a *metric space*.^{[1]} A metric induces a topology on a set, but not all topologies can be generated by a metric. A topological space whose topology can be described by a metric is a metrizable space.

One important source of metrics in differential geometry are metric tensors, bilinear forms that may be defined from the tangent vectors of a differentiable manifold onto a scalar. A metric tensor allows distances along curves to be determined through integration, and thus determines a metric.

A metric on a set X is a function (called *distance function* or simply *distance*)

From these axioms the non-negativity of metrics can be derived like so:

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.

These conditions express intuitive notions about the concept of distance. 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 in his work stated that the shortest distance between two points is a line; that was the triangle inequality for his geometry.

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.

Similarly, a seminorm induces a pseudometric (see below), and a homogeneous, translation invariant pseudometric induces a seminorm.

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 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.

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

Occasionally, a **quasimetric** is defined as a function that satisfies all axioms for a metric with the possible exception of symmetry.^{[6]} The name of this generalisation is not entirely standardized.^{[7]}

The topological space underlying this quasimetric space is the Sorgenfrey line. 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.

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:

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

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",^{[9]} "nearmetrics"^{[10]} or **inframetrics**.^{[11]}

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

Relaxing the last three axioms leads to the notion of a **premetric**, 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^{[12]} or pseudometrics;^{[13]} in translations of Russian books it sometimes appears as "prametric".^{[14]} A premetric that satisfies symmetry, i.e. a pseudosemimetric, is also called a distance.^{[15]}

Sets equipped with an extended pseudoquasimetric were studied by William Lawvere as "generalized metric spaces".^{[16]} 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 spaces are a generalization of metric spaces that maintains these good categorical properties.

Łukaszyk-Karmowski distance is a function defining a distance between two random variables or two random vectors. The axioms of this function are:

This distance function satisfies the identity of indiscernibles condition if and only if both arguments are described by idealized Dirac delta density probability distribution functions.

In differential geometry, one considers a metric tensor, which can be thought of as an "infinitesimal" quadratic metric function. This is defined as a nondegenerate symmetric bilinear form on the tangent space of a manifold with an appropriate differentiability 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 on the metric tensor, this restricts to the case of a Riemannian manifold, and the path integration yields a metric.

In general relativity the related concept is a metric tensor (general relativity) which expresses the structure of a pseudo-Riemannian manifold. Though the term "metric" is used, the fundamental idea is different because there are non-zero null vectors 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:^{[17]}