Distance, Midpoint and Gradient (AI SL)
Before you can build a Voronoi diagram or the equation of a line, you need the three basic measurements between two coordinates: how far apart they are, where they meet in the middle, and how steeply the segment between them rises. This page collects all three formulas in one place, with worked examples and the slips that most often cost a mark. It's part of the broader Coordinate Geometry & Voronoi topic.
15 questions on this sub-topic.
The three formulas
Covered under IB syllabus reference SL3.5, as the groundwork for equations of perpendicular bisectors. None of the three formulas below are in the formula booklet - they're treated as prior knowledge.
Distance
\(d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\)
Pythagoras' theorem applied to the horizontal and vertical gaps between the two points.
Not in the formula booklet - prior knowledgeMidpoint
\(M=\left(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2}\right)\)
Average the x-coordinates and average the y-coordinates separately.
Not in the formula booklet - prior knowledgeGradient
\(m=\dfrac{y_2-y_1}{x_2-x_1}\)
The change in \(y\) divided by the change in \(x\) between any two points on the line.
Not in the formula booklet - prior knowledgeNeed the fuller syllabus wording and formula-booklet reference table? See Coordinate Geometry & Voronoi.
Worked examples
A straight road runs from \(A(1, 1)\) to \(B(13, 6).\)
(a) Find the length of the road (3 significant figures).
(b) A rest stop is placed at the midpoint. State its coordinates.
Worked solution
(a) \(AB = \sqrt{(13-1)^2 + (6-1)^2} = \sqrt{12^2 + 5^2} = \sqrt{169} = 13\) units. M1 A1
Step 2 - Midpoint.
(b) \(M = \left(\frac{1+13}{2}, \frac{1+6}{2}\right) = (7, 3.5).\) M1 A1
\((5, 12, 13)\) is a Pythagorean triple, so the length is exact.
Find the distance between \(P(2, 3)\) and \(Q(8, 11)\).
Worked solution
\(d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}\). M1
\(P(2,3),\ Q(8,11)\):
\(d = \sqrt{(8-2)^2 + (11-3)^2} = \sqrt{36 + 64} = \sqrt{100}\) A1 \(= 10.\) A1 \((6, 8, 10)\) is a scaled \((3,4,5)\) triple, so the root is exact.
Find the distance between \((-1,2)\) and \((2,6).\)
Worked solution
\(d=\sqrt{(2-(-1))^2+(6-2)^2}.\) M1
\(=\sqrt{9+16}.\) A1
\(=5.\) A1
Common mistakes
- Averaging the midpoint coordinates incorrectly. The midpoint formula adds the two x-values (and the two y-values) and halves the result - subtracting them, or halving only one coordinate, gives a point nowhere near the segment.
- Forgetting to take the negative reciprocal for a perpendicular gradient. A perpendicular line does not share the segment's gradient - flip it and change its sign, or the line you find won't actually be perpendicular.
- Dropping a negative sign when subtracting coordinates. \((x_2-x_1)\) with a negative \(x_1\) becomes an addition, e.g. \(4-(-3)=7\) - treating it as \(4-3\) understates every distance and gradient calculation that follows.
Ready to practise properly?
15 distance, midpoint and gradient questions, marked instantly like the real exam.
Quick answers
What is the formula for the distance between two points?
\(d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\), which is Pythagoras' theorem applied to the horizontal and vertical differences between the two points.
What is the formula for the midpoint of two points?
\(M=\left(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2}\right)\). Average the x-coordinates and average the y-coordinates separately.