Mathematics has this idea of a metric, which generalises the idea of distances that we normally think about. If we take a set X, we can talk about a metric or distance function, which is a function d : X × X → X, that means “the distance between x and y”, and it has to have the following properties for any x, y, z ∈ X:
The distance between x and y is 0 if and only if they are the same thing: d(x,y) = 0 ⇔ x = y
Symmetry: The distance between x and y equals the distance between y and x: d(x,y) = d(y,x)
Triangle Inequality: If you’re going between x and y, detouring via z cannot be shorter: d(x,y) ≤ d(x,z) + d(z,y)