# Euclidean vs Chebyshev vs Manhattan Distance

I have learned new things while trying to solve programming puzzles. One of these is the calculation of distance.

There are many metrics to calculate a distance between 2 points p (x1, y1) and q (x2, y2) in xy-plane. We can count Euclidean distance, or Chebyshev distance or manhattan distance, etc. Each one is different from the others.

To simplify the idea and to illustrate these 3 metrics, I have drawn 3 images as shown below. The first one is Euclidean distance. The distance can be defined as a straight line between 2 points. The formula to calculate this has been shown in the image. In Chebyshev distance, all 8 adjacent cells from the given point can be reached by one unit. The last one is also known as L1 distance. The distance between two points is the sum of the (absolute) differences of their coordinates. E.g. it only costs 1 unit for a straight move, but 2 if one wants to take a crossed move.

Applications of these in Chess:

In chess, the distance between squares on the chessboard for rooks is measured in Manhattan distance; kings and queens use Chebyshev distance, andbishops use the Manhattan distance (between squares of the same color) on the chessboard rotated 45 degrees, i.e., with its diagonals as coordinate axes. To reach from one square to another, only kings require the number of moves equal to the distance; rooks, queens and bishops require one or two moves (on an empty board, and assuming that the move is possible at all in the bishop’s case). (Wikipedia)

## 7 thoughts on “Euclidean vs Chebyshev vs Manhattan Distance”

1. sofya laeli says:

Thank you for sharing 🙂

2. zxzl says:

thank you for clear explanation

3. Rathna says:

Thank u.

4. Pingback: Returns clustering with K-means algorithm | QuantDare
5. Pingback: quantDare
6. Ambi says:

Great explanations!

7. Ken says:

Thank you for sharing this I was wondering around Euclidean and Manhattan distances and this post explains it great