Definition · applies to sets · also called distance function

High school

A metric is a way of generalizing the concept of distance. Consider a set of points, and a rule that gives a “distance” between every two of them. The rule is a metric if

  1. no distance is negative,
  2. the distance is zero only from a point to itself,
  3. the distance is the same in both directions, and
  4. no distance is longer than a detour through a third point (the triangle inequality).
Undergraduate

Consider a set $X$ and a function $d : X \times X \to [0, \infty)$. The function $d$ is a metric on $X$ if, for all $x, y, z \in X$,

  1. $d(x, y) = 0$ if and only if $x = y$,
  2. $d(x, y) = d(y, x)$ (symmetry), and
  3. $d(x, z) \leq d(x, y) + d(y, z)$ (the triangle inequality).

The last condition is the triangle inequality. The set $X$ need not be a vector space.

Examples

Examples

Notes

In differential geometry, a “metric” (Riemannian metric) is an inner product on each tangent space, not a distance function, though it determines one. In everyday language, a “metric” is any measurement or performance indicator.

Distinctions involving this term

  • Norm vs. metric vs. inner product: Norms, metrics, and inner products measure size, distance, and angle, and each one gives the next in a natural way. A norm measures the lengths of vectors, a metric measures distances between points, and an inner product measures both lengths and angles. An inner product gives a norm, and a norm gives a metric, but not the reverse.

All definitions · All distinctions · All examples