# Metric (mathematics) 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 $6{\sqrt {2}}\approx 8.49$ , and is the unique shortest path.

In mathematics, a metric or distance function is a function that defines a distance between each pair of elements of a set. A set with a metric is called 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 called metrizable.

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)

$d:X\times X\to [0,\infty )$ ,

where $[0,\infty )$ is the set of non-negative real numbers and for all $x,y,z\in X$ , the following three axioms are satisfied:

 1 $d(x,y)=0\Leftrightarrow x=y$ identity of indiscernibles 2 $d(x,y)=d(y,x)$ symmetry 3 $d(x,y)\leq d(x,z)+d(z,y)$ subadditivity or triangle inequality

These axioms also imply the non-negativity or separation condition:

$d(x,y)\geq 0$ for all $x,y\in X$ Namely, applying axioms 1, 3, and 2 in that order yields $0=d(x,x)\leq d(x,y)+d(y,x)=d(x,y)+d(x,y)=2d(x,y)$ which implies $0\leq d(x,y)$ .

Non-negativity and axiom 2 together define what is called a positive-definite function.

A metric is called an ultrametric if it satisfies the following stronger version of the triangle inequality where points can never fall 'between' other points:

$d(x,y)\leq \max(d(x,z),d(z,y))$ for all $x,y,z\in X$ A metric d on X is called intrinsic if any two points x and y in X can be joined by a curve with length arbitrarily close to d(x, y).

A metric d on a group G (written multiplicatively) is said to be left-invariant (resp. right invariant) if we have

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

for all x, y, and z in G.