The Distance Between Two Points

Pythagoras laid on the grid.

Straight across the grid

How far is it from (1, 1) to (4, 5) in a straight line? Counting steps along the grid lines, 3 across and then 4 up, gives 3 + 4 = 7. But that is the length of a path with a corner in it. The straight line between the points is shorter.

A right triangle under the line

Go from (1, 1) across to (4, 1), then up to (4, 5). The first move is horizontal and the second is vertical, so they meet at a right angle at (4, 1). Together with the straight line from (1, 1) to (4, 5), they make a right triangle.

The two shorter sides are the run, 4 − 1 = 3, and the rise, 5 − 1 = 4. The straight line between the two points is the side opposite the right angle: the hypotenuse.

xy34

The run from (1, 1) to (4, 1) is 3 and the rise from (4, 1) to (4, 5) is 4. They meet at a right angle, and the line from (1, 1) to (4, 5) is the hypotenuse.

Pythagoras on the grid

In a right triangle, the square of the hypotenuse is the sum of the squares of the two shorter sides. So the distance d satisfies d² = 3² + 4² = 9 + 16 = 25, and d = √25 = 5.

The straight line is 5 long, and the path along the grid lines is 7. The hypotenuse is always shorter than the two other sides added together.

M (1, −1)d = √(5² + 3²) = 5.83M = ((−1.5 + 3.5)/2, (0.5 − 2.5)/2)

AB is the diagonal of a 5 by 3 box, √(5² + 3²) = 5.83; M = (1, −1) is the average of the x-coordinates and the average of the y-coordinates, found separately

Make the box 3 by 4 and read the distance

A and B sit at opposite corners of the dashed box, whose sides are the run and the rise. The distance AB is the diagonal of the box, the hypotenuse of a right triangle with those two sides, and the working at the top left finds it by Pythagoras’ theorem. When the box is 3 by 4, AB = √(9 + 16) = 5.

The distance formula

For any two points (x₁, y₁) and (x₂, y₂), the run is x₂ − x₁ and the rise is y₂ − y₁. Square them, add, and take the square root: d = √((x₂ − x₁)² + (y₂ − y₁)²).

From (−2, 3) to (4, −5), the run is 4 − (−2) = 6 and the rise is −5 − 3 = −8. Then d = √(6² + (−8)²) = √(36 + 64) = √100 = 10.

The rise came out negative, because the second point is lower. That does not matter: the whole difference is squared, and (−8)² = 64, the same as 8². So it makes no difference which point is taken first.

xy68

From (−2, 3) to (4, −5): 6 across and 8 down. The triangle has shorter sides 6 and 8, so the distance is √(36 + 64) = 10.

When the root is not a whole number

From (1, 2) to (4, 4), the run is 3 and the rise is 2, so d = √(9 + 4) = √13. No whole number squares to 13, so the exact distance is √13, which is about 3.61. Leave it as √13 unless a decimal is asked for.

A root can sometimes be simplified. From (0, 0) to (2, 4), d = √(4 + 16) = √20, and √20 = √(4 × 5) = 2√5.

To compare two distances, compare their squares. Is Q(4, 6) or R(7, 2) nearer to P(1, 1)? PQ² = 3² + 5² = 9 + 25 = 34, and PR² = 6² + 1² = 36 + 1 = 37. The smaller square belongs to the shorter distance, so Q is nearer, and no square root had to be worked out.

Points level with each other

When two points have the same y-coordinate, there is no rise, and the distance is the difference in x. From (2, 3) to (9, 3) it is 9 − 2 = 7. The formula agrees: √(7² + 0²) = √49 = 7. Points with the same x-coordinate work the same way, with the difference in y.

The usual mistakes

Adding the run and the rise. For (1, 1) and (4, 5), 3 + 4 = 7 is the path along the grid lines. The straight-line distance is √(3² + 4²) = 5.

Stopping at the square. 3² + 4² = 25 is d², not d. The last step is the square root: d = √25 = 5.

Squaring a negative difference without its bracket. −8² read as −64 gives √(36 − 64), which has no answer. The difference is −8, and (−8)² = 64.

Worked example: A Delivery Drone's Straight Flight and the Nearer of Two Charging Depots

Question A map has a grid in kilometers. A drone flies in a straight line from its base at L(2, 2) to a customer at S(14, 7). It then flies straight to a depot to recharge. Depot P is at (8, 15) and depot Q is at (21, 15). (a) How far does the drone fly from L to S? (b) Which depot is nearer to S? The battery lasts for 25 km of flight. Is that enough for the flight from the base to the customer and on to the nearer depot?

  1. 1.From L(2, 2) to S(14, 7) the difference in x is 14 − 2 = 12 and the difference in y is 7 − 2 = 5. These are the two shorter sides of a right-angled triangle whose hypotenuse is the flight.

    5101505101520km east, xkm north, y125L(2, 2)S(14, 7)P(8, 15)Q(21, 15)from L to S: 14 − 2 = 12 across and 7 − 2 = 5 upthe flight is the hypotenuse of this triangle
    5101505101520km east, xkm north, y125L(2, 2)S(14, 7)P(8, 15)Q(21, 15)from L to S: 14 − 2 = 12 across and 7 − 2 = 5 upthe flight is the hypotenuse of this triangle
    From L to S the map goes 14 − 2 = 12 across and 7 − 2 = 5 up. The flight is the hypotenuse of this right-angled triangle.
  2. 2.(a) By Pythagoras' theorem, LS = √122 + 52 = √144 + 25 = √169 = 13. The drone flies 13 km to the customer.

    5101505101520km east, xkm north, y12513 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)LS2= 122+ 52= 144 + 25 = 169LS =√169 = 13 km
    5101505101520km east, xkm north, y12513 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)LS2= 122+ 52= 144 + 25 = 169LS =√169 = 13 km
    (a) LS = √122 + 52 = √169 = 13, so the drone flies 13 km to the customer.
  3. 3.From S(14, 7) to P(8, 15) the differences are 8 − 14 = −6 and 15 − 7 = 8, so SP2 = (−6)2 + 82 = 36 + 64 = 100 and SP = 10 km.

    5101505101520km east, xkm north, y13 km10 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)from S to P: −6 across and 8 upSP2= 36 + 64 = 100, so SP = 10 km
    5101505101520km east, xkm north, y13 km10 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)from S to P: −6 across and 8 upSP2= 36 + 64 = 100, so SP = 10 km
    From S to P the differences are −6 and 8, so SP2 = 36 + 64 = 100 and SP = 10 km.
  4. 4.From S(14, 7) to Q(21, 15) the differences are 21 − 14 = 7 and 15 − 7 = 8, so SQ2 = 72 + 82 = 49 + 64 = 113. Since 113 is more than 100, SQ is longer than SP.

    5101505101520km east, xkm north, y13 km10 km√113 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)from S to Q: 7 across and 8 upSQ2= 49 + 64 = 113, which is more than 100
    5101505101520km east, xkm north, y13 km10 km√113 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)from S to Q: 7 across and 8 upSQ2= 49 + 64 = 113, which is more than 100
    From S to Q the differences are 7 and 8, so SQ2 = 49 + 64 = 113. This is more than 100, so SQ is longer than SP.
  5. 5.(b) Depot P is nearer, at 10 km from S. The whole flight is 13 + 10 = 23 km, which is less than 25 km, so the battery lasts with 2 km to spare.

    5101505101520km east, xkm north, y13 km10 km√113 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)depot P is nearer, at 10 km13 + 10 = 23 km, which is less than 25 km
    5101505101520km east, xkm north, y13 km10 km√113 kmL(2, 2)S(14, 7)P(8, 15)Q(21, 15)depot P is nearer, at 10 km13 + 10 = 23 km, which is less than 25 km
    (b) Depot P is nearer, at 10 km. The whole flight is 13 + 10 = 23 km, which is less than 25 km, so the battery lasts.

Answer: (a) 13 km; (b) depot P, which is 10 km from S, because SQ2 = 113 is more than SP2 = 100; the whole flight is 23 km, so 25 km is enough

Common mistakes

  • Adding the two differences, 12 + 5 = 17 km, for the flight. That is the distance along the grid lines. The drone flies straight, along the hypotenuse, which is √122 + 52 = 13 km.
  • Writing −62 = −36 for the flight to P, which gives SP2 = 28. The difference −6 is squared as a whole, (−6)2 = 36. A square is never negative, so the order of the subtraction does not change the distance.

More quadratic graphs and coordinate geometry problems, worked step by step →

Practice The Distance Between Two Points in the app