The distance formula is the Pythagorean theorem in disguise
Plot two points and drop a right angle between them: run horizontally from the first point until you are under the second, then climb vertically to reach it. Those two moves are the legs of a right triangle whose hypotenuse is the straight line you actually want. The horizontal leg has length |x₂ − x₁| and the vertical leg has length |y₂ − y₁|, so the Pythagorean theorem gives d² = Δx² + Δy².
There is no separate distance formula to memorise. Once you see the triangle, the formula writes itself, and that also explains why the absolute-value bars are unnecessary: squaring a negative difference gives the same result as squaring its positive twin. Subtracting the points in the other order flips the sign of both differences and changes nothing.
Because the formula only involves differences, it is invariant under translation: slide both points by the same amount in any direction and the distance is unchanged. It is also invariant under rotation about any centre, which is not obvious from the algebra but is the reason this particular expression, rather than any other combination of the coordinates, is the right notion of distance in the plane.
Reading the exact radical form
When both coordinates are whole numbers, the sum of squares is a whole number and the distance is the square root of an integer. Most of the time that root is irrational, and the honest answer is a surd rather than a decimal. The calculator simplifies it for you by pulling out the largest perfect square: √52 becomes 2√13, because 52 = 4 × 13.
Keeping the exact form matters when the distance feeds another calculation. Squaring 2√13 returns 52 exactly; squaring the rounded 7.211 returns 52.0 only to three figures. In a chain of steps that error compounds, which is why examination answers and geometric proofs stay in radical form until the very end.
Occasionally the root comes out whole. That happens exactly when Δx and Δy form a Pythagorean triple, and the small ones are worth recognising on sight: 3-4-5, 5-12-13, 8-15-17, 7-24-25 and 20-21-29, along with every multiple of each. Spotting 6 and 8 as a doubled 3-4-5 tells you the distance is 10 before you touch a calculator.
Worked example: the distance from (−2, 3) to (4, −1)
Take the two default points and work through them by hand.
- Find Δx. x₂ − x₁ = 4 − (−2) = 6. Subtracting a negative adds, which is the step most often fumbled.
- Find Δy. y₂ − y₁ = −1 − 3 = −4.
- Square both. 6² = 36 and (−4)² = 16. The sign vanishes here.
- Add. 36 + 16 = 52.
- Take the square root. d = √52 = 7.211102551.
- Simplify the surd. 52 = 4 × 13, and √4 = 2, so the exact distance is 2√13.
Two extras fall out of the same numbers. The slope of the segment is Δy ÷ Δx = −4 ÷ 6 = −2/3, so the line falls two units for every three you move right. The taxicab distance, if you could only travel along grid lines, is |6| + |−4| = 10 — about 39% further than the straight line, which is what a street grid costs you.
Check the answer for plausibility. The larger leg is 6, so the hypotenuse must exceed 6; the sum of the legs is 10, so it must be under 10. A result of 7.21 sits sensibly between them.
Euclidean distance versus taxicab distance
The straight-line figure is the right one whenever travel is unconstrained: a radio link, a rifle shot, a drone flight, the separation of two data points. The taxicab figure is the right one whenever movement is confined to axis-aligned paths: streets on a grid, warehouse aisles, the moves of a rook, or an integer lattice.
The two are equal only when the segment is exactly horizontal, exactly vertical, or of zero length, and the straight-line distance is never the larger of the two — that is the triangle inequality. The gap is widest along a 45-degree diagonal: for Δx = Δy = 1, the straight line is √2 = 1.414 while the taxicab route is 2, so the grid costs you 41.4%. For the example above, with Δx = 6 and Δy = −4, the straight line is 7.211 and the grid route is 10, a 38.7% penalty.
Neither figure is a travel distance on the Earth's surface. Latitude and longitude are angles on a sphere, not Cartesian coordinates, and a degree of longitude shrinks with the cosine of the latitude. Applying this formula to raw latitude and longitude will be wrong by a factor that grows as you move away from the equator; use a great-circle formula instead.
Common coordinate differences and their exact distances
| Δx | Δy | Δx² + Δy² | Exact distance | Decimal |
|---|---|---|---|---|
| 1 | 1 | 2 | √2 | 1.414214 |
| 1 | 2 | 5 | √5 | 2.236068 |
| 2 | 2 | 8 | 2√2 | 2.828427 |
| 3 | 4 | 25 | 5 | 5.000000 |
| 4 | 6 | 52 | 2√13 | 7.211103 |
| 5 | 12 | 169 | 13 | 13.000000 |
| 6 | 8 | 100 | 10 | 10.000000 |
| 7 | 24 | 625 | 25 | 25.000000 |
| 8 | 15 | 289 | 17 | 17.000000 |
| 9 | 9 | 162 | 9√2 | 12.727922 |
| 20 | 21 | 841 | 29 | 29.000000 |
Any multiple of a triple is another triple: 6-8-10 is the 3-4-5 doubled, and 9-12-15 is it tripled.
Mistakes that produce the wrong distance
- Dropping a double negative. 4 − (−2) is 6, not 2. This single slip accounts for most wrong answers on negative coordinates.
- Adding before squaring. (Δx + Δy)² is not Δx² + Δy². Square each difference first, then add.
- Forgetting the square root. The formula returns d² until you take the root. Leaving it off gives 52 where the answer is 7.211.
- Using latitude and longitude directly. Degrees on a sphere are not Cartesian coordinates; a degree of longitude is about 69 miles at the equator and zero at the pole.
- Reporting a rounded decimal where an exact surd was asked for. 2√13 is exact; 7.21 is not, and squaring it will not return 52.
Key terms
- Euclidean distance
- The ordinary straight-line distance, √(Δx² + Δy²). It is the shortest possible path between two points in the plane.
- Taxicab distance
- Also called Manhattan or L1 distance: |Δx| + |Δy|. It is the shortest path when travel is restricted to axis-aligned moves.
- Pythagorean triple
- Three whole numbers a, b, c with a² + b² = c², such as 3-4-5 or 5-12-13. Coordinate differences forming a triple give a whole-number distance.
Where the distance formula leads next
Extending to three dimensions costs one extra term: d = √(Δx² + Δy² + Δz²), which the 3D distance calculator handles. The same pattern continues into any number of dimensions, and that generalisation is the basis of nearest-neighbour search and clustering in machine learning.
The formula is also the engine behind the equation of a circle. Saying that a point sits a fixed distance r from a centre (h, k) is exactly (x − h)² + (y − k)² = r², which is the distance formula with both sides squared. Every circle equation you meet is this one in disguise.
For the other properties of the same segment, the sibling tools do the work: the midpoint calculator finds its centre, the slope calculator gives its steepness and angle, and the line equation calculator turns the two points into y = mx + b. When you need the perpendicular gap from a point to a line rather than to another point, use the point-to-line distance calculator.
