Metric space

Ever wondered how to measure distance in a city grid?

Metric space

Ever wondered how to measure distance in a city grid?

Imagine you're navigating through a city with streets laid out in a perfect grid pattern. You need to find the shortest path from your current location to your destination, but you can't just walk straight; you must follow the streets.

Picture the city grid as a chessboard. To get from one corner to the opposite corner, you don't just count the squares. Instead, you count the horizontal and vertical moves separately, adding them together to find the total number of steps.

Example

If you start 3 blocks east and 4 blocks north of your destination, you need to move 3 blocks west and 4 blocks south, totaling 7 blocks.

Remember this

The Manhattan distance is the sum of the absolute differences of their coordinates.

Related concepts

Swipe through more Machine Learning concepts

Open Pocket Polymath