Skip to content
LoveToCalc

Theorem — what does that mean?

Distance between two points

The horizontal gap and the vertical gap, squared, added and rooted.

In Swedish: Avstånd mellan två punkter

Distance between two points

The relation

d=(x₂−x₁)²+(y₂−y₁)²

The distance between two points in the coordinate plane: the horizontal gap and the vertical gap, squared, added and rooted.

Solve for

d=5

d equals the square root of ((4 minus 1) squared plus (6 minus 2) squared), equals the square root of (3 squared plus 4 squared), equals the square root of (9 plus 16), equals the square root of (25), equals 5

Working5 steps

Practice questions

You are given

  • x₂=7
  • x₁=2
  • y₂=15
  • y₁=3

What the formula says

Two points in a coordinate plane, (x₁, y₁) and (x₂, y₂). The distance between them is

d = √((x₂ − x₁)² + (y₂ − y₁)²)

It is a formula to recognise rather than memorise, because it is Pythagoras’ theorem with the legs written out as differences.

The derivation: a right triangle

Plot the two points, then draw a horizontal line from one and a vertical line from the other. They meet, and you have a right triangle in which the segment between the points is the hypotenuse.

Pythagoras gives d² = (x₂ − x₁)² + (y₂ − y₁)², and taking the square root of both sides gives the formula. The triangle can be drawn for any two points except when one sits directly above or beside the other — and then the distance is just the one difference, which is what the formula gives too, because the other square is zero.

The order does not matter

Compute x₁ − x₂ instead of x₂ − x₁ and you get the opposite sign. But the difference is squared, and the square is the same either way: (−3)² and 3² are both 9. The distance comes out the same.

This differs from the slope, where the order has to match in numerator and denominator for the answer to be right. Distance has no direction; slope does.

Worked examples

Forwards. From (1, 2) to (4, 6). The differences are 3 and 4, so d = √(9 + 16) = √25 = 5. That is the 3-4-5 triangle laid on the plane.

A more typical answer. From (0, 0) to (3, 5): d = √(9 + 25) = √34 ≈ 5.83. Most distances are irrational — triangles with whole-number answers are the exception, not the rule.

Backwards. A point is 5 away from (1, 2) and has y = 6. The horizontal difference then has to satisfy (x − 1)² = 25 − 16 = 9, so x − 1 = ±3. The point is (4, 6) or (−2, 6) — two answers, one on each side.

Common mistakes

Common questions

Does it matter which point I call the first? No. The squares remove the sign, so either choice gives the same distance.

Does the formula work in three dimensions? Yes, with one more term: d = √(Δx² + Δy² + Δz²). It is the same theorem applied twice, just like the space diagonal of a cuboid.

Why is the answer almost always a surd? Because the sum of two squares is rarely a square. The pairs that give whole numbers are the Pythagorean triples, and they are thinly spread.

How do I find the point halfway between? Average the coordinates separately: ((x₁ + x₂)/2, (y₁ + y₂)/2). See the midpoint page.

Looking for another letter? The formula solved for each one
Solved for each letter
Solve forRearrangedWith the numbersComes to
d(x₂−x₁)²+(y₂−y₁)²(4−1)²+(6−2)²5
x₁x₂−d²−(y₂−y₁)²4−5²−(6−2)²1
y₁y₂−d²−(x₂−x₁)²6−5²−(4−1)²2
x₂x₁+d²−(y₂−y₁)²1+5²−(6−2)²4
y₂y₁+d²−(x₂−x₁)²2+5²−(4−1)²6

Last reviewed October 6, 2026 ·How pages are reviewed

Ready-made worksheets with this formula

Sheets that ask this formula, with their answer keys. Open one to see the questions or print it.

High school

Straight linesAll formulas

Put this formula on your site

Copy the code into your page where the formula card should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.