Maths
How do you find the distance between two points?
Quick answer
The distance between (x₁, y₁) and (x₂, y₂) is d = √((x₂ − x₁)² + (y₂ − y₁)²). It is Pythagoras' theorem used on a coordinate grid.
In one sentence
The distance formula tells you how far apart two points on a grid are, measured in a straight line.
Explained
Picture a map drawn on squared paper. Your home is at (1, 2) and the library is at (4, 6). To get there you could walk 3 squares across and 4 squares up, but a bird would fly straight there. How long is that straight line? The distance formula answers it.
map
ruler
pencil
Draw the across part and the up part, and you get a right-angled triangle. The straight line between the points is the longest side, the hypotenuse. So this is just Pythagoras' theorem (a² + b² = c²) in disguise. For two points (x₁, y₁) and (x₂, y₂):
d = √((x₂ − x₁)² + (y₂ − y₁)²)
For home and library: across = 4 − 1 = 3, up = 6 − 2 = 4, so d = √(3² + 4²) = √(9 + 16) = √25 = 5 squares.
Three facts make the formula easier to trust:
- The order of the points does not matter. 3 − 7 = −4 and 7 − 3 = 4, but both give 16 when squared.
- A distance is never negative. Squares are never negative, and the square root of a positive number is taken as positive.
- Same x or same y? Skip the formula. If the points share an x-value, they sit on a vertical line: just subtract the y-values. From (2, 3) to (2, −4) is 3 − (−4) = 7 units. If they share a y-value, subtract the x-values.
Many answers are not whole numbers. √20 is about 4.47, and in exact form it simplifies to 2√5 (see square roots). Leave it as a surd if the question asks for an exact answer.
The same idea works in three dimensions. Add the change in height z as a third square: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). This is how you find the longest diagonal of a box.
The distance formula belongs with two other formulas for a pair of coordinates: the midpoint ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2), which is halfway between them, and the slope (y₂ − y₁) ÷ (x₂ − x₁), which is how steep the line between them is.
Examples
| Points | Change in x | Change in y | Working | Distance |
|---|---|---|---|---|
| (1, 2) and (4, 6) | 3 | 4 | √(9 + 16) = √25 | 5 |
| (−2, 1) and (4, 9) | 6 | 8 | √(36 + 64) = √100 | 10 |
| (0, 0) and (5, 12) | 5 | 12 | √(25 + 144) = √169 | 13 |
| (3, −1) and (−2, 3) | −5 | 4 | √(25 + 16) = √41 | ≈ 6.40 |
| (1, 1) and (3, 5) | 2 | 4 | √(4 + 16) = √20 | 2√5 ≈ 4.47 |
| (−3, 4) and (5, 4) | 8 | 0 | same y: 5 − (−3) | 8 |
Worked example: on a town map, each square is 1 km. The school is at (2, 1) and the park is at (8, 9). The straight-line distance is √(6² + 8²) = √(36 + 64) = √100 = 10 km. Walking along the grid of streets (6 km across, then 8 km up) would be 14 km, which is why "as the crow flies" is always the shortest route.
Common mistakes
- Mixing x and y. Subtract x from x and y from y, never an x from a y. Fix: write the two changes on separate lines before squaring.
- Squaring a negative wrongly. (−5)² = 25, not −25. Fix: always put a negative change in brackets before squaring it.
- Splitting the square root. √(9 + 16) is √25 = 5, not √9 + √16 = 3 + 4 = 7. Fix: add first, take the square root last.
- Stopping before the square root. 9 + 16 = 25 is d², not d. Fix: finish with √.
Step by step
Step by step
- Label the pointsCall them (x₁, y₁) and (x₂, y₂). Either point can be first.
- Find the change in xWork out x₂ − x₁.
- Find the change in yWork out y₂ − y₁.
- Square and addSquare both changes (each answer is positive) and add them.
- Take the square rootD = √(sum). Simplify the surd, or round to the accuracy asked for.
Quick check: the distance must be at least as long as the bigger of the two changes and no longer than their total. For (1, 2) to (4, 6), 5 lies between 4 and 3 + 4 = 7, so it makes sense.
Practice questions
Find the distance
Try each one, then check your answer.
- Find the distance between (0, 0) and (6, 8).
Show answer
√(36 + 64) = √100 = 10 - Find the distance between (1, 3) and (1, 10).
Show answer
Same x, so subtract the y-values: 10 − 3 = 7 - Find the distance between (−4, 2) and (5, 2).
Show answer
Same y, so subtract the x-values: 5 − (−4) = 9 - Find the distance between (2, 3) and (5, 7).
Show answer
Changes 3 and 4: √(9 + 16) = √25 = 5 - Find the distance between (−1, −2) and (4, 10).
Show answer
Changes 5 and 12: √(25 + 144) = √169 = 13 - Find the distance between (0, 0) and (1, 1).
Show answer
√(1 + 1) = √2 ≈ 1.41 - Find the distance between (2, −3) and (−4, 5).
Show answer
Changes −6 and 8: √(36 + 64) = √100 = 10 - Find the exact distance between (1, 2) and (3, 6).
Show answer
Changes 2 and 4: √(4 + 16) = √20 = 2√5 (≈ 4.47) - Find the exact distance between (−3, −3) and (3, 3).
Show answer
Changes 6 and 6: √(36 + 36) = √72 = 6√2 (≈ 8.49) - Find the distance between (−6, 4) and (2, −11).
Show answer
Changes 8 and −15: √(64 + 225) = √289 = 17 - The distance from (0, 0) to (k, 8) is 10, and k > 0. Find k.
Show answer
k² + 64 = 100, so k² = 36: k = 6 - Find the perimeter of the triangle A(0, 0), B(4, 0), C(0, 3).
Show answer
AB = 4, AC = 3, BC = √(16 + 9) = 5: 4 + 3 + 5 = 12 - Is the triangle A(1, 1), B(4, 5), C(8, 2) isosceles?
Show answer
AB = √(9 + 16) = 5, BC = √(16 + 9) = 5, AC = √(49 + 1) = √50: yes, AB = BC = 5 (and since 25 + 25 = 50, the angle at B is a right angle) - A circle has centre (2, −1) and radius 5. Is the point (5, 3) on the circle?
Show answer
Distance = √(3² + 4²) = √25 = 5, equal to the radius: yes - Find the distance between (1, 2, 3) and (3, 5, 9) in 3D.
Show answer
Changes 2, 3 and 6: √(4 + 9 + 36) = √49 = 7 - Find the distance from the point (0, 0) to the line 3x + 4y − 10 = 0.
Show answer
|3(0) + 4(0) − 10| ÷ √(3² + 4²) = 10 ÷ 5 = 2
Word problems
Distance in real life
Try each one, then check your answer.
- On a map grid where 1 square = 1 km, your home is at (1, 2) and a friend's house is at (4, 6). How far apart are they in a straight line?
Show answer
Changes 3 and 4: √25 = 5 km - A drone takes off at (0, 0) and lands at (120, 50), measured in metres. How far did it fly in a straight line?
Show answer
√(14,400 + 2,500) = √16,900 = 130 m - On a football pitch, a player stands at (10, 20) and the ball is at (34, 27), in metres. How far away is the ball?
Show answer
Changes 24 and 7: √(576 + 49) = √625 = 25 m - A town's streets form a grid of 1 km squares. How much shorter is the straight line from (0, 0) to (6, 8) than walking along the streets?
Show answer
Straight line √(36 + 64) = 10 km; streets 6 + 8 = 14 km: 4 km shorter - A phone mast at (2, 3) reaches 6 km. Is a house at (7, 6) in range?
Show answer
√(5² + 3²) = √34 ≈ 5.83 km, which is less than 6: yes - A box is 3 m long, 4 m wide and 12 m tall. How long is the diagonal from one bottom corner to the opposite top corner?
Show answer
√(9 + 16 + 144) = √169 = 13 m
Questions people ask
What is the distance formula?
d = √((x₂ − x₁)² + (y₂ − y₁)²). Find the change in x and the change in y, square them, add, and take the square root.
How do you find the distance between two points on a coordinate plane?
If the points share an x-value or a y-value, subtract the other coordinates. Otherwise draw the right-angled triangle (or use the formula): square the across and up changes, add, and take the square root.
How is the distance formula related to Pythagoras' theorem?
It is the same rule. The change in x and the change in y are the two shorter sides of a right-angled triangle, and the distance is the hypotenuse, so d² = (change in x)² + (change in y)².
What is the distance between two points called?
In maths it is the length of the line segment between them, also called the Euclidean distance. "As the crow flies" means the same straight-line distance.
How do you find the distance between two points in 3D?
Add a third term for z: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (1, 2, 3) to (3, 5, 9) is √(4 + 9 + 36) = 7.
How do you find the distance between a point and a line?
For the point (x₀, y₀) and the line ax + by + c = 0, the shortest distance is |ax₀ + by₀ + c| ÷ √(a² + b²). From (1, 2) to 3x + 4y − 1 = 0 it is |3 + 8 − 1| ÷ 5 = 2.
How does Google Maps measure the distance between points?
On a computer you can right-click the map, choose "Measure distance" and click the points. Maps work on the curved surface of the Earth, so they do not use the flat formula, but for a small area such as a school grid the flat formula is a very good estimate.
Quick quiz
Distance formula
Check what you know with 5 quick questions.
Question 1 of 5
What is the distance between (0, 0) and (3, 4)?
Practise it
Try it
Practise distances on the coordinate grid
Geometry worksheets
Practise it step by step in a full course: Grade 9 Maths
For grown-ups
Related topics
Pythagoras' theorem
Pythagoras' theorem says that in a right-angled triangle, a² + b² = c², where c is the longest side (the hypotenuse). For sides 3 and 4, the hypotenuse is 5.
Coordinates
Coordinates are a pair of numbers that give an exact position on a grid, like (3, 5). The first number is how far across (x) and the second is how far up (y).
Slope (gradient)
Slope (called gradient in the UK) measures how steep a line is. It is the rise divided by the run, m = (y₂ − y₁) ÷ (x₂ − x₁), and it can be positive, negative, zero or undefined.
Square roots
The square root of a number is the value that, multiplied by itself, gives that number. The square root of 25 is 5, because 5 × 5 = 25. The sign is √.
Equation of a circle
A circle with centre (a, b) and radius r has the equation (x − a)² + (y − b)² = r². If the centre is the origin, it is simply x² + y² = r².
Angles in parallel lines
When a line crosses two parallel lines, corresponding (F) and alternate (Z) angles are equal and co-interior (C) angles add to 180°. Vertically opposite angles are always equal.