# Metric (mathematics)

In mathematics, a metric or distance function is a function which defines a distance between 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. When a topological space has a topology that can be described by a metric, we say that the topological space is metrizable.

In differential geometry, the word "metric" is also used to refer to a structure defined only on a vector space which is more properly termed a metric tensor (or Riemannian or pseudo-Riemannian metric).

## Definition

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

d : X × XR

(where R is the set of real numbers). For all x, y, z in X, this function is required to satisfy the following conditions:

1. $d(x, y)\geq 0$ (non-negativity)
2. $d(x, y) = 0\,$ if and only if x = y (identity of indiscernibles. Note that condition 1 and 2 together produce positive definiteness)
3. $d(x, y) = d(y, x)\,$ (symmetry)
4. $d(x, z)\leq d(x, y) + d(y, z)\,$ (subadditivity / triangle inequality).

The first condition is implied by the others.

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:

For all x, y, z in M, d(x, z) ≤ max(d(x, y), d(y, z))

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

For sets on which an addition + : X × XX is defined, d is called a translation invariant metric if $d(x, y) = d(x + a, y + a)\,$

for all x, y and a in X.