Skip to the formula

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

The distance formula is d = √((x₁ − x₂)² + (y₁ − y₂)² + (z₁ − z₂)²).

What each letter means

When to use it

In IB Maths for the length of a line segment in 2D or 3D. AI uses it for lengths inside cuboids and pyramids before a trig step; AA uses it with vectors and coordinates.

Worked example

Find the distance between \(A(1,-2,4)\) and \(B(4,2,-8)\).

  1. \(d=\sqrt{(1-4)^2+(-2-2)^2+(4-(-8))^2}=\sqrt{9+16+144}\)

Answer: \(d=\sqrt{169}=13\)

Common mistake

Dropping the z term in a 3D question. The booklet version has three brackets: use all three.

Fix it with practice: Skill Builder: Coordinate Geometry (free account).

Try one yourself

One quick IB Maths question on the distance formula. No sign-in needed.

Find the distance between \((0, 0)\) and \((5, 12)\).
Choose your answer · keys 1–4

On your IB Maths course

CourseIn the exam
AA SL
All IB AA SL formulas by topic
In the IB formula booklet
AI SL
All IB AI SL formulas by topic
In the IB formula booklet
AA HL
All IB AA HL formulas by topic
In the IB formula booklet
AI HL
All IB AI HL formulas by topic
In the IB formula booklet

From our own IB Maths formula sheets, in our words. The IB gives its booklet to schools, so we checked against our own copy: your teacher has the official one. Official: IB DP Mathematics page.

Practise and revise

Distance formula formula card: d = √((x₁ − x₂)² + (y₁ − y₂)² + (z₁ − z₂)²). IB Math Revision
Distance formula card for IB Maths: download (PNG).

IB Maths FAQ

Is the distance formula in the IB formula booklet?

AA SL: in the IB formula booklet. AI SL: in the IB formula booklet. AA HL: in the IB formula booklet. AI HL: in the IB formula booklet.

Is the IB distance formula the same in 3D?

Yes, with a third term: d = √((x₁ − x₂)² + (y₁ − y₂)² + (z₁ − z₂)²). Leave out z for points in a plane.

Our own wording, examples and card, checked by IB Math Revision. Not produced or endorsed by the International Baccalaureate Organization.