The manhattan distance is a different way of measuring distance. It is named after the grid shape of streets in Manhattan. If there are two points, and , the manhattan distance between the two points is .
This distance can be imagined as the length needed to move between two points in a grid where you can only move up, down, left or right.
Extension[change | change source]
This definition can be used for three and higher dimensions too. If there are two vectors, and , then the manhattan distance between the two points is the absolute value of the difference between all numbers in the vector. Or, in notation: