Metric space

We take for granted that we can measure distances. Most people take for granted that we can represent physical space mathematically and calculate distances between pairs of points. We generally think of ourselves as living in R3, or 3D Euclidean space. Since this is how we represent physical space, it’s generally the most useful (though we often work in R2, or the Cartesian plane, for convenience of drawing pictures). These spaces have a metric, a way of measuring distance. However, there are different spaces with different metrics and different notions of distance.

The Euclidean metric

This is the familiar distance formula. Given a pair of points (x1, y1) and (x2, y2), the distance between them is given by the following expression:

There are a few things to notice about this definition. First, because it is a square root, it is always nonnegative. Second, it is equal to zero if and only if the two points are the same. Otherwise, the distance is positive. Also, the order of the points doesn’t matter. Finally, we have the triangle inequality: the distance from point A to point C can be no greater than the sum of the distances from A to B and B to C. Essentially, the shortest distance between two points is always a straight line.

These end up being the common features that define a metric. All n-dimensional real-valued spaces are metric spaces with the Euclidean metric. However, these are not the only Euclidean spaces. C, the complex plane, is Euclidean, as are n-dimensional rational-valued spaces. These are just a few examples.

In R, the real number line, the Euclidean metric reduces to the absolute value of the difference between two numbers.

The taxicab metric

Imagine our 2D space as the map of a city with streets laid out in a grid. The distance as the crow flies would be the Euclidean metric. The taxicab metric is the actual distance it would take to travel from point A to point B.

More formally, it is the sum of the horizontal and vertical distances between two points. We can think of this as following a zig-zagging path or, equivalently, as going straight up and over.

Under the taxicab metric, the red, blue, and yellow paths are all equally the shortest distance. (Image by Bogdan)

The discrete metric

This metric is defined as follows. If P and Q are different points, then the distance between them is 1. If P and Q are the same point, then the distance between them is 0.

The discrete metric has all the properties described above, but it isn’t our ordinary notion of distance. Rather than proximity, it measures sameness. Notably, this metric can be defined for any set, numeric or not. It has practical applications, as seen in this paper on data processing.

The Chebyshev metric

Also called the maximum metric, it is defined as the greatest difference between corresponding coordinates. In other words, it is equal to either the horizontal or the vertical distance, whichever is greater. This is, to me, the least intuitive out of this list. It satisfies all the criteria to be a metric, despite having a somewhat strange definition. In fact, it is also used in real life, for example in image processing. Differences in values for a pair of pixels in an image can be given by a Chebyshev distance, such as in this paper on an image denoising algorithm.

Norms

In a set with a natural zero point (properly speaking, a vector space), a metric induces a norm. Not to be confused with social norms, this is the distance between any point and zero, and represents something like magnitude. For the complex numbers, this extends the idea of absolute value from the real numbers. In vector math, the norm is the length of the vector.

Significance

A lot of information processing, including machine learning, uses metrics and norms. This is a much more abstract view of “geometry,” where points and distances don’t represent physical locations and physical distances. The greatest power of math in my opinion is to generalize an idea and apply it to situations that are totally unrelated to the original context.

Leave a comment