Metric
A metric, sometimes referred to as a distance function, is a function that defines a real nonnegative distance between every two elements of a set. It is commonly denoted by the variable \(d\). In colon-to notation, a metric \(d\) that defines distances between elements of the set \(S\) is written:
In this case we say \(d\) is a metric on \(S\).
That is, a metric \(d\) on a set \(S\) takes as input any two elements \(a\) and \(b\) from \(S\) and outputs a number that is taken to define their distance in \(S\) under \(d\). Apart from being nonnegative real numbers, the distances a metric outputs must follow three other rules in order for the function to meet the definition of a metric. A function that matches the above colon-to notation is called a metric if and only if it satisfies these requirements. The following must hold for any choice of \(a\), \(b\), and \(c\) in \(S\):
\(d(a, b) = 0 \iff a = b\)
\(d(a, b) = d(b, a)\)
\(d(a, b) + d(b, c) \geq d(a, c)\)
(1) effectively states both that the distance from an element to itself is 0, and that the distance between non-identical elements must be greater than 0. (2) asserts that a metric must be commutative; informally the distance from \(a\) to \(b\) must be the same as the distance from \(b\) to \(a\). Finally, (3) is known as the triangle inequality and asserts that the distance from \(a\) to \(c\) is at most as large as the sum of the distances from \(a\) to \(b\) and from \(b\) to \(c\). It is named as such because in euclidean space, the points \(a\), \(b\), and \(c\) form a triangle, and the inequality requires that the length of one side of the triangle is not longer than the sum of the lengths of the other two sides; violating this would mean that the shortest path between two points is no longer the straight line between them.
It is possible (and relatively common!) to deal with multiple different metrics on the same set. This means we are using the same set elements as labels, but treating the distances between elements differently; in this case the different metric spaces we are defining may have very different properties. If multiple metrics are being considered, we must be careful when speaking of distances between elements of the set to specify which metric we are using. For example, if \(d\) and \(e\) are both metrics on \(S\), we cannot just say “the distance between \(a\) and \(b\) in \(S\)” because it is ambiguous whether we are referring to \(d(a, b)\) or to \(e(a, b)\). We could instead say something like “the distance between \(a\) and \(b\) under \(e\)” to remove the ambiguity.
The most commonly-used metric on Cartesian space is the Euclidean metric, defined in two dimensions as \(d(a, b) = \sqrt{(a_1-b_1)^2 + (a_2-b_2)^2}\), and more generally in \(n\) dimensions as \(d(a, b) = \sqrt{\sum_{i=1}^n (a_i-b_i)^2}\).
A less-common metric on Cartesian space is the Manhattan metric, defined generally as \(d(a, b) = \sum_{i=1}^n |a_i-b_i|\); the distance is analogous to the distance taken between two points on a rectangular grid when motion is constrained to be purely vertical or horizontal, but not diagonal.
A metric induces a topology add intuitive/nonalgebraic explanation lens proof that Euclidean and Manhattan distances are metrics
Parents:
- Mathematics
Mathematics is the study of numbers and other ideal objects that can be described by axioms.
This is a clear explanation, but I think some formatting changes could enable readers to grok it even more quickly.
Suppose a reader understands two of the three requirements and just needs an explanation of the third. It would be cool if they could find the sentences they’re looking for w/o having to scan a whole paragraph looking for the words, “first”, “second”, or “third”.
I think we can achieve this by A) moving each explanation right under the equation / inequality it’s talking about, or B) putting the three explanations in a second numbered list, or C) leaving the three explanations in a paragraph, but use the numerals 1, 2, and 3 within the paragraph. Might require some experimentation to see what looks best.
Thanks for the feedback! I’d prefer to have the explanations underneath the requirement they refer to, but I haven’t been able to get the spacing to look good. I added numbers into the paragraph to make it visually easy to find where each requirement is discussed. If I get the spacing to work well, I’ll switch to that.
Is [0, inf) same as R+?
I was under the impression that R+ doesn’t include 0. If that’s the case, then it is not the same.