What is a Metric Space?

Suppose you have a space in the mathematical sense. If you are able to calculate the distance between any two points, then we call this a "metric space". To calculate the distance you need a function called a metric.

What is a Metric?

A metric is a function \(d(x,y) \) that calculates the distance between two points in a space. This function returns a real number and must satisfy a few axioms:

  • \(d(x,y)>0\). The distance between two different points must be positive.

  • \(d(x,x)=0\). The distance between a point and itself is 0. I shudder to imagine a world where this were not true.

  • \(d(x,z)\leq d(x,y) + d(y,z)\): This is called the triangle inequality and feels different than the first two axioms, so let's discuss it in greater detail below.

Triangle Inequality

\( d(x,z) \leq d(x,y) + d(y,z) \)

The triangle Inequality says that \( XZ \leq XY + YZ \). We intuitively understand this because \(XZ\) is the shortest path between \(X\) and \(Z\). If you take the detour through \(Y\) it will definitely be a longer path. By requiring our metric also has the triangle inequality, we are saying that the distance between two points cannot be decreased by taking a "shortcut" through a third point. In other words, the metric is properly defined as the shortest distance between two points - the length of the direct path connecting them.

Metric Space Example

A Circle

One way to define \(d(x,z)\) is the length of the shortest arc connecting them. The first two axioms are straightforward. But what about the triangle inequality? Here's why it holds. The points cut the circle into 2 sectors: a short & long one. (Unless the circle is cut in half.) For practice, check \(d(x,z)\leq d(x,y)+d(y,z)\) by considering the two cases: 1) \(y\) is on the short sector, and 2) \(y\) is on the long sector.
A circle with two points on the perimeter and the angle between the points labeled