Distance Between Two Points Formula Solver with Worked Examples

The distance between and is . Use the calculator to find the distance, or a missing coordinate.

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

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.

  • : distance between the points
  • : x-coordinate of the first point
  • : y-coordinate of the first point
  • : x-coordinate of the second point
  • : 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 and the vertical side has length .

Pythagoras gives the distance. The order of subtraction does not matter because the differences are squared.

This formula underlies the equation of a circle, where the distance from the centre is constant. It is complemented by the midpoint of a line segment and the gradient between two points.

This page is part of Coordinate geometry in Geometry and measures. Topics that work alongside it: Midpoint of a line segment, Gradient between two points, Equation of a circle, General form of a straight line, Equation of a line through two points and Circle: general form.

What is it used for?

The distance between (x₁, y₁) and (x₂, y₂) is √((x₂ − x₁)² + (y₂ − y₁)²). It is Pythagoras’ theorem on a coordinate grid.

How to use the distance between two points formula

  1. Find the difference in and the difference in .
  2. Square both differences and add them.
  3. Take the square root.
  4. Leave the answer as a surd or round it.

Graph

Distance between (1, 2) and (4, 6)(1, 2)(4, 6)012345601234567Distance between (1, 2) and (4, 6)xyGraph with x from -0.5 to 6 and y from 0 to 7.5. Shows point (1, 2) at (1, 2); point (4, 6) at (4, 6).

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 and .

Distance between two points Answer checked
Answer
d=5d=5
  1. The formula
    Distance between two points. In this formula is the distance between the points, is the x-coordinate of the first point, is the y-coordinate of the first point, is the x-coordinate of the second point, is the y-coordinate of the second point.
  2. What we know and what we want
    We know and we want to find , the distance between the points.
  3. Substitute the numbers
  4. Calculate
  5. Check by substituting back
    Put all the values back into the original formula: both sides should match.

Example 2: from the origin

Find the distance from the origin to .

Distance between two points Answer checked
Answer
d=13d=13
  1. The formula
    Distance between two points. In this formula is the distance between the points, is the x-coordinate of the first point, is the y-coordinate of the first point, is the x-coordinate of the second point, is the y-coordinate of the second point.
  2. What we know and what we want
    We know and we want to find , the distance between the points.
  3. Substitute the numbers
  4. Calculate
  5. Check by substituting back
    Put all the values back into the original formula: both sides should match.

Example 3: a missing coordinate

The distance between and is 10, with . Find .

Distance between two points Answer checked
Answer
x2=9x_{2}=9
  1. The formula
    Distance between two points. In this formula is the distance between the points, is the x-coordinate of the first point, is the y-coordinate of the first point, is the x-coordinate of the second point, is the y-coordinate of the second point.
  2. What we know and what we want
    We know and we want to find , the x-coordinate of the second point.
  3. Rearrange for
    Square both sides, subtract (y₂ − y₁)², take the square root, then add x₁ (taking the point to the right of the first).
  4. Substitute the numbers
  5. Calculate
  6. Check by substituting back
    Put all the values back into the original formula: both sides should match.

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).

  1. Differencesx: 4 − 1 = 3 and y: 6 − 2 = 4
  2. Pythagorasd² = 9 + 16 = 25
  3. Rootd = 5
  4. Check: a 3-4-5 triangle ✓The distance is 5.

From the origin

Find the distance from (0, 0) to (5, 12).

  1. Square and addd² = 25 + 144 = 169
  2. Rootd = 13
  3. 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.

  1. Differencesx: 3 − (−2) = 5 and y: −4 − 1 = −5
  2. Pythagorasd² = 25 + 25 = 50
  3. Rootd = 7.07
  4. 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.

  1. Vertical gap8 − 2 = 6
  2. Horizontal gap(x − 1)² = 100 − 36 = 64, so x − 1 = 8
  3. Solvex = 9
  4. 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

  1. Find Δx and Δy.
  2. Square both, add.
  3. Root last.
  4. Mind negatives.
  5. 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.

How do I find a missing coordinate?

Rearrange and take the root.

Does the order of the points matter?

No, the squares remove the sign.

What is the distance from the origin?

√(x² + y²).

Which page covers the distance to a line?

distance from a point to a line.

More in Geometry and measures and the formula sheets.