# metric

A metric on a set of objects defines a measure of distance on the set, that is, for each pair of objects it defines the distance between those objects. Formally a *metric* is a function \(d\) from pairs of elements of the set to the non-negative real numbers satisfying,

- \(d(a,b) = 0\) if and only if \(a=b\),
- \(d(a,b)=d(b,a)\), and
- \(d(a,b)+d(b,c)\geq d(a,c)\)

for all \(a\), \(b\), and \(c\) in the set. The third condition is known as the triangle inequality, and captures the idea that you can't draw a triangle with three lengths if one is longer than the other two combined.

The distance formula in the Cartesian plane is an example of a metric, but there are many other possible metrics on the Cartesian plane, and in more abstract settings the concept of a metric is central, for instance in vector spaces and Hilbert spaces.