Hide outline
Share guideFeedback
Guide
Taxicab Geometry: Manhattan Distance Intuition

Taxicab Geometry: Manhattan Distance Intuition

Build intuition for Manhattan distance by treating motion like a city grid, then use the Δx+Δy|Δx|+|Δy| rule to predict shortest routes, count how many exist, understand diamond shaped circles, and choose the right distance for the movement you actually have.

You are at one corner of a city block grid and your destination is three blocks east and two blocks north. You can feel the answer in your legs before you write anything down. It is five blocks, no matter how much you wish you could cut through buildings. Taxicab geometry is the math version of that feeling. It replaces straight line distance with distance along grid steps, and suddenly ideas like shortest path and circle look familiar but different in useful ways.

Grid movement changes distance

In taxicab geometry, you move like a taxi in Manhattan. Every step is either horizontal or vertical, and turning a corner is allowed and costs nothing extra beyond the steps themselves. The big shift is that distance depends on allowed movement, not on drawing a straight segment through space.

That is why two points can look close by eye yet take a long time to reach on a grid, and why some points that look farther can take the same number of blocks.

See the grid based picture of distance.

Movement rules matter
Distance is not a property of points alone. It is a property of points plus the paths you permit.

The Manhattan distance rule Δx+Δy|Δx|+|Δy|

Manhattan distance between points (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2) is

d1=x2x1+y2y1.d_1=\lvert x_2-x_1\rvert+\lvert y_2-y_1\rvert.

It measures how many horizontal and vertical units you must travel in total. The \lvert\cdot\rvert absolute value makes direction irrelevant. Walking three units left costs the same as three units right.

Two quick checks keep you grounded.

  • If the points share the same xx, then d1=Δyd_1=\lvertΔy\rvert because you only move vertically.
  • If the points share the same yy, then d1=Δxd_1=\lvertΔx\rvert because you only move horizontally.

Explore how the pieces add up for different point pairs.

Many shortest paths can tie

In Euclidean geometry, the shortest path between two points is a single straight segment. On a grid, shortest paths usually come in families. If you need a=Δxa=\lvertΔx\rvert horizontal steps and b=Δyb=\lvertΔy\rvert vertical steps, any route that uses exactly those a+ba+b steps in some order is shortest.

So the question is not what is the route, but how many shortest routes exist. You are choosing which of the a+ba+b step positions are horizontal moves. That count is the binomial coefficient

(a+ba)=(a+b)!a!b!.\binom{a+b}{a}=\frac{(a+b)!}{a!\,b!}.

Try counting shortest routes for a few displacements.

A practical intuition. The more balanced aa and bb are, the more shortest paths you get, because there are more ways to interleave two similarly sized stacks of moves.

Why taxicab circles are diamonds

A taxicab circle is the set of points at a fixed Manhattan distance rr from a center. Around the origin, that set is

x+y=r.\lvert x\rvert+\lvert y\rvert=r.

If you picture spending a distance budget of rr, every point on the circle is a trade between horizontal and vertical spending. If you spend more on xx, you must spend less on yy.

That trade creates straight edges instead of a smooth curve. In the first quadrant where x0x\ge0 and y0y\ge0, the equation becomes x+y=rx+y=r, a line segment. Reflecting that segment into all four quadrants produces a diamond shape.

See how taxicab circles compare to Euclidean circles.

Radius still means budget
In taxicab geometry, radius is not about as the crow flies. It is how far you can go using only grid steps.

What changes in the plane

Some Euclidean habits carry over, but several everyday ideas shift.

  • Shortest paths are often not unique, because many step orders tie for the same total.
  • Circles become diamonds, because equal distance is a linear trade between xx and yy.
  • Symmetry looks different, because the metric treats axis aligned directions as special.

Angles are the trickiest. Taxicab geometry does not reward diagonal direction the way Euclidean geometry does. If you rotate a picture by 4545^\circ, lengths typically change, so your usual angle based intuition about preserving shape can mislead you.

Compare the two geometries side by side.

When Manhattan equals Euclidean

Manhattan distance d1d_1 and Euclidean distance d2=(Δx)2+(Δy)2d_2=\sqrt{(Δx)^2+(Δy)^2} agree exactly when all movement is along one axis. If Δx=0Δx=0 or Δy=0Δy=0, then

d1=Δx+Δy=d2.d_1=\lvertΔx\rvert+\lvertΔy\rvert=d_2.

Otherwise, d1d_1 is larger. You can think of it as paying separately for horizontal and vertical work, while Euclidean distance lets you combine them by moving diagonally.

How close are they. One useful bound is d2d12d2d_2\le d_1\le \sqrt{2}\,d_2 in the plane. The worst case ratio happens when Δx=Δy\lvertΔx\rvert=\lvertΔy\rvert, meaning the displacement points along a 4545^\circ diagonal.

Play with direction and watch the ratio change.

Using Manhattan distance in practice

Taxicab geometry is not a curiosity. It is a match for situations where movement or cost is naturally separable by coordinate.

Good fits include.

  • Finding nearest locations in a city with grid like streets
  • Routing on grid maps, warehouse aisles, or circuit layouts
  • Clustering and similarity for data where features add independently

A quick decision test helps. If you can change xx without affecting the cost of changing yy, Manhattan distance often reflects your reality better than straight line distance. If diagonal motion is truly available and equally easy, Euclidean distance is usually the better model.

Try describing your own points or constraints to see which metric fits.

Model the cost
Pick the distance that matches what is expensive or impossible, not the distance that looks nicest on a diagram.

Choosing a metric to match movement

Every distance function is a promise about what paths count. Manhattan distance promises you can only pay for axis aligned steps, so it naturally emphasizes coordinate wise change. Euclidean distance promises you can move in any direction smoothly, so it rewards diagonals.

Next time you see a distance formula, ask one concrete question. If I had to physically travel this, what moves am I allowed to make. Answer that, then choose the metric that tells the same story.

Common questions and quick clarifications

Was this lesson helpful?
Dive Deeper

Generate a follow-up sub-lesson on any aspect of this topic

Related content