Skip to content
Math & Statistics

The Distance Formula Explained (With Examples)

The distance formula finds the straight-line distance between two points. Learn where it comes from, how to use it step by step and the 3D version.

Umar Umar Content Writer Published 3 min read
The Distance Formula Explained (With Examples) – Tuff Search guide
Share
In this guide
  1. The formula
  2. Step-by-step example
  3. Why it works
  4. Related formulas
  5. Distance in three dimensions
  6. Where it is used
  7. Common mistakes
  8. Using distance to classify shapes
  9. Distance on a map vs on a road
  10. Practice questions
  11. Frequently asked questions
  12. Related calculators
  13. Related articles
  14. Sources

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

  1. Points (1, 2) and (4, 6).
  2. Δx = 4 − 1 = 3; Δy = 6 − 2 = 4.
  3. 3² + 4² = 9 + 16 = 25.
  4. √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.

Distance formula examples: (1, 2) – (4, 6) – 3, 4 – 5; (0, 0) – (5, 12) – 5, 12 – 13; (−3, 7) – (5, −1) – 8, −8 – 11.31
Distance formula examples
Try it with your numbersSlope CalculatorFind the slope of a line from two points, plus the equation in slope-intercept form, angle, percent grade and…Open calculator

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².

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

  1. (2, −1) and (8, 7): Δx = 6, Δy = 8, d = 10.
  2. (−4, −4) and (1, 8): Δx = 5, Δy = 12, d = 13.
  3. (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.

Sources

Estimates, not adviceResults are estimates for information only, not tax, financial, medical or legal advice. Confirm important figures with a qualified professional. See our Disclaimer.

Share this guide

Related calculators

Umar

About the author

Umar

Content Writer · Tuff Search

Umar writes the guides on the Tuff Search blog. He explains how each calculation works in plain English, with worked examples, and checks every figure against official sources.

Keep reading

More math & statistics guides

View all guides