Why this mat­ters

To pin down a line in space, you need just two things: one point on it and the direc­tion it runs in. So we start by learn­ing to describe a direc­tion, using direc­tion cosines and direc­tion ratios. Then we write the equa­tion of a line in vec­tor and Carte­sian form, and finally we work out the angle between two lines.

Direc­tion cosines and ratios

If a line makes angles α,β,γ\alpha, \beta, \gamma with the axes, its direc­tion cosines are l=cos⁡αl = \cos\alpha, m=cos⁡βm = \cos\beta, n=cos⁡γn = \cos\gamma, with l2+m2+n2=1l^2 + m^2 + n^2 = 1. Any num­bers a,b,ca, b, c in the same pro­por­tion are called direc­tion ratios, and you can get back to the cosines using l=±aa2+b2+c2\displaystyle l = \pm\tfrac{a}{\sqrt{a^2 + b^2 + c^2}}, etc.

A line from the origin in 3D space making angles alpha, beta and gamma with the x-, y- and z-axes; the direction cosines are l = cos alpha, m = cos beta, n = cos gamma.
The angles a line makes with the three axes give its direc­tion cosines.

The line through P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) has direc­tion ratios x2−x1,y2−y1,z2−z1x_2 - x_1, y_2 - y_1, z_2 - z_1. Just sub­tract the coor­di­nates.

Exam­ple 1. For the line through (2,−1,3)(2, -1, 3) and (4,1,2)(4, 1, 2), the ratios are 2,2,−12, 2, -1 and the cosines are 23,23,−13\displaystyle \tfrac{2}{3}, \tfrac{2}{3}, -\tfrac{1}{3}.

Exam­ple 2. A(3,0,1)A(3, 0, 1), B(5,2,4)B(5, 2, 4), C(9,6,10)C(9, 6, 10): ratios of ABAB are 2,2,32, 2, 3 and of BCBC are 4,4,64, 4, 6, and these are pro­por­tional, so the three points lie on one line.

Points A(3, 0, 1), B(5, 2, 4) and C(9, 6, 10) plotted in 3D on one straight line; segment AB has direction ratios 2, 2, 3 and segment BC has 4, 4, 6.
AB and BC have pro­por­tional direc­tion ratios, so A, B and C lie on one line.

Equa­tion of a line

The line through the point with posi­tion vec­tor a⃗\vec a, run­ning par­al­lel to b⃗\vec b, is

r⃗=a⃗+λb⃗.\vec r = \vec a + \lambda\vec b.

In Carte­sian form, the line through (x1,y1,z1)(x_1, y_1, z_1) with direc­tion ratios a,b,ca, b, c is

x−x1a=y−y1b=z−z1c.\displaystyle \frac{x - x_1}{a} = \frac{y - y_1}{b} = \frac{z - z_1}{c}.

If you are given two points instead, sim­ply take b⃗=a⃗2−a⃗1\vec b = \vec a_2 - \vec a_1.

Exam­ple 3. The line through (1,−2,4)(1, -2, 4) par­al­lel to 3i^+j^−2k^3\hat i + \hat j - 2\hat k is r⃗=i^−2j^+4k^+λ(3i^+j^−2k^)\vec r = \hat i - 2\hat j + 4\hat k + \lambda(3\hat i + \hat j - 2\hat k), or in Carte­sian form x−13=y+21=z−4−2\displaystyle \tfrac{x - 1}{3} = \tfrac{y + 2}{1} = \tfrac{z - 4}{-2}.

Exam­ple 4. The Carte­sian line 2x−46=y+12=3−z3\displaystyle \tfrac{2x - 4}{6} = \tfrac{y + 1}{2} = \tfrac{3 - z}{3} is not in stan­dard form yet, and that is a com­mon trap. Rewrite it first as x−23=y+12=z−3−3\displaystyle \tfrac{x - 2}{3} = \tfrac{y + 1}{2} = \tfrac{z - 3}{-3}. Now you can read off the point (2,−1,3)(2, -1, 3) and the ratios 3,2,−33, 2, -3.

Angle between two lines

If the lines have direc­tion vec­tors b⃗1\vec b_1 and b⃗2\vec b_2, with ratios a1,b1,c1a_1, b_1, c_1 and a2,b2,c2a_2, b_2, c_2, then

cos⁡θ=∣a1a2+b1b2+c1c2∣a12+b12+c12a22+b22+c22.\displaystyle \cos\theta = \frac{\lvert a_1a_2 + b_1b_2 + c_1c_2 \rvert}{\sqrt{a_1^2 + b_1^2 + c_1^2}\sqrt{a_2^2 + b_2^2 + c_2^2}}.

