Key Points
- Formula: , the length of the segment joining the points.
- Square each gap, add, then take the square root, in that order.
- In 3D, add a third squared gap: .
- Both axes must measure the same thing in the same unit.
How Does a Map App Know How Far Apart Two Pins Are?
A map app knows how far apart two pins are before it plans a single turn of the route. Behind the pins is a coordinate grid and one calculation, the distance formula, that turns two pairs of numbers into an "as the crow flies" distance.
- Take and . Counting squares gives 4 across and 3 up.
- But the straight path runs diagonally, and diagonals cannot be counted square by square.
- The 4 and 3 are the short sides of a right triangle; the straight line from to is the long side.
- The Pythagorean theorem gives : the distance between two points is Pythagoras on a grid.

What Is the Distance Formula?
The distance between two points is the length of the straight segment joining them, and the distance formula works it out from their coordinates. For and :
- is the run (how far across) and is the rise (how far up).
- Subtract, square each gap, add, then take the positive square root; is never negative.
For the running pair, , in the same unit as the axes.
How Is the Distance Formula Derived?
The formula falls straight out of a right triangle.
The right triangle
- From , move straight across to the corner , then straight up to .
- The moves meet at a right angle, so is a right triangle with hypotenuse .
- Its legs are and . Pythagoras gives:
- Take the positive root, since a length cannot be negative.
The squares on the sides
- Pythagoras is about areas. Build a square on each side of the triangle.
- The run's square is units, the rise's is , and the tilted square on covers .
- So . Euclid proved this as Book I, Proposition 47 of the Elements.

Why the order of the points never matters
Swapping the points flips each gap's sign, but a number and its negative have the same square.
So the distance from to equals the distance from to .
Drag and : the run, rise and distance update live.
Press "Show me: squares on the sides" to see the 16, 9 and 25 squares.
Try "Horizontal" and "Vertical": one gap becomes 0.
Try It Yourself
In the tool above:
How Do You Extend It to Three Dimensions?
A point in 3D has three coordinates, so the formula grows by one squared term. Use Pythagoras twice: across the floor, then up the height.
- Each axis of the Cartesian coordinate system is at right angles to the others, so each adds its own squared gap.
- The pattern continues for any number of coordinates, which data scientists call Euclidean distance.
Edge Cases Worth Knowing
The formula works for every pair of points, and a few cases need almost no working.
- Same (horizontal segment): . From to , .
- Same (vertical segment): .
- The same point twice: , the only way to get 0.
- From the origin: .
- Axes in different units: on a graph of kilometres against hours, the formula mixes units and means nothing.
Connections: Circles and Collinear Points
The distance formula holds up other topics.
- A circle is every point at distance from a centre . Square the distance formula to get the equation of a circle: .
- Every point on is 5 from the origin, such as and .

- Three points are collinear exactly when the two shorter distances add up to the longest.
- For example, , , give : collinear.
- Otherwise they form a triangle, and the longest side is shorter than the other two together: the triangle inequality.
Examples of Distance Between Two Points
The examples move from negatives to 3D, shape questions and a word problem.
Example 1
Find the distance between (−3, 5) and (2, 5).
- A quick attempt, , gives . But the points sit 3 left and 2 right of the -axis, so they are 5 apart.
- Done carefully: and .
- .
The distance is 5 units, the horizontal gap.
Example 2
Find the distance between (−2, −1) and (3, 4).
- and .
- .
The distance is , about 7.07 units.

Example 3
A point (x, 0) on the x-axis is 10 units from (6, 8). Find x.
- Square both sides: .
- So and .
So or : a circle of radius 10 around crosses the -axis twice.

Example 4
Find the distance between the points (1, 2, 3) and (3, 5, 9) in space.
- The gaps are 2, 3 and 6.
- , the long diagonal of a box.
The distance is 7 units.

Example 5
What kind of triangle has corners (1, 1), (4, 5) and (8, 2)?
- The sides are , and .
- Two sides are equal, and , so the converse of Pythagoras gives a right angle.
It is a right-angled isosceles triangle.
Example 6
Two drones sit at grid positions (2, 3) and (14, 8), where each grid unit is 100 m. How far apart are they in metres?
- In grid units: .
- Convert: m.
The drones are 1300 m apart.
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
Where it slips in: Any negative coordinate, especially when it is subtracted.
Don't do this: Write , as in the first attempt in Example 1.
The correct way: Put negatives in brackets: .
Mistake 2: Adding the gaps instead of their squares
Where it slips in: Recalling the formula as "the square root of the differences".
Don't do this: Write , or , for the running pair.
The correct way: Square first, then add: . A square root does not split over addition, and adding the gaps gives the longer walk along grid lines.
Mistake 3: Stopping before the square root
Where it slips in: The last line, once the sum looks finished.
Don't do this: Report for the running pair.
The correct way: 25 is , an area, so . The distance can never beat the run plus the rise, and 25 is far bigger than .
Why Does the Distance Formula Matter?
"Off by a unit, off by a spacecraft."
Wherever positions are stored as numbers, this formula turns them into "how far".
- Maps. "As the crow flies" distances on a local map use it; over very long distances the Earth's curve needs another formula.
- Games. Two round objects touch when their centres are at most the sum of their radii apart.
- Robotics. A robot checks a target is within reach by comparing a distance with its arm's length.

Units matter at full scale. NASA lost the Mars Climate Orbiter in 1999 because ground software used English units and the spacecraft used metric; the probe passed too close to Mars and burned up.
Conclusion
- The distance between two points is Pythagoras on the run and the rise: .
- Use brackets for negatives, square before adding, and finish with the square root.
- One extra term gives 3D, and the formula sits inside every circle's equation.
- Both axes must use the same unit, or the "distance" means nothing.
Read More
- Distance Formula
- Midpoint Formula
- Section Formula
- Area of a Triangle in Coordinate Geometry
- Distance of a Point From a Line
- Euclidean Distance Formula
Research Behind This Article
- Euclid, Elements, Book I, Proposition 47 (the Pythagorean theorem), with commentary by D. E. Joyce, Clark University. mathcs.clarku.edu
- OpenStax, Intermediate Algebra 2e, Section 11.1: Distance and Midpoint Formulas; Circles. openstax.org
- OpenStax, Calculus Volume 3, Section 2.2: Vectors in Three Dimensions (the distance between two points in space). openstax.org
- NASA Science, Mars Climate Orbiter (mission loss in 1999 from English units not translated to metric). science.nasa.gov
Quick Quiz: Check Yourself
Three levels, questions with figures, instant feedback with the reason.
Was this article helpful?
Your feedback helps us write better content
Frequently Asked Questions
What is the formula for the distance between two points?
Can the distance between two points be negative?
Is the distance formula the shortest distance between two points?
