The distance formula gives the straight-line distance between two points on a graph. It looks new, but it is the Pythagorean theorem in disguise: the horizontal and vertical gaps between the points are the two legs of a right triangle.
The formula
d = √((x₂ − x₁)² + (y₂ − y₁)²). Subtract the x-values, subtract the y-values, square both, add, and take the square root.
Step-by-step example
- Points (1, 2) and (4, 6).
- Δx = 4 − 1 = 3; Δy = 6 − 2 = 4.
- 3² + 4² = 9 + 16 = 25.
- √25 = 5.
With negatives: (−3, 7) and (5, −1). Δx = 8, Δy = −8. 64 + 64 = 128, so d = √128 ≈ 11.31. Squaring removes the signs, so the order of the points does not matter.

Why it works
Draw a horizontal line from one point and a vertical line from the other until they meet. You get a right triangle with legs |Δx| and |Δy|. The distance between the points is the hypotenuse, so the Pythagorean theorem gives d² = Δx² + Δy².
Related formulas
| Formula | What it finds |
|---|---|
| d = √(Δx² + Δy²) | Distance between two points |
| ((x₁ + x₂)/2, (y₁ + y₂)/2) | Midpoint |
| Δy ÷ Δx | Slope |
| d = √(Δx² + Δy² + Δz²) | Distance in 3D |
The same two points give you distance, midpoint and slope – together they describe the line segment completely.
Distance in three dimensions
Add the third gap: from (1, 2, 3) to (4, 6, 15) the gaps are 3, 4 and 12, so d = √(9 + 16 + 144) = √169 = 13.
Where it is used
- Maps and games: straight-line (‘as the crow flies’) distance between grid points.
- Geometry: side lengths of shapes drawn on a grid, and checking whether a triangle is isosceles.
- Circles: every point (x, y) on a circle with centre (h, k) and radius r satisfies (x − h)² + (y − k)² = r².
Common mistakes
- Forgetting to square before adding.
- Adding the gaps and then squaring.
- Forgetting the final square root.
- Mixing up x and y values from different points.
Using distance to classify shapes
Is the triangle with corners A(0, 0), B(4, 0) and C(2, 5) isosceles? AB = 4. AC = √(4 + 25) = √29 ≈ 5.39. BC = √(4 + 25) = √29. Two equal sides, so yes. The same check tells you whether four points form a square (four equal sides and two equal diagonals) or a rhombus (four equal sides only).
Distance on a map vs on a road
The formula measures straight-line distance. Travel distance along streets is usually longer; in a grid of city blocks, ‘taxicab distance’ |Δx| + |Δy| is closer to what you would walk. For long distances on Earth, latitude and longitude need the great-circle (haversine) formula because the surface is curved.
Practice questions
- (2, −1) and (8, 7): Δx = 6, Δy = 8, d = 10.
- (−4, −4) and (1, 8): Δx = 5, Δy = 12, d = 13.
- (0, 0) and (1, 1): d = √2 ≈ 1.41.
Frequently asked questions
d = √((x₂ − x₁)² + (y₂ − y₁)²).
Yes, applied to coordinates.
No; distances are always zero or positive.
No, because the differences are squared.
Add the squared z-difference under the square root.