Two spe­cial cases are worth remem­ber­ing. The lines are per­pen­dic­u­lar when a1a2+b1b2+c1c2=0a_1a_2 + b_1b_2 + c_1c_2 = 0, and par­al­lel when their ratios are pro­por­tional.

Exam­ple 5. Take lines with ratios 1,2,21, 2, 2 and 2,−2,12, -2, 1: cos⁡θ=∣2−4+2∣9=0\displaystyle \cos\theta = \tfrac{\lvert 2 - 4 + 2 \rvert}{9} = 0, so they are per­pen­dic­u­lar.

Exam­ple 6. For ratios 3,4,03, 4, 0 and 0,3,40, 3, 4 we get cos⁡θ=1225\displaystyle \cos\theta = \tfrac{12}{25}.

Prac­tice

  1. Find the direc­tion cosines of the line with ratios 6,−2,36, -2, 3.
  2. Find the direc­tion cosines of the line through (−1,2,5)(-1, 2, 5) and (3,0,1)(3, 0, 1).
  3. Show that (1,−1,2)(1, -1, 2), (3,3,0)(3, 3, 0), (−2,−7,5)(-2, -7, 5) are collinear.
  4. A line makes equal angles with all three axes. Find its direc­tion cosines.
  5. Find the vec­tor and Carte­sian equa­tions of the line through (2,0,−3)(2, 0, -3) par­al­lel to i^−4j^+5k^\hat i - 4\hat j + 5\hat k.
  6. Find the Carte­sian equa­tion of the line through (1,2,3)(1, 2, 3) and (4,0,−1)(4, 0, -1).
  7. Write x+32=4−y5=3z+13\displaystyle \tfrac{x + 3}{2} = \tfrac{4 - y}{5} = \tfrac{3z + 1}{3} in stan­dard form and give a point on it and its direc­tion.
  8. Find the angle between r⃗=i^+λ(2i^+j^+2k^)\vec r = \hat i + \lambda(2\hat i + \hat j + 2\hat k) and r⃗=3j^+μ(i^+2j^−2k^)\vec r = 3\hat j + \mu(\hat i + 2\hat j - 2\hat k).
  9. Find pp so that the lines x−13=y−22p=z−32\displaystyle \tfrac{x - 1}{3} = \tfrac{y - 2}{2p} = \tfrac{z - 3}{2} and x−13p=y−11=z−6−5\displaystyle \tfrac{x - 1}{3p} = \tfrac{y - 1}{1} = \tfrac{z - 6}{-5} are per­pen­dic­u­lar.
  10. Show that the line through (2,3,4)(2, 3, 4) and (4,7,8)(4, 7, 8) is par­al­lel to the line through (0,1,2)(0, 1, 2) and (1,3,4)(1, 3, 4).

Answers

Show answers
  1. 67,−27,37\displaystyle \tfrac{6}{7}, -\tfrac{2}{7}, \tfrac{3}{7}.
  2. The ratios are 4,−2,−44, -2, -4, giv­ing 23,−13,−23\displaystyle \tfrac{2}{3}, -\tfrac{1}{3}, -\tfrac{2}{3}.
  3. The ratios 2,4,−22, 4, -2 and −5,−10,5-5, -10, 5 are pro­por­tional.
  4. Each one is ±13\displaystyle \pm\tfrac{1}{\sqrt{3}}.
  5. r⃗=2i^−3k^+λ(i^−4j^+5k^)\vec r = 2\hat i - 3\hat k + \lambda(\hat i - 4\hat j + 5\hat k); x−21=y−4=z+35\displaystyle \tfrac{x - 2}{1} = \tfrac{y}{-4} = \tfrac{z + 3}{5}.
  6. x−13=y−2−2=z−3−4\displaystyle \tfrac{x - 1}{3} = \tfrac{y - 2}{-2} = \tfrac{z - 3}{-4}.
  7. x+32=y−4−5=z+1/31\displaystyle \tfrac{x + 3}{2} = \tfrac{y - 4}{-5} = \tfrac{z + 1/3}{1}, with point (−3,4,−13)\displaystyle (-3, 4, -\tfrac{1}{3}), ratios 2,−5,12, -5, 1.
  8. cos⁡θ=∣2+2−4∣9=0\displaystyle \cos\theta = \tfrac{\lvert 2 + 2 - 4 \rvert}{9} = 0, so the angle is 90∘90^\circ.
  9. We need 9p+2p−10=09p + 2p - 10 = 0, so p=1011\displaystyle p = \tfrac{10}{11}.
  10. The ratios 2,4,42, 4, 4 and 1,2,21, 2, 2 are pro­por­tional.