What is the distance formula?
The distance formula gives the length of the straight line between two points (x₁, y₁) and (x₂, y₂): d = √((x₂ − x₁)² + (y₂ − y₁)²). It comes from the Pythagorean theorem: the change in x and the change in y are the two shorter sides of a right triangle, and the distance is its longest side.
It doesn’t matter which point you call the first: the differences are squared, so the answer is the same both ways. The answer is in whatever unit the coordinates use.
Source OpenStax · College Algebra 2e, 2.1 The Rectangular Coordinate Systems and Graphs ↗
How to find the distance between two points
Here it is with your numbers:
- d = √((2 − (−3))² + (3 − (−1))²)
- d = √(5² + 4²)
- d = √(25 + 16)
- d = √41
- d = 6.4031
It means a straight line from (−3, −1) to (2, 3) is 6.4031 units long, measured in the same units as the coordinates.
Take the second point’s x away from the first point’s x, and the same for y, square both, add them, then take the square root. When the number under the root isn’t a perfect square, the exact answer stays a square root, simplified where it can be: √50 is 5√2.
Distance between two points in 3D
In space each point has a third coordinate, z, and the formula gains one more square: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (3, −1, 5) to (2, 1, −1) is √(1 + 4 + 36), which is √41, or 6.4031. Choose “In space (3D)” above to add the z boxes.
Source OpenStax · Calculus Volume 3, 2.2 Vectors in Three Dimensions ↗
Distance examples
Tap a row to try it.
| From | To | Exactly | Distance |
|---|---|---|---|
| (0, 0) | (3, 4) | 5 | 5 |
| (−3, −1) | (2, 3) | √41 | 6.4031 |
| (0, 0) | (8, 7) | √113 | 10.6301 |
| (1, 2) | (7, 10) | 10 | 10 |
| (3, −1, 5) | (2, 1, −1) | √41 | 6.4031 |
| (1, −5, 4) | (4, −1, −1) | 5√2 | 7.0711 |
A walk of 8 blocks east and 7 blocks north is 15 blocks on the streets, but only √113, or 10.6301 blocks, in a straight line.
FAQs
How do you calculate distance?
Between two points on a graph, use the distance formula, d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, −1) to (2, 3) the changes are 5 and 4, so d = √(25 + 16), which is √41, or 6.4031.
Source OpenStax · College Algebra 2e, 2.1 The Rectangular Coordinate Systems and Graphs ↗
Why does the distance formula work?
It is the Pythagorean theorem, a² + b² = c². The change in x and the change in y are the two shorter sides of a right triangle, and the distance between the points is its longest side.
Sources
- OpenStax: College Algebra 2e, 2.1 The Rectangular Coordinate Systems and Graphs
- OpenStax: Calculus Volume 3, 2.2 Vectors in Three Dimensions