Metric
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
- no distance is negative,
- the distance is zero only from a point to itself,
- the distance is the same in both directions, and
- 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$,
- $d(x, y) = 0$ if and only if $x = y$,
- $d(x, y) = d(y, x)$ (symmetry), and
- $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
-
$d(x, y) = \sqrt{(x_1 - y_1)^2 + (x_2 - y_2)^2}$ on $\reals^2$
High school
The Euclidean distance is a metric, and it comes from the Euclidean norm, as $d(x, y) = \norm{x - y}$.
-
Great-circle distance on the surface of the Earth
High school
Great-circle distance is a metric on the sphere.
-
$d(x, y) = 1$ for $x \neq y$, and $d(x, x) = 0$
(definition)
Undergraduate
The discrete metric is a metric.
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.