The distance formula gives the straight-line distance between two points on a coordinate plane or in 3D space. For points and in 2D,
and for points and in 3D,
When to use this method
Use the distance formula when you want the actual length between two points, not just the horizontal or vertical change. It applies in standard Cartesian coordinates when each axis uses the same unit scale. Common cases include finding side lengths on a graph, checking whether a point lies on a circle, comparing distances from a center, and measuring straight-line separation in 3D geometry. The formula combines two perpendicular changes: how far you move in and how far you move in . Those changes form the legs of a right triangle, and the distance is the hypotenuse.
It is worth knowing why it works, because then it is not a separate rule to memorize. If
then the Pythagorean theorem gives , so . In 3D you add one more perpendicular change, , which is the same idea extended into one more dimension.
The procedure, step by step
- Write the points. Label the coordinates carefully so each axis matches the correct axis in the other point.
- Subtract corresponding coordinates. Find the change in each direction, such as and .
- Square the changes. Square each coordinate difference after subtracting, not before.
- Add and square root. Add the squared changes and take the positive square root to get the distance.
- Sense-check the result. Compare the answer with the horizontal, vertical, or spatial changes to see if the size is reasonable.
A full example from start to finish
Find the distance between and .
Start with the 2D distance formula:
Substitute the coordinates:
Simplify the differences:
Square and add:
So the exact distance is . As a decimal, . A quick check helps: the points are units apart horizontally and units apart vertically, so the straight-line distance should be more than but less than , and fits that.
The 3D version follows the same steps with one more term. Between and , the coordinate changes are , , and , so
You subtract matching coordinates, square the differences, add them, and take the positive square root.
Where students get stuck, and how to check each step
Most errors cluster around a few steps:
- Squaring before subtracting. The formula uses , not .
- Forgetting the square root. If you stop after adding the squares, you found , not .
- Mixing axes. An -coordinate must be matched with the other -coordinate, and the same goes for and .
- Losing a negative sign when substituting. For example, , not .
- Using the formula when the graph is not using standard Cartesian distance. If the axes use different scales, the geometric distance changes.
Before you trust the answer, ask two questions: did I subtract first and square second, and is the final distance a reasonable size compared with the coordinate changes? Those two checks catch most errors quickly.
Practice this procedure
Find the distance between and in 2D, running each of the five steps in order. Then compare your setup with the Midpoint Formula to see the difference between finding a length and finding a point halfway along the segment.
Frequently Asked Questions
- What is the distance formula in 2D?
- For points $(x_1, y_1)$ and $(x_2, y_2)$, the 2D distance formula is $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$.
- What changes in 3D?
- In 3D, you include the change along the $z$-axis as well, so $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}$.
- Why is the answer never negative?
- Distance is a length. After squaring the coordinate differences and adding them, you take the positive square root.
Need help with a problem?
Upload your question and get a verified, step-by-step solution in seconds.
Open GPAI Solver →