The dis­tance from a point to a line means the short­est dis­tance, which is mea­sured along the per­pen­dic­u­lar from the point to the line. There is a neat for­mula for it, and from it come the dis­tance between two par­al­lel lines, the alti­tude and area of a tri­an­gle, and a test for whether two points lie on the same side of a line. This les­son devel­ops all of these.

The per­pen­dic­u­lar dis­tance for­mula

Result. The per­pen­dic­u­lar dis­tance from the point P(x1,y1)P(x_1, y_1) to the line ax+by+c=0ax + by + c = 0 is

d=∣ax1+by1+c∣a2+b2\displaystyle d = \frac{|ax_1 + by_1 + c|}{\sqrt{a^2 + b^2}}

In words: sub­sti­tute the point into the left side of the equa­tion, take the mod­u­lus, and divide by a2+b2\sqrt{a^2 + b^2}.

Why. Let the line cut the axes at A(−ca,0)\displaystyle A\left(-\frac{c}{a}, 0\right) and B(0,−cb)\displaystyle B\left(0, -\frac{c}{b}\right) (assume aa, bb, cc non-zero; the other cases are sim­pler). The area of tri­an­gle PABPAB can be found in two ways: as 12×AB×d\displaystyle \frac{1}{2} \times AB \times d, and from the coor­di­nates by the deter­mi­nant for­mula. Work­ing this out, the area is ∣c∣ ∣ax1+by1+c∣2∣ab∣\displaystyle \frac{|c|\,|ax_1 + by_1 + c|}{2|ab|}, while AB=∣c∣a2+b2∣ab∣\displaystyle AB = \frac{|c|\sqrt{a^2 + b^2}}{|ab|}. Equat­ing the two expres­sions for the area and can­celling gives the for­mula.

Spe­cial case. The dis­tance from the ori­gin to ax+by+c=0ax + by + c = 0 is ∣c∣a2+b2\displaystyle \frac{|c|}{\sqrt{a^2 + b^2}}.

Exam­ple 1

Find the dis­tance from (2,3)(2, 3) to the line 3x+4y−8=03x + 4y - 8 = 0.

d=∣3(2)+4(3)−8∣9+16=∣6+12−8∣5=105=2\displaystyle d = \frac{|3(2) + 4(3) - 8|}{\sqrt{9 + 16}} = \frac{|6 + 12 - 8|}{5} = \frac{10}{5} = 2

Exam­ple 2

Find kk if the dis­tance from (k,2)(k, 2) to 4x−3y+1=04x - 3y + 1 = 0 is 33.

∣4k−6+1∣5=3  ⟹  ∣4k−5∣=15  ⟹  4k−5=15 or 4k−5=−15\displaystyle \frac{|4k - 6 + 1|}{5} = 3 \implies |4k - 5| = 15 \implies 4k - 5 = 15 \text{ or } 4k - 5 = -15

So k=5k = 5 or k=−52\displaystyle k = -\frac{5}{2}. There are two such points, one on each side of the line.

Dis­tance between par­al­lel lines

Two par­al­lel lines can be writ­ten with the same xx and yy coef­fi­cients: ax+by+c1=0ax + by + c_1 = 0 and ax+by+c2=0ax + by + c_2 = 0. The dis­tance between them is

d=∣c1−c2∣a2+b2\displaystyle d = \frac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}

(Take any point on one line and find its dis­tance from the other.) Before using the for­mula, make sure the coef­fi­cients of xx and yy are the same in both equa­tions.

Exam­ple 3

Find the dis­tance between 3x+4y−8=03x + 4y - 8 = 0 and 6x+8y+9=06x + 8y + 9 = 0.

Divide the sec­ond equa­tion by 22 to match the first: 3x+4y+92=0\displaystyle 3x + 4y + \frac{9}{2} = 0. Then

d=∣−8−92∣9+16=2525=52\displaystyle d = \frac{\left|-8 - \frac{9}{2}\right|}{\sqrt{9 + 16}} = \frac{\frac{25}{2}}{5} = \frac{5}{2}

Alti­tude and area of a tri­an­gle

The alti­tude from a ver­tex is the dis­tance from that ver­tex to the line of the oppo­site side.

Exam­ple 4

In the tri­an­gle with ver­tices A(1,3)A(1, 3), B(0,0)B(0, 0), C(4,3)C(4, 3), find the alti­tude from AA and the area.

The line BCBC passes through the ori­gin with slope 34\displaystyle \frac{3}{4}, so it is 3x−4y=03x - 4y = 0. The alti­tude from AA is

∣3(1)−4(3)∣9+16=∣3−12∣5=95\displaystyle \frac{|3(1) - 4(3)|}{\sqrt{9 + 16}} = \frac{|3 - 12|}{5} = \frac{9}{5}

BC=16+9=5BC = \sqrt{16 + 9} = 5, so the area is 12×5×95=92\displaystyle \frac{1}{2} \times 5 \times \frac{9}{5} = \frac{9}{2} square units. (The deter­mi­nant for­mula from the matri­ces course gives the same: 12∣1(0−3)−3(0−4)+1(0)∣=92\displaystyle \frac{1}{2}|1(0 - 3) - 3(0 - 4) + 1(0)| = \frac{9}{2}.)

