Try it with your numbers
Show every step
Sketching the two points first, even roughly, on a grid like the one in plotting points on the coordinate plane takes ten seconds and catches most arithmetic slips. The solver above shows every step for your own numbers, and the practice quiz further down moves from easy to hard. For the full lesson behind the formula, see the distance formula page.
Where the distance formula comes from
Put two points on a grid and draw a horizontal line from one and a vertical line from the other until they meet. That makes a right triangle whose legs are and , and the segment you want is the hypotenuse. The Pythagorean theorem says , so
and taking the square root gives the formula. Nothing needs memorizing beyond that picture.
The squares explain two features that confuse people. The order of the points does not matter, because . The absolute value bars from the leg lengths also vanish, because squaring already makes every gap positive.
The triangle also explains the special cases. If the points share an x-value, the horizontal leg is 0 and the distance is just , which is why horizontal and vertical lines need no formula at all.
Quick check
Answer:
How to use the distance formula step by step
Take and .
- Label the points: and .
- Subtract in matching order: and .
- Square each gap and add: .
- Take the root: .
Since 113 has no square factor, is already the exact answer. Give the decimal only when the problem asks for rounding.
The step that costs the most points is step 3. The square of is , never , and the whole gap is squared, not just the number. Treat the parentheses and exponents the way order of operations demands: finish the subtraction inside, then square.
Every x-value pairs with an x-value and every y-value with a y-value. Subtracting is the most common way to get a wrong answer from correct-looking steps.
Distance formula with negative numbers and fractions
Subtracting a negative is addition, so becomes . A reliable habit is to write the subtraction with parentheses around the second value before simplifying. That one habit removes almost every sign error.
Fractions follow the same pattern. Find the distance between and :
When the denominators differ, scale first. For and , multiply every coordinate by 6 to get and . The gaps are 8 and 6, so the scaled distance is 10. Divide by 6 to undo the scaling: . Direct check: .
Try this: Find the distance between and twice, once with each point listed first. Both runs should give 5, and the gaps should be the first time and the second.
How to check a distance formula answer

Let and . The distance must satisfy
because the hypotenuse is longer than either leg but shorter than the two legs laid end to end. For the earlier example, and , so must fall between 8 and 15. The answer 10.63 passes. An answer of 3, or 15.5, would fail instantly.
A tighter lower bound is , which is about . It is reached only when . Here it gives about 10.6, almost exactly the true value, so this is a very fast mental estimate.
This also exposes the classic wrong move: . With legs 3 and 4, the real distance is 5, not 7.
| Legs | Distance |
|---|---|
Recognizing these triples, or their multiples, lets you finish many problems without a calculator. When the result is not a perfect square, pull out the largest square factor: for and , .
Quick check
Answer:
Distance formula problems with a missing coordinate

