Algebra4 min read

Distance Formula

d = √((x₂-x₁)² + (y₂-y₁)²)

What is the Distance Formula?

The distance formula finds the straight-line distance between two points on a coordinate plane. It's derived directly from the Pythagorean theorem: the horizontal gap (x₂−x₁) and vertical gap (y₂−y₁) between the points form the two legs of a right triangle, and the distance between the points is that triangle's hypotenuse — the formula below is nothing more than a² + b² = c² rewritten with coordinates instead of triangle side lengths.

The formula extends naturally to three dimensions by adding a third squared term for the z-coordinates: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²), and the same underlying idea (sum of squared differences, then square root) generalizes further to any number of dimensions — it's the basis for the more general concept of "Euclidean distance" used well beyond geometry class, including in statistics and computer science for measuring how far apart two data points are.

One subtlety worth noticing: the result is always positive (or zero, if the two points are identical) because both differences get squared before adding, which erases whichever direction each subtraction happened to go. That's why it doesn't matter which point you label as the "first" one — the answer comes out the same either way.

What Each Variable Means

d
DistanceThe straight-line length between the two points.
x₁, y₁
First pointThe coordinates of the starting point.
x₂, y₂
Second pointThe coordinates of the ending point.

When to Use It

  • Finding the straight-line distance between two points on a map or graph
  • Verifying whether three points form a particular type of triangle by comparing side lengths
  • As a building block for circle equations and other coordinate geometry problems

Where This Formula Comes From

1
Draw the two points on a coordinate plane

The horizontal and vertical differences between them form two legs of a right triangle, with the segment connecting the points as the hypotenuse.

2
Apply the Pythagorean theorem

The hypotenuse squared equals the sum of the legs squared.

d² = (x₂ - x₁)² + (y₂ - y₁)²
3
Take the square root of both sides

Solve for the distance itself.

d = √((x₂ - x₁)² + (y₂ - y₁)²)
Advertisement

Step-by-Step Example

Problem: Find the distance between points (1, 2) and (4, 6).

1
Label the coordinates

Assign each point's x and y values.

x₁=1, y₁=2, x₂=4, y₂=6
2
Calculate the differences

Subtract the x-values and the y-values.

(x₂-x₁) = 3, (y₂-y₁) = 4
3
Square each difference

Square both results.

3² = 9, 4² = 16
4
Add and take the square root

Sum the squares, then take the square root.

d = √(9 + 16) = √25
Answer: d = 5 units

Interactive Calculator

Result will appear here

Common Mistakes

  • Mistake: Subtracting in the wrong order and losing track of which point is which.

    Fix: The subtraction order doesn't matter for the final answer (both differences get squared, so signs cancel), but stay consistent — pick one point as (x₁,y₁) and keep it that way through the whole calculation.

  • Mistake: Forgetting to square each difference before adding.

    Fix: You must square (x₂-x₁) and (y₂-y₁) individually before adding them — adding first and squaring the sum gives a different, wrong result.

Practice Questions

  1. Find the distance between (0, 0) and (6, 8).

    Hint: This is a 6-8-10 right triangle, a multiple of the 3-4-5 triangle.

  2. Find the distance between (-2, 3) and (1, -1).

Frequently Asked Questions

Does the distance formula work in 3D?

Yes — add a third squared term for the z-coordinates: d = √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²).

Why is it related to the Pythagorean theorem?

Because the horizontal and vertical gaps between two points literally form the two legs of a right triangle, with the straight-line distance as the hypotenuse.