# Metric (mathematics)

Short description: Mathematical function defining distance An illustration comparing the taxicab metric to the Euclidean metric on the plane: According to the taxicab metric the red, yellow, and blue paths have the same length (12). According to the Euclidean metric, the green path has length $\displaystyle{ 6 \sqrt{2} \approx 8.49 }$, and is the unique shortest path.

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

## Definition

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

$\displaystyle{ d : X \times X \to \R, }$

such that for all $\displaystyle{ x, y, z \in X }$, the following three axioms hold:

 1 $\displaystyle{ d(x, y) = 0 \iff x = y }$ identity of indiscernibles 2 $\displaystyle{ d(x, y) = d(y, x) }$ symmetry 3 $\displaystyle{ d(x, z) \leq d(x, y) + d(y, z) }$ triangle inequality

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

 $\displaystyle{ d(x,y) + d(y,x) \ge d(x,x) }$ by triangle inequality $\displaystyle{ d(x,y) + d(x,y) \ge d(x,x) }$ by symmetry $\displaystyle{ 2d(x,y) \ge 0 }$ by identity of indiscernibles 4. $\displaystyle{ d(x,y) \ge 0 }$ we have non-negativity

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.

A metric is called an ultrametric if it satisfies the following stronger version of the triangle inequality for all $\displaystyle{ x,y,z\in X }$:

$\displaystyle{ d(x, y) \leq \max \{ d(x, z), d(y, z) \}. }$

A metric $\displaystyle{ d }$ on $\displaystyle{ X }$ is called intrinsic if for all $\displaystyle{ x, y\in X }$ and any length $\displaystyle{ L \gt d(x,y) }$, there exists a curve of length less than $\displaystyle{ L }$ that joins $\displaystyle{ x }$ and $\displaystyle{ y }$.

A metric $\displaystyle{ d }$ on a group $\displaystyle{ G }$ (written multiplicatively) is said to be left-invariant (resp. right-invariant) if for all $\displaystyle{ x, y, z \in G }$

$\displaystyle{ d(zx, zy) = d(x, y) }$ [resp. $\displaystyle{ d(xz,yz)=d(x,y) }$].

A metric $\displaystyle{ d }$ on a commutative additive group $\displaystyle{ X }$ is said to be translation invariant if for all $\displaystyle{ x,y,z\in X }$

$\displaystyle{ d(x, y) = d(x + z, y + z), }$or equivalently $\displaystyle{ d(x, y) = d(x - y, 0). }$

Every vector space is also a commutative additive group and a metric on a real or complex vector space that is induced by a norm is always translation invariant. A metric $\displaystyle{ d }$ on a real or complex vector space $\displaystyle{ V }$ is induced by a norm if and only if it is translation invariant and absolutely homogeneous, where the latter means that for all scalars $\displaystyle{ s }$ and all $\displaystyle{ x, y \in V }$: $\displaystyle{ d(sx, sy) = |s| d(x, y) }$ holds, in which case the function $\displaystyle{ {\|x\|} := d(x, 0) }$ defines a norm on $\displaystyle{ V }$ and the canonical metric induced by $\displaystyle{ \| \cdot \| }$ is equal to $\displaystyle{ d. }$