Coordinate Geometry
Manhattan distance
The distance travelled along a grid rather than in a straight line, which is what a taxi actually drives.
The Formula
distance = |x2 - x1| + |y2 - y1|
The distance travelled along a grid rather than in a straight line, which is what a taxi actually drives.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| d1 | Manhattan distance | units | Grid distance between the points. |
| x1 | First x | units | Horizontal coordinate of the first point. |
| y1 | First y | units | Vertical coordinate of the first point. |
| x2 | Second x | units | Horizontal coordinate of the second point. |
| y2 | Second y | units | Vertical coordinate of the second point. |
What Each Symbol Means
d1units
Manhattan distance
Grid distance between the points.
x1units
First x
Horizontal coordinate of the first point.
y1units
First y
Vertical coordinate of the first point.
x2units
Second x
Horizontal coordinate of the second point.
y2units
Second y
Vertical coordinate of the second point.
See It Worked With Real Numbers
A formula on its own does not tell you which number goes where. The how to calculate the distance between two points page applies this equation to a concrete case, shows every intermediate step, and names the mistakes that produce a wrong answer even when the algebra is right.
Where This Formula Appears
This equation is the working core of How To Calculate The Distance Between Two Points, filed under Math. Every number the guide produces comes from substituting into this one line.