Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

There is no usage guidance for this tag … yet!

Usage guidance, also known as a tag wiki excerpt, is a short blurb that describes when and why a tag should be used on this site specifically.

Manhattan Distance is an alternative distance metric to Euclidean Distance. It is calculated by taking the absolute difference between two points.

Formally, it is given by:

$d_1(x, y) = \|x - y\|_1 = \sum\limits_{i=1}^{n} |x_i - y_i|$

As an example:

If $x = (a, b)$ and $y = (c, d)$ then:

Manhattan Distance = $|a - c| + |b - d|$