The distance formula
The Pythagorean theorem on a grid.
To find the distance between two points, draw a right triangle: the legs are the difference in x and the difference in y. Then use the Pythagorean theorem: d = √((x₂ − x₁)² + (y₂ − y₁)²).
Example: (1, 2) and (4, 6)
- run = 4 − 1 = 3, rise = 6 − 2 = 4 — The legs of the triangle
- d² = 3² + 4² = 25 — Pythagorean theorem
- d = 5 — Square root
Why it works: Any two points make the corners of a right triangle with horizontal and vertical legs. The distance is the hypotenuse, so it is the Pythagorean theorem.
Tip: It doesn’t matter which point you call first: the differences are squared, so the signs disappear.