Distance Formula
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
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
The horizontal and vertical differences between them form two legs of a right triangle, with the segment connecting the points as the hypotenuse.
The hypotenuse squared equals the sum of the legs squared.
d² = (x₂ - x₁)² + (y₂ - y₁)²Solve for the distance itself.
d = √((x₂ - x₁)² + (y₂ - y₁)²)Step-by-Step Example
Problem: Find the distance between points (1, 2) and (4, 6).
Assign each point's x and y values.
x₁=1, y₁=2, x₂=4, y₂=6Subtract the x-values and the y-values.
(x₂-x₁) = 3, (y₂-y₁) = 4Square both results.
3² = 9, 4² = 16Sum the squares, then take the square root.
d = √(9 + 16) = √25Interactive Calculator
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
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.
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.
Related Formulas
Pythagorean Theorem
Relates the three sides of a right triangle, letting you find any one side from the other two.
Learn more →Midpoint Formula
Finds the exact point halfway between two coordinates by averaging their x- and y-values.
Learn more →Slope-Intercept Form
The most common way to write the equation of a straight line, revealing its slope and y-intercept directly.
Learn more →