Distance Metrics

Core requirements #

Perfect distant metrics must fulfill core requirements:

  1. Distance from itself to itself should be 0 d(X,X)=0 d(X, X) = 0
  2. Symmetric distances1 d(X,Y)=d(Y,X) d(X, Y)=d(Y, X)
  3. Satisfy triangle inequality d(X,Z)d(X,Y)+d(Y,Z) d(X, Z) \leq d(X, Y)+ d(Y, Z)
  4. Positive for all other points d(X,Y)>0  X,Y; where XY d(X, Y) > 0 ~~ \forall X, Y ; \text{ where } X \neq Y

Satisfiability #

Only some Minkowski distances satisfy these constraints.

Minkowski distance is: d(X,Y)=(i=1nxyp)1p d(X, Y) = \left(\sum_{i=1}^{n}{|x-y|^{p}}\right)^{\frac{1}{p}} where X=(x1,x2,,xn) and Y=(y1,y2,,yn)R X = (x_1, x_2, \ldots , x_{n}) \text{ and } Y = (y_1, y_2, \ldots , y_{n}) \in \R .2

The only values of pp that satisfies requirements are:

p1p \geq 1

For example,

  • p=1p = 1 is Manhattan distance (L1 norm)
  • p=2p = 2 is Euclidean distance (L2 norm)

Any p<1p < 1 does not satisfy the triangle inequality (since distances become convex) and therefore isn’t considered a valid distance metric.


  1. If this requirement is ever weakened to an inequality then Dist(X,Y)Dist(X,Y) could be 0 even if XYX \neq Y . If this happens, then DistDist becomes a pseudo-metric. ↩︎

  2. Minkowski distance definition. ↩︎


July 25, 2020
categories: math
tags: distance, metric, minkowski