Which side of a line?

For the line ax+by+c=0ax + by + c = 0, the expres­sion ax+by+cax + by + c is zero on the line, pos­i­tive for all points on one side and neg­a­tive for all points on the other side. So:

  • two points are on the same side of the line if ax+by+cax + by + c has the same sign at both;
  • they are on oppo­site sides if the signs are dif­fer­ent.

Exam­ple 5

Are (1,1)(1, 1) and (2,−1)(2, -1) on the same side of x+2y−2=0x + 2y - 2 = 0?

At (1,1)(1, 1): 1+2−2=1>01 + 2 - 2 = 1 > 0. At (2,−1)(2, -1): 2−2−2=−2<02 - 2 - 2 = -2 < 0. The signs dif­fer, so the points are on oppo­site sides, and the line passes between them.

Prac­tice

  1. Find the dis­tance from (3,−2)(3, -2) to 4x+3y+4=04x + 3y + 4 = 0.
  2. Find the dis­tance from the ori­gin to 12x−5y+26=012x - 5y + 26 = 0.
  3. Find the dis­tance from (1,1)(1, 1) to x−y+2=0x - y + 2 = 0.
  4. Find the dis­tance between 3x−4y+7=03x - 4y + 7 = 0 and 3x−4y−13=03x - 4y - 13 = 0.
  5. Find the dis­tance between 2x+y−3=02x + y - 3 = 0 and 4x+2y+4=04x + 2y + 4 = 0.
  6. Find kk if the dis­tance from (1,k)(1, k) to 3x+4y−5=03x + 4y - 5 = 0 is 22.
  7. Are (2,3)(2, 3) and (−1,5)(-1, 5) on the same side of 2x−y+1=02x - y + 1 = 0?
  8. Is the ori­gin on the same side of x+y−4=0x + y - 4 = 0 as the point (1,5)(1, 5)?
  9. Find the area of the tri­an­gle with ver­tices (1,3)(1, 3), (0,0)(0, 0) and (4,3)(4, 3) by a dif­fer­ent method from Exam­ple 4: use the alti­tude from CC to ABAB.
  10. Find the points on the xx-axis whose dis­tance from 4x+3y−12=04x + 3y - 12 = 0 is 33.

Answers

Show answers
  1. ∣12−6+4∣5=105=2\displaystyle \frac{|12 - 6 + 4|}{5} = \frac{10}{5} = 2.
  2. 26144+25=2613=2\displaystyle \frac{26}{\sqrt{144 + 25}} = \frac{26}{13} = 2.
  3. ∣1−1+2∣2=22=2\displaystyle \frac{|1 - 1 + 2|}{\sqrt{2}} = \frac{2}{\sqrt{2}} = \sqrt{2}.
  4. ∣7−(−13)∣5=205=4\displaystyle \frac{|7 - (-13)|}{5} = \frac{20}{5} = 4.
  5. Write the sec­ond as 2x+y+2=02x + y + 2 = 0. Then d=∣−3−2∣5=55=5\displaystyle d = \frac{|-3 - 2|}{\sqrt{5}} = \frac{5}{\sqrt{5}} = \sqrt{5}.
  6. ∣3+4k−5∣5=2\displaystyle \frac{|3 + 4k - 5|}{5} = 2, so ∣4k−2∣=10|4k - 2| = 10, giv­ing 4k−2=104k - 2 = 10 or 4k−2=−104k - 2 = -10: k=3k = 3 or k=−2k = -2.
  7. At (2,3)(2, 3): 4−3+1=2>04 - 3 + 1 = 2 > 0. At (−1,5)(-1, 5): −2−5+1=−6<0-2 - 5 + 1 = -6 < 0. Oppo­site sides.
  8. At the ori­gin: −4<0-4 < 0. At (1,5)(1, 5): 1+5−4=2>01 + 5 - 4 = 2 > 0. No, they are on oppo­site sides.
  9. Here A(1,3)A(1, 3), B(0,0)B(0, 0), C(4,3)C(4, 3). ABAB is y=3xy = 3x, that is, 3x−y=03x - y = 0, and AB=10AB = \sqrt{10}. The alti­tude from CC is ∣12−3∣10=910\displaystyle \frac{|12 - 3|}{\sqrt{10}} = \frac{9}{\sqrt{10}}, so the area is 12×10×910=92\displaystyle \frac{1}{2} \times \sqrt{10} \times \frac{9}{\sqrt{10}} = \frac{9}{2} square units.
  10. For (a,0)(a, 0): ∣4a−12∣5=3\displaystyle \frac{|4a - 12|}{5} = 3, so 4a−12=±154a - 12 = \pm 15, giv­ing a=274\displaystyle a = \frac{27}{4} or a=−34\displaystyle a = -\frac{3}{4}. The points are (274,0)\displaystyle \left(\frac{27}{4}, 0\right) and (−34,0)\displaystyle \left(-\frac{3}{4}, 0\right).