What you'll learn
- How horizontal and vertical changes between two points form a right-angled triangle.
- How to derive and use the distance formula.
- How to give distances exactly as surds or as suitable decimal approximations.
- How to use distance in coordinate-geometry problems.
Coordinates and displacement
A point in two dimensions is written as an ordered pair (x,y)(x,y)(x,y).
- The first coordinate, xxx, gives the horizontal position.
- The second coordinate, yyy, gives the vertical position.
For example, the point A(2,5)A(2,5)A(2,5) is 2 units to the right of the origin and 5 units above it.
Suppose two points are
A(x1,y1)andB(x2,y2).A(x_1,y_1) \quad \text{and} \quad B(x_2,y_2).A(x1,y1)andB(x2,y2).The horizontal change from AAA to BBB is x2−x1x_2-x_1x2−x1, and the vertical change is y2−y1y_2-y_1y2−y1.
Coordinate differences
For points A(x1,y1)A(x_1,y_1)A(x1,y1) and B(x2,y2)B(x_2,y_2)B(x2,y2):
- Horizontal change: x2−x1x_2-x_1x2−x1
- Vertical change: y2−y1y_2-y_1y2−y1
These changes may be positive or negative because they describe direction as well as size.
Finding horizontal and vertical changes
Find the horizontal and vertical changes from A(−3,2)A(-3,2)A(−3,2) to B(5,−4)B(5,-4)B(5,−4).
-
Subtract the xxx-coordinate of AAA from the xxx-coordinate of BBB:
5−(−3)=8.5-(-3)=8.5−(−3)=8. -
Subtract the yyy-coordinate of AAA from the yyy-coordinate of BBB:
−4−2=−6.-4-2=-6.−4−2=−6. -
Therefore, the movement from AAA to BBB is 8 units horizontally to the right and 6 units vertically down. The negative vertical change records the downward direction.
Subtracting in different orders
Use the same order for both coordinate differences. If you calculate x2−x1x_2-x_1x2−x1, also calculate y2−y1y_2-y_1y2−y1. Mixing the orders can cause errors in later vector work, even though squaring hides the mistake in a distance calculation.
Building the distance formula
The straight line joining two points can be treated as the hypotenuse of a right-angled triangle.
The other two sides have lengths equal to the magnitudes of the horizontal and vertical changes. Pythagoras’ theorem says that, for a right-angled triangle with shorter sides aaa and bbb and hypotenuse ccc,
c2=a2+b2.c^2=a^2+b^2.c2=a2+b2.Applying this to points A(x1,y1)A(x_1,y_1)A(x1,y1) and B(x2,y2)B(x_2,y_2)B(x2,y2) gives
d2=(x2−x1)2+(y2−y1)2,d^2=(x_2-x_1)^2+(y_2-y_1)^2,d2=(x2−x1)2+(y2−y1)2,where ddd is the distance between the points. A distance cannot be negative, so take the positive square root:
d=(x2−x1)2+(y2−y1)2.d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}.d=(x2−x1)2+(y2−y1)2.The distance formula
The distance between A(x1,y1)A(x_1,y_1)A(x1,y1) and B(x2,y2)B(x_2,y_2)B(x2,y2) is
AB=(x2−x1)2+(y2−y1)2.AB=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}.AB=(x2−x1)2+(y2−y1)2.It is Pythagoras’ theorem applied to the horizontal and vertical coordinate differences.
The order of the points does not affect the final distance. Reversing the subtraction changes the signs of both differences, but squaring removes those sign changes:
(x1−x2)2=(x2−x1)2.(x_1-x_2)^2=(x_2-x_1)^2.(x1−x2)2=(x2−x1)2.Calculating a distance
Finding an exact distance
Find the distance between P(−2,3)P(-2,3)P(−2,3) and Q(4,11)Q(4,11)Q(4,11).
-
Find the coordinate differences:
horizontal change=4−(−2)=6,vertical change=11−3=8.\begin{aligned} \text{horizontal change} &=4-(-2)=6,\\ \text{vertical change} &=11-3=8. \end{aligned}horizontal changevertical change=4−(−2)=6,=11−3=8. -
Substitute these differences into the distance formula:
PQ=62+82.PQ=\sqrt{6^2+8^2}.PQ=62+82. -
Evaluate the squares and take the positive square root:
PQ=36+64=100=10.PQ=\sqrt{36+64}=\sqrt{100}=10.PQ=36+64=100=10.
Therefore, the distance between the points is 10 units.
A useful check
The distance is the hypotenuse, so it must be at least as large as either the horizontal change or the vertical change. In the example above, a distance of 10 is sensibly larger than both 6 and 8.
Exact distances and surds
A surd is an exact expression containing a root that cannot be evaluated as a rational number. For example, 13\sqrt{13}13 is a surd.
Unless a decimal is requested, leave a non-square distance in its exact surd form. Simplify the surd if it contains a square factor.
For example,
20=4×5=25.\sqrt{20}=\sqrt{4\times 5}=2\sqrt{5}.20=4×5=25.Giving a distance as a simplified surd
Find the exact distance between A(−1,4)A(-1,4)A(−1,4) and B(5,−2)B(5,-2)B(5,−2).
-
Calculate the coordinate differences:
5−(−1)=6,−2−4=−6.\begin{aligned} 5-(-1)&=6,\\ -2-4&=-6. \end{aligned}5−(−1)−2−4=6,=−6. -
Apply the distance formula. The negative vertical change causes no problem because it is squared:
AB=62+(−6)2=36+36=72.AB=\sqrt{6^2+(-6)^2} =\sqrt{36+36} =\sqrt{72}.AB=62+(−6)2=36+36=72. -
Extract the largest square factor from 72:
AB=36×2=62.AB=\sqrt{36\times 2}=6\sqrt{2}.AB=36×2=62.
The exact distance is 626\sqrt{2}62 units. As a decimal, this is approximately 8.49 units, but the surd is the exact answer.
Adding before squaring
The formula contains the sum of two squares:
(x2−x1)2+(y2−y1)2.(x_2-x_1)^2+(y_2-y_1)^2.(x2−x1)2+(y2−y1)2.It is not the same as ((x2−x1)+(y2−y1))2\big((x_2-x_1)+(y_2-y_1)\big)^2((x2−x1)+(y2−y1))2. Square each coordinate difference separately before adding.
Horizontal and vertical lines
The same formula works when the points lie on a horizontal or vertical line.
If two points have the same yyy-coordinate, the vertical change is zero, so their distance is simply the magnitude of the difference between their xxx-coordinates:
d=∣x2−x1∣.d=|x_2-x_1|.d=∣x2−x1∣.Similarly, if the points have the same xxx-coordinate, then
d=∣y2−y1∣.d=|y_2-y_1|.d=∣y2−y1∣.The notation ∣a∣|a|∣a∣ means the absolute value or magnitude of aaa: its non-negative size.
Distance along a vertical line
Find the distance between R(−4,7)R(-4,7)R(−4,7) and S(−4,−5)S(-4,-5)S(−4,−5).
-
Notice that both points have x=−4x=-4x=−4, so the horizontal change is zero.
-
Find the magnitude of the vertical change:
∣−5−7∣=∣−12∣=12.|{-5}-7|=|-12|=12.∣−5−7∣=∣−12∣=12. -
Therefore, RS=12RS=12RS=12 units. This agrees with the full formula:
RS=02+(−12)2=12.RS=\sqrt{0^2+(-12)^2}=12.RS=02+(−12)2=12.
Using distance to compare lengths
In coordinate geometry, you may need to decide whether lengths are equal, perhaps to show that a triangle is isosceles.
It is often efficient to compare squared distances. Since distances are non-negative, two distances are equal exactly when their squares are equal. This avoids unnecessary square roots.
Showing that a triangle is isosceles
The points A(1,1)A(1,1)A(1,1), B(5,2)B(5,2)B(5,2) and C(2,5)C(2,5)C(2,5) form a triangle. Determine whether the triangle is isosceles.
-
Calculate the squared distance from AAA to BBB:
AB2=(5−1)2+(2−1)2=42+12=17.AB^2=(5-1)^2+(2-1)^2=4^2+1^2=17.AB2=(5−1)2+(2−1)2=42+12=17. -
Calculate the squared distance from AAA to CCC:
AC2=(2−1)2+(5−1)2=12+42=17.AC^2=(2-1)^2+(5-1)^2=1^2+4^2=17.AC2=(2−1)2+(5−1)2=12+42=17. -
Since AB2=AC2AB^2=AC^2AB2=AC2, it follows that AB=ACAB=ACAB=AC. Therefore, triangle ABCABCABC is isosceles, with equal sides ABABAB and ACACAC.
Compare squared distances
When you only need to establish whether two lengths are equal, compare expressions such as AB2AB^2AB2 and AC2AC^2AC2. Take square roots only when the actual lengths are required.
Modelling with coordinates
Coordinates can represent positions in a real situation, such as points on a map. The distance formula gives the straight-line distance according to the scale of the coordinate system.
Always interpret the result in context. A calculated straight-line distance may not be the same as the distance travelled along roads or paths.
Using a coordinate scale
On a map, one coordinate unit represents 2 km. Two sites are at P(3,1)P(3,1)P(3,1) and Q(8,13)Q(8,13)Q(8,13). Find their straight-line separation.
-
Calculate the distance in coordinate units:
PQ=(8−3)2+(13−1)2=52+122=169=13.PQ=\sqrt{(8-3)^2+(13-1)^2} =\sqrt{5^2+12^2} =\sqrt{169} =13.PQ=(8−3)2+(13−1)2=52+122=169=13. -
Convert coordinate units to kilometres using the scale:
13×2=26.13\times 2=26.13×2=26. -
Therefore, the sites are 26 km apart in a straight line.
In the exam
- Write the two coordinate differences in a consistent order, keeping brackets around negative values.
- Square each difference separately, add the results, and then take the positive square root.
- Give an exact simplified surd unless a decimal accuracy is requested, and include units when the context supplies them.
- Check that your distance is non-negative and at least as large as either horizontal or vertical separation.
Check yourself
- What is the exact distance between (2,−1)(2,-1)(2,−1) and (−4,7)(-4,7)(−4,7)?
- Why does reversing the order of the two points leave the distance unchanged?
- How could squared distances be used to test whether a triangle is isosceles?