Suppose and are 5 units apart. Substitute, then square both sides before doing anything else:
So or . Both are correct, because the points 5 units from form a circle, and the line cuts that circle twice. Dropping the is the usual way to lose half the credit. If the unknown appears in a way that expands into that will not factor, the quadratic formula finishes the job.
A related type asks for a point equidistant from two others. Find the point on the x-axis that is equally far from and :
The terms cancel, so the equation is linear. Check: both distances squared equal 58. The reason it works is geometric: points equally far from two locations lie on the perpendicular bisector of the segment between them. That line passes through the midpoint and, using perpendicular slopes, has slope , giving . At , , matching.
Can the distance formula prove a right triangle?
Yes, and it is a standard test question. Take , and . Work with squared distances so no radicals appear:
Since , the converse of the Pythagorean theorem gives a right angle at . Because , the triangle is also isosceles. One distance formula pass proved both facts.
The same approach checks whether three points lie on one line. For , and , the pieces are and , and the full length is . The pieces add up exactly to the whole, so the points are collinear. If the sum is strictly larger than the whole, the points form a genuine triangle.
Testing with values avoids rounding. Rounded decimals such as versus can fail a test that exact values would pass.
Distance formula in 3D and from a point to a line
Add a third coordinate and apply Pythagoras twice: once across the floor, once up the height. The result is
For and the gaps are 3, 4 and 12, so .
Distance from a point to a line is a different problem. The nearest spot on a line is where a perpendicular lands, so measuring to a random point on the line overshoots. For a line in the form (rearranged from standard form) and a point :
Find the distance from to . The numerator is and the denominator is , so . The formula needs the line moved fully to one side, with a zero on the other. Forgetting that is the usual error.
Quick check
Answer:
Real-world distance formula problems and their limits
Coordinates plus a scale turn the formula into a measuring tool. On a city map where each grid unit is 0.1 mile, a school at and a park at have gaps of 12 and 5, so the straight-line distance is units, or 1.3 miles. Walking along streets means going 12 blocks east and 5 north, which is 17 units, or 1.7 miles. Both are valid distances for different questions.
The formula also powers the equation of a circle: every point at distance from the center satisfies . Game developers use it for hit detection, and data analysts use the same idea (called Euclidean distance) to measure how similar two data points are.
Its limit is flatness. The formula assumes a flat plane, which is fine for a classroom, a floor plan or a few city blocks. Across large areas of Earth, latitude and longitude lines do not form a square grid, since a degree of longitude shrinks as you move toward the poles. Long trips need great-circle distance instead.
Distance formula vs midpoint formula vs slope formula
All three formulas start from the same two differences, and , which is why students mix them up. What differs is the operation and the type of answer:
- Distance squares the gaps, adds, and roots. It returns one non-negative length.
- The midpoint averages the coordinates and returns a point, such as .
- Slope divides the vertical gap by the horizontal gap. It returns a ratio that can be negative or undefined.
For and , the distance is , the midpoint is , and the slope is . A quick sanity test: if your “distance” came out negative or as a pair of numbers, you used another formula.
To practice the neighbors, work through the midpoint formula practice problems and review the slope formula. Once you have a slope and two points, the equation of a line through two points is the natural next step.
Practice problems
0 of 10 solved
- Find the distance between and .
Answer:
The differences are and . Then . - Find the distance between and .
Answer:
Both points have , so the segment is horizontal. . - Find the distance between and .
Answer:
and . Then . - Find the distance between and . Round to the nearest hundredth.
Answer:
and . Then . - Find the distance between and . Round to the nearest hundredth.
Answer:
and . Then . - Find the distance between and . Round to the nearest hundredth.
Answer:
and . Then . - On a map, 1 unit is 0.25 mile. Town A is at and Town B is at . How many miles apart are they in a straight line?
Answer: 2.5 miles
The differences are and . Then units. Multiply by the scale: miles. - Find the perimeter of the triangle with vertices , and .
Answer:
(same -value). . . The perimeter is . - Find if the distance between and is .
Answer:
Square the distance: , so . Then , so or . - Find the point on the -axis that is the same distance from and .
Answer:
Let the point be . Set squared distances equal: . This simplifies to , so and .
Common questions
What is the distance formula?
The distance between and is . It is the Pythagorean theorem applied to the horizontal and vertical gaps between two points.
Does it matter which point is first in the distance formula?
No. Swapping the points flips the sign of each difference, and squaring removes that sign. You only need to keep the x-values together and the y-values together, in the same order.
Can a distance be negative?
No. The square root in the formula gives the positive root, and the radicand is a sum of squares, so . It equals 0 only when the two points are the same.
How do you find the distance from the origin to a point?
Use , since the origin's coordinates are both 0. For example, the point is units from the origin.
How do you find a missing coordinate when the distance is given?
Substitute everything into the formula, square both sides to remove the root, and solve the resulting equation. Expect two answers when the unknown is squared, because the points lie on a circle.
Is the distance formula the same as the Pythagorean theorem?
It is the same idea in coordinate form. The differences and are the legs of a right triangle, and is the hypotenuse.