What Is the Distance Formula?
The distance formula is the rule that converts two coordinate pairs into the length of the segment between them. Read it left to right: subtract the x-coordinates, subtract the y-coordinates, square each difference, add the squares, and take the positive square root.
Here is the variable key, because a formula you cannot decode is a formula you cannot trust:
Symbol | Meaning | Notes |
|---|---|---|
$x_1, y_1$ | Coordinates of the first point | Any labelled starting point |
$x_2, y_2$ | Coordinates of the second point | The other endpoint |
$x_2 - x_1$ | Horizontal gap (run) | Sign does not matter after squaring |
$y_2 - y_1$ | Vertical gap (rise) | Sign does not matter after squaring |
$d$ | Distance between the points | Always zero or positive |
Does it matter which point you call the first one? No. Swapping the points flips the sign of each difference, but squaring erases the sign, so $(x_2-x_1)^2 = (x_1-x_2)^2$. You get the same distance either way, which fits the plain fact that the gap from A to B equals the gap from B to A.
How Does a Map App Know How Far Apart Two Pins Are?
Every ride-share app finds the straight-line gap between two pins before it ever plans a route, and it does it with one formula. Behind the moving car icon is a coordinate grid and a single calculation that turns two pairs of numbers into a distance. That calculation is the distance formula, and it works for any two points you can plot.
The distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ on a coordinate plane is
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.$$
It gives the length of the straight line segment joining the two points, measured in the same units as the axes. Every symbol in it stands for a coordinate difference, and the whole thing is really the Pythagorean theorem wearing coordinate clothes.
How Is the Distance Formula Derived?
The formula is not a rule to memorise cold; it falls straight out of a right triangle. Plot the two points, then drop a horizontal line from one and a vertical line from the other so they meet at a right angle. You have built a right triangle whose hypotenuse is the segment you want to measure.
The horizontal leg has length $|x_2 - x_1|$ and the vertical leg has length $|y_2 - y_1|$. The Pythagorean theorem says the square of the hypotenuse equals the sum of the squares of the legs:
$$d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2.$$
Take the positive square root of both sides, since a distance cannot be negative:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.$$
That is the entire derivation. The distance formula and the Pythagorean theorem are the same statement; one is written in side lengths, the other in coordinates. Anchoring the two points in a clear coordinate geometry setting is what makes the right triangle appear.
How Do You Extend It to Three Dimensions?
Space has three axes, so a point in 3D carries three coordinates. The distance formula grows by exactly one term, following the same right-triangle logic applied twice:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}.$$
Why does 3D add a z-term instead of changing the whole formula? Because the depth direction is just another perpendicular leg. Each axis is at right angles to the others, so each contributes its own squared difference, and the pattern extends as far as you have dimensions. This is the same Cartesian coordinate system logic, one squared gap per axis.
Examples of Distance Between Two Points
The examples move from clean whole numbers to negatives, 3D, and a word problem. Each problem statement is bold; the steps are not.
Example 1
Find the distance between (1, 2) and (4, 6).
$$d = \sqrt{(4 - 1)^2 + (6 - 2)^2}$$
$$d = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5$$
Final answer: 5 units.
Example 2
Find the distance between (−3, 5) and (2, 5).
First instinct: reach for the full formula and grind through it. Take a moment. Both points share the same y-coordinate, 5, so they sit on a horizontal line and the vertical gap is zero. Rushing into the formula without noticing this is where errors creep in, but the formula still rescues you if you keep the signs honest:
$$d = \sqrt{(2 - (-3))^2 + (5 - 5)^2}$$
$$d = \sqrt{5^2 + 0^2} = \sqrt{25} = 5$$
Final answer: 5 units. The lesson: $2 - (-3) = 5$, not 1. A dropped negative sign is the single most common wreck in this formula.
Example 3
Find the distance between (−2, −1) and (3, 4).
$$d = \sqrt{(3 - (-2))^2 + (4 - (-1))^2}$$
$$d = \sqrt{5^2 + 5^2} = \sqrt{25 + 25} = \sqrt{50} = 5\sqrt{2}$$
Final answer: $5\sqrt{2}$ units, about 7.07 units.
Example 4
A point (x, 0) on the x-axis is 10 units from (6, 8). Find x.
Set up the formula and square both sides to clear the root:
$$10 = \sqrt{(x - 6)^2 + (0 - 8)^2}$$
$$100 = (x - 6)^2 + 64$$
$$(x - 6)^2 = 36$$
$$x - 6 = \pm 6$$
So $x = 12$ or $x = 0$.
Final answer: $x = 12$ or $x = 0$; both points on the x-axis are exactly 10 units from (6, 8).
Example 5
Find the distance between the 3D points (1, 2, 3) and (4, 6, 15).
$$d = \sqrt{(4 - 1)^2 + (6 - 2)^2 + (15 - 3)^2}$$
$$d = \sqrt{3^2 + 4^2 + 12^2} = \sqrt{9 + 16 + 144} = \sqrt{169} = 13$$
Final answer: 13 units.
Example 6
Two drones sit at grid positions (2, 3) and (14, 8), where each unit is 100 m. How far apart are they in metres?
Find the distance in grid units first:
$$d = \sqrt{(14 - 2)^2 + (8 - 3)^2} = \sqrt{12^2 + 5^2} = \sqrt{144 + 25} = \sqrt{169} = 13$$
Then convert: $13 \times 100 = 1300$ m.
Final answer: 1300 m apart.
Why Does the Distance Formula Matter?
"Off by a unit, off by a spacecraft." The distance formula matters because measuring the straight-line gap between two positions is one of the most-used operations in the technical world, and it hides inside tools people touch every day.
Navigation and mapping compute straight-line distance between coordinates before routing, the "as the crow flies" figure.
Computer graphics and games use it constantly for collision checks: two objects touch when the distance between their centres drops below a threshold.
Physics finds displacement magnitude, the straight-line distance from start to finish, with this exact expression.
Machine learning measures how similar two data points are by the distance between them in a feature space, the Euclidean distance.
The stakes of coordinate care are not hypothetical. When NASA lost the Mars Climate Orbiter in 1999, two teams fed the navigation system positions in mismatched units, the computed distances drifted, and the probe entered the atmosphere at the wrong height and was destroyed. Every distance is only as reliable as the coordinates and units behind it.
What Are the Most Common Mistakes With the Distance Formula?
Nearly every wrong answer traces back to one of three habits.
Mistake 1: Dropping a negative sign in the subtraction
Where it slips in: Any point with a negative coordinate.
Don't do this: Writing $2 - (-3) = 1$ instead of 5, then squaring the wrong number.
The correct way: Subtract carefully, letting the double negative become addition: $2 - (-3) = 5$. Because the result gets squared, a sign error here changes the whole answer, not just its sign.
Mistake 2: Forgetting to take the square root
Where it slips in: The last step, after adding the squared differences.
Don't do this: Reporting 25 as the distance when you have found $d^2 = 25$.
The correct way: Finish the job: $d = \sqrt{25} = 5$. The second-guesser who computes $d^2$ correctly, then stops one step early, is the one who loses the mark here.
Mistake 3: Adding the differences before squaring
Where it slips in: Rushing the order of operations.
Don't do this: Computing $\sqrt{(x_2 - x_1) + (y_2 - y_1)}$ or squaring the sum of the gaps.
The correct way: Square each difference first, then add: $\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$. Squaring and adding cannot be swapped, because $(a+b)^2 \neq a^2 + b^2$.
Conclusion
The distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ is $\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$.
The formula is the Pythagorean theorem applied to the right triangle formed by the coordinate differences.
In 3D it gains one term: $\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}$.
Squaring each difference removes any negative sign, so the order of subtraction does not change the answer.
The most common errors are dropped negatives, skipping the square root, and adding before squaring.
To practise the distance between two points with a teacher, explore Bhanzu's geometry tutor sessions or a focused middle school math tutor, backed by structured math tutoring. Work through the six examples above, then book a free demo class to see the right-triangle picture drawn live.
Read More
Was this article helpful?
Your feedback helps us write better content
