Distance Between Two Points Formula Solver with Worked Examples
The distance between (x1,y1) and (x2,y2) is d=(x2−x1)2+(y2−y1)2. Use the calculator to find the distance, or a missing coordinate.
Give every value except the one you want, or write the letter with a question mark, for example x1=1, y1=2, x2=4, y2=6 or x1=0, y1=0, x2=5, y2=12. Every answer is checked by putting it back into the formula.
d=(<x2>−<x1>)2+(<y2>−<y1>)2
d: distance between the points
x1: x-coordinate of the first point
y1: y-coordinate of the first point
x2: x-coordinate of the second point
y2: y-coordinate of the second point
Before you start
This page is easier if you are comfortable with:
coordinates on a grid
Pythagoras’ theorem
subtracting negative numbers
What Distance between two points means
Draw a right-angled triangle whose hypotenuse is the line joining the two points. The horizontal side has length x2−x1 and the vertical side has length y2−y1.
Pythagoras gives the distance. The order of subtraction does not matter because the differences are squared.
The distance between (x₁, y₁) and (x₂, y₂) is √((x₂ − x₁)² + (y₂ − y₁)²). It is Pythagoras’ theorem on a coordinate grid.
Finding the length of a line segment between two points.
Finding the radius of a circle from its centre and a point on it.
Checking whether a triangle on a grid is isosceles or right-angled.
How to use the distance between two points formula
Find the difference in x and the difference in y.
Square both differences and add them.
Take the square root.
Leave the answer as a surd or round it.
Graph
The horizontal step is 3 and the vertical step is 4, so the distance is √(3² + 4²) = 5.
Worked examples
Each example below was worked out by the solver on this page and checked by substituting the answer back into the formula.
Example 1: a whole-number distance
Find the distance between (1,2) and (4,6).
Distance between two pointsAnswer checked
Answer
d=5
The formula
Distance between two points. In this formula d is the distance between the points, x1 is the x-coordinate of the first point, y1 is the y-coordinate of the first point, x2 is the x-coordinate of the second point, y2 is the y-coordinate of the second point.
d=(x2−x1)2+(y2−y1)2
What we know and what we want
We know x1=1,y1=2,x2=4,y2=6 and we want to find d, the distance between the points.
Substitute the numbers
d=(4−1)2+(6−2)2
Calculate
d=5
Check by substituting back
Put all the values back into the original formula: both sides should match.
5=(4−1)2+(6−2)2✓
Example 2: from the origin
Find the distance from the origin to (5,12).
Distance between two pointsAnswer checked
Answer
d=13
The formula
Distance between two points. In this formula d is the distance between the points, x1 is the x-coordinate of the first point, y1 is the y-coordinate of the first point, x2 is the x-coordinate of the second point, y2 is the y-coordinate of the second point.
d=(x2−x1)2+(y2−y1)2
What we know and what we want
We know x1=0,y1=0,x2=5,y2=12 and we want to find d, the distance between the points.
Substitute the numbers
d=(5−0)2+(12−0)2
Calculate
d=13
Check by substituting back
Put all the values back into the original formula: both sides should match.
13=(5−0)2+(12−0)2✓
Example 3: a missing coordinate
The distance between (1,2) and (x,8) is 10, with x>1. Find x.
Distance between two pointsAnswer checked
Answer
x2=9
The formula
Distance between two points. In this formula d is the distance between the points, x1 is the x-coordinate of the first point, y1 is the y-coordinate of the first point, x2 is the x-coordinate of the second point, y2 is the y-coordinate of the second point.
d=(x2−x1)2+(y2−y1)2
What we know and what we want
We know d=10,x1=1,y1=2,y2=8 and we want to find x2, the x-coordinate of the second point.
Rearrange for x2
Square both sides, subtract (y₂ − y₁)², take the square root, then add x₁ (taking the point to the right of the first).
x2=x1+d2−(y2−y1)2
Substitute the numbers
x2=1+102−(8−2)2
Calculate
x2=9
Check by substituting back
Put all the values back into the original formula: both sides should match.
10=(9−1)2+(8−2)2✓
Special cases
A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.
A 3-4-5 distance
(1, 2) to (4, 6): d = √(9 + 16) = 5
The horizontal gap is 3 and the vertical gap is 4.
From the origin
(0, 0) to (5, 12): d = 13
Use the coordinates directly.
A missing coordinate
d = 10, (1, 2) and (x, 8): (x − 1)² = 64, so x = 9
Rearrange and take the root.
Negative coordinates
(−2, 1) to (3, −4): d = √(25 + 25) ≈ 7.07
Subtract carefully: 3 − (−2) = 5.
Word problems
Find the horizontal and vertical differences, square them, add and take the square root.
Two points
Find the distance between (1, 2) and (4, 6).
Differencesx: 4 − 1 = 3 and y: 6 − 2 = 4
Pythagorasd² = 9 + 16 = 25
Rootd = 5
Check: a 3-4-5 triangle ✓The distance is 5.
From the origin
Find the distance from (0, 0) to (5, 12).
Square and addd² = 25 + 144 = 169
Rootd = 13
Check: 5-12-13 triple ✓The distance is 13.
Negative coordinates Higher
Find the distance between (−2, 1) and (3, −4) to 2 decimal places.
Differencesx: 3 − (−2) = 5 and y: −4 − 1 = −5
Pythagorasd² = 25 + 25 = 50
Rootd = 7.07
Check: 5√2 = 7.07 ✓The distance is 7.07.
A missing coordinate Higher
The points (1, 2) and (x, 8) are 10 apart. Find x, given x > 1.
Vertical gap8 − 2 = 6
Horizontal gap(x − 1)² = 100 − 36 = 64, so x − 1 = 8
Solvex = 9
Check: √(64 + 36) = 10 ✓x = 9.
Common mistakes
Adding the differences
3 + 4 = 7 ✗
√(9 + 16) = 5 ✓
Square, add, root.
Subtracting a negative wrongly
3 − (−2) = 1 ✗
3 − (−2) = 5 ✓
Minus a negative is plus.
Forgetting the root
d = 25 ✗
d = 5 ✓
Take the root.
Mixing x and y
(4 − 1)² + (4 − 2)² ✗
(x2 − x1)² + (y2 − y1)² ✓
Keep x with x and y with y.
Squaring a negative incorrectly
(−5)² = −25 ✗
(−5)² = 25 ✓
A square is positive.
Exam tips
Find Δx and Δy.
Square both, add.
Root last.
Mind negatives.
Sketch the points.
Practice questions
Try each one on paper, then open the answer. Use the solver above to see the full working.
1. Find the distance between (1, 2) and (4, 6) Foundation
√(9 + 16) = 5
2. Find the distance from the origin to (5, 12) Foundation
√(25 + 144) = 13
3. Find the distance between (0, 0) and (3, 3) to 2 decimal places Foundation
√18 = 4.24
4. Find the distance between (−2, 1) and (4, 9) Higher
√(36 + 64) = 10
5. Find the distance between (−3, −2) and (2, 4) to 2 decimal places Higher
√(25 + 36) = 7.81
6. The distance between (1, 2) and (x, 8) is 10 with x > 1. Find x Higher
x = 1 + √(100 − 36) = 9
Practice generator
Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.
Solve: …
Key terms
Coordinates
A pair (x, y) giving a position.
Distance
The straight-line length between two points.
Difference
The change in x or y.
Pythagoras
The basis of the formula.
Origin
The point (0, 0).
Midpoint
The point halfway between.
Frequently asked questions
What is the distance formula?
d = √((x₂ − x₁)² + (y₂ − y₁)²).
Why does it work?
It is Pythagoras on the right-angled triangle with the two points as the hypotenuse ends.