The idea in one breath

If two points lie on the same hor­i­zon­tal or ver­ti­cal line, find­ing the dis­tance between them is easy. You just sub­tract. For any other pair, there is a neat trick. The seg­ment join­ing them is the hypotenuse of a right tri­an­gle whose legs are hor­i­zon­tal and ver­ti­cal, and the Baud­hāyana–Pythago­ras the­o­rem does the rest. In this les­son you will build the for­mula, see why the signs of the dif­fer­ences never mat­ter, and then use it to test shapes and to find a mid­point.

Hor­i­zon­tal and ver­ti­cal seg­ments

If two points share a yy-coor­di­nate, the seg­ment between them is hor­i­zon­tal and its length is the dif­fer­ence of the xx-coor­di­nates. From (2,5)(2, 5) to (9,5)(9, 5), for exam­ple, the length is 9−2=79 - 2 = 7. It works the same way when the xx-coor­di­nate is shared. From (4,−3)(4, -3) to (4,6)(4, 6) the length is 6−(−3)=96 - (-3) = 9.

Take the larger minus the smaller, or find the dif­fer­ence and drop the sign. Either way, remem­ber that a length is never neg­a­tive.

A slanted seg­ment

Let us try A(2,3)A(2, 3) and B(8,11)B(8, 11). Walk from AA hor­i­zon­tally to the point C(8,3)C(8, 3) directly below BB, then ver­ti­cally up to BB. Tri­an­gle ACBACB is right-angled at CC, with

AC=8−2=6,CB=11−3=8AC = 8 - 2 = 6, \qquad CB = 11 - 3 = 8

and so, by the Baud­hāyana–Pythago­ras the­o­rem,

AB=62+82=36+64=100=10AB = \sqrt{6^2 + 8^2} = \sqrt{36 + 64} = \sqrt{100} = 10

Grid with A(2, 3), C(8, 3) and B(8, 11): right triangle ACB with the right angle at C, horizontal leg AC = 6, vertical leg CB = 8 and hypotenuse AB = 10.
The legs 6 and 8 give the dis­tance AB = 10.

The dis­tance for­mula

For P(x1,y1)P(x_1, y_1) and Q(x2,y2)Q(x_2, y_2), the hor­i­zon­tal leg is x2−x1x_2 - x_1 and the ver­ti­cal leg is y2−y1y_2 - y_1, so

PQ=(x2−x1)2+(y2−y1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Here is why you need not worry about signs. Squar­ing removes any minus sign, so it does not mat­ter which point you call PP and which you call QQ, or whether the coor­di­nates are neg­a­tive. If you reflect the whole pic­ture in an axis, the signs change but the dis­tances do not.

Exam­ple 1. Find the dis­tance between (−3,4)(-3, 4) and (5,−2)(5, -2).

(5−(−3))2+(−2−4)2=82+(−6)2=64+36=10\sqrt{(5 - (-3))^2 + (-2 - 4)^2} = \sqrt{8^2 + (-6)^2} = \sqrt{64 + 36} = 10

Exam­ple 2. Find the dis­tance from the ori­gin to (−7,24)(-7, 24).

(−7)2+242=49+576=625=25\sqrt{(-7)^2 + 24^2} = \sqrt{49 + 576} = \sqrt{625} = 25

This is worth remem­ber­ing on its own: the dis­tance of (x,y)(x, y) from the ori­gin is always x2+y2\sqrt{x^2 + y^2}.

Exam­ple 3. Find the three sides of the tri­an­gle with ver­tices D(1,2)D(1, 2), E(7,2)E(7, 2) and F(4,8)F(4, 8).

DE=6DE = 6 (hor­i­zon­tal). EF=(4−7)2+(8−2)2=9+36=45EF = \sqrt{(4 - 7)^2 + (8 - 2)^2} = \sqrt{9 + 36} = \sqrt{45}. FD=(1−4)2+(2−8)2=9+36=45FD = \sqrt{(1 - 4)^2 + (2 - 8)^2} = \sqrt{9 + 36} = \sqrt{45}.

Two sides come out equal, so the tri­an­gle is isosce­les.

Triangle with vertices D(1, 2), E(7, 2) and F(4, 8) on a grid; the base DE is 6 and the sides EF and FD are each root 45, marked equal.
Tri­an­gle DEF has two equal sides, so it is isosce­les.

Test­ing a shape

Once you can find dis­tances, you can answer quite a few ques­tions about a shape with­out draw­ing it.

Isosce­les or equi­lat­eral: com­pare the three sides and see how many match.

Right-angled: check whether the squares of two sides add up to the square of the third.

Collinear: three points lie on one line exactly when the two shorter dis­tances add up to the longest one.

Exam­ple 4. Are (−2,−1)(-2, -1), (1,1)(1, 1) and (7,5)(7, 5) collinear?

9+4=13\sqrt{9 + 4} = \sqrt{13}; 36+16=52=213\sqrt{36 + 16} = \sqrt{52} = 2\sqrt{13}; 81+36=117=313\sqrt{81 + 36} = \sqrt{117} = 3\sqrt{13}. Since 13+213=313\sqrt{13} + 2\sqrt{13} = 3\sqrt{13}, the answer is yes.

Exam­ple 5. Show that (3,0)(3, 0), (6,4)(6, 4) and (−1,3)(-1, 3) form a right tri­an­gle.

Work with the squares of the sides: (3)2+(4)2=25(3)^2 + (4)^2 = 25; (7)2+(1)2=50(7)^2 + (1)^2 = 50; (4)2+(3)2=25(4)^2 + (3)^2 = 25. Since 25+25=5025 + 25 = 50, the angle at (3,0)(3, 0) is a right angle. As a bonus, the two legs are equal, so it is a right isosce­les tri­an­gle.

Exam­ple 6. Do (5,12)(5, 12), (−12,5)(-12, 5) and (0,13)(0, 13) all lie on one cir­cle cen­tred at the ori­gin?

Dis­tances from OO: 25+144=13\sqrt{25 + 144} = 13, 144+25=13\sqrt{144 + 25} = 13, 1313. All three points are 1313 from OO, so yes, they lie on the cir­cle of radius 1313 cen­tred at OO.

The mid­point

Find­ing the point halfway along a seg­ment is even eas­ier. For the seg­ment from (x1,y1)(x_1, y_1) to (x2,y2)(x_2, y_2), the coor­di­nates of the halfway point are just the aver­ages.

M=(x1+x22,y1+y22)\displaystyle M = \left(\frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2}\right)

Why does this work? Going from the first point to the sec­ond, xx changes by x2−x1x_2 - x_1. At the halfway mark it has changed by half of that, giv­ing x1+x2−x12=x1+x22\displaystyle x_1 + \frac{x_2 - x_1}{2} = \frac{x_1 + x_2}{2}. The same rea­son­ing works for yy.

Exam­ple 7. Mid­point of (−4,9)(-4, 9) and (6,−1)(6, -1): (−4+62,9+(−1)2)=(1,4)\displaystyle \left(\frac{-4 + 6}{2}, \frac{9 + (-1)}{2}\right) = (1, 4).

Segment from (-4, 9) to (6, -1) with midpoint M(1, 4); dashed steps show x rising 5 and y falling 5 on each half of the segment.
M(1, 4) is halfway from (-4, 9) to (6, -1).

Exam­ple 8. M(2,−3)M(2, -3) is the mid­point of A(−5,1)A(-5, 1) and BB. Find BB.

−5+x2=2\displaystyle \frac{-5 + x}{2} = 2 gives x=9x = 9; 1+y2=−3\displaystyle \frac{1 + y}{2} = -3 gives y=−7y = -7. So B=(9,−7)B = (9, -7).

Prac­tice

  1. Find the dis­tance between (a) (1,1)(1, 1) and (4,5)(4, 5); (b) (−6,2)(-6, 2) and (6,−3)(6, -3); (c) (0,0)(0, 0) and (−9,−12)(-9, -12).
  2. Show that the tri­an­gle with ver­tices (0,3)(0, 3), (4,0)(4, 0) and (4,6)(4, 6) is isosce­les.
  3. Are (2,1)(2, 1), (5,3)(5, 3) and (11,7)(11, 7) collinear?
  4. Show that (1,1)(1, 1), (4,1)(4, 1) and (1,5)(1, 5) are the ver­tices of a right tri­an­gle and find its hypotenuse.
  5. Which of (−8,6)(-8, 6), (9,4)(9, 4) and (0,−10)(0, -10) lie on the cir­cle of radius 1010 cen­tred at the ori­gin? Which is inside it?
  6. Find the mid­point of (7,−2)(7, -2) and (−3,8)(-3, 8).
  7. M(0,5)M(0, 5) is the mid­point of P(−6,2)P(-6, 2) and QQ. Find QQ.
  8. The ver­tices of a square are (2,1)(2, 1), (−1,2)(-1, 2), (−2,−1)(-2, -1) and (1,−2)(1, -2) in order. Ver­ify that all four sides are equal and that the two diag­o­nals are equal, and find the area.

Answers

Show answers
  1. (a) 55. (b) 144+25=13\sqrt{144 + 25} = 13. (c) 1515.
  2. Sides: 16+9=5\sqrt{16 + 9} = 5, 66, 16+9=5\sqrt{16 + 9} = 5. Two equal sides.
  3. 13\sqrt{13}, 52=213\sqrt{52} = 2\sqrt{13}, 117=313\sqrt{117} = 3\sqrt{13}. Yes.
  4. Sides 33, 44 and 55; 9+16=259 + 16 = 25. Hypotenuse 55, between (4,1)(4, 1) and (1,5)(1, 5).
  5. Dis­tances from OO: 1010, 97≈9.85\sqrt{97} \approx 9.85, 1010. The first and third are on the cir­cle; (9,4)(9, 4) is inside.
  6. (2,3)(2, 3).
  7. Q=(6,8)Q = (6, 8).
  8. Every side is 9+1=10\sqrt{9 + 1} = \sqrt{10}. Diag­o­nals: (2,1)(2, 1) to (−2,−1)(-2, -1) is 16+4=20\sqrt{16 + 4} = \sqrt{20}; (−1,2)(-1, 2) to (1,−2)(1, -2) is 4+16=20\sqrt{4 + 16} = \sqrt{20}. Area =(10)2=10= (\sqrt{10})^2 = 10 square units.