Direction Cosines and Direction Ratios

If a line makes angles α,β,γ\alpha, \beta, \gamma with the positive xx-, yy-, zz-axes, its direction cosines are l=cosα,m=cosβ,n=cosγ,l2+m2+n2=1l = \cos\alpha, \quad m = \cos\beta, \quad n = \cos\gamma, \qquad l^2 + m^2 + n^2 = 1 Any triple a,b,ca, b, c proportional to l,m,nl, m, n gives direction ratios. To convert DRs to DCs, divide by a2+b2+c2\sqrt{a^2 + b^2 + c^2}: l=aa2+b2+c2,m=ba2+b2+c2,n=ca2+b2+c2l = \frac{a}{\sqrt{a^2+b^2+c^2}}, \quad m = \frac{b}{\sqrt{a^2+b^2+c^2}}, \quad n = \frac{c}{\sqrt{a^2+b^2+c^2}} DCs are unique up to an overall sign (the two senses of the line); DRs are infinitely many. For 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), one set of DRs is x2x1, y2y1, z2z1x_2 - x_1,\ y_2 - y_1,\ z_2 - z_1.

Equations of a Line

Through a point with position vector a\vec{a}, parallel to b\vec{b}: r=a+λb\vec{r} = \vec{a} + \lambda\vec{b} In cartesian form, through (x1,y1,z1)(x_1, y_1, z_1) with DRs a,b,ca, b, c: xx1a=yy1b=zz1c\frac{x - x_1}{a} = \frac{y - y_1}{b} = \frac{z - z_1}{c}

Through two points a\vec{a} and b\vec{b}: r=a+λ(ba)\vec{r} = \vec{a} + \lambda\left(\vec{b} - \vec{a}\right), i.e. use the joining vector as the direction.

Reading a cartesian equation: the standard form needs coefficient 11 on each of x,y,zx, y, z — rewrite 1x2\frac{1 - x}{2} as x12\frac{x - 1}{-2} before reading off the DRs. Rushing this step is the chapter's most common error.

Angle Between Two Lines

For lines with direction vectors b1\vec{b_1} and b2\vec{b_2}: cosθ=b1b2b1b2\cos\theta = \left\vert\frac{\vec{b_1}\cdot\vec{b_2}}{\vert\vec{b_1}\vert\vert\vec{b_2}\vert}\right\vert The modulus keeps θ\theta acute — the convention for the angle between lines. Consequences: perpendicular     a1a2+b1b2+c1c2=0\iff a_1a_2 + b_1b_2 + c_1c_2 = 0; parallel     a1a2=b1b2=c1c2\iff \frac{a_1}{a_2} = \frac{b_1}{b_2} = \frac{c_1}{c_2}.

Shortest Distance Between Two Lines

Skew lines — neither parallel nor intersecting — exist only in three dimensions, and the shortest distance is along the common perpendicular.

Skew lines r=a1+λb1\vec{r} = \vec{a_1} + \lambda\vec{b_1} and r=a2+μb2\vec{r} = \vec{a_2} + \mu\vec{b_2}: d=(b1×b2)(a2a1)b1×b2d = \frac{\left\vert\left(\vec{b_1}\times\vec{b_2}\right)\cdot\left(\vec{a_2} - \vec{a_1}\right)\right\vert}{\vert\vec{b_1}\times\vec{b_2}\vert}

Parallel lines (b1=b2=b\vec{b_1} = \vec{b_2} = \vec{b}) make that formula collapse (b×b=0\vec{b}\times\vec{b} = \vec{0}), so use d=b×(a2a1)bd = \frac{\left\vert\vec{b}\times\left(\vec{a_2} - \vec{a_1}\right)\right\vert}{\vert\vec{b}\vert}

Test d=0d = 0: the lines intersect. The five-step routine for any shortest-distance question: extract a1,b1,a2,b2\vec{a_1}, \vec{b_1}, \vec{a_2}, \vec{b_2}; check parallel or not; compute the cross product; dot with a2a1\vec{a_2} - \vec{a_1} (skew case); divide by the right magnitude.

Worked Examples — Direction Cosines and Line Equations

Example 1 — DCs from the angles

A line makes angles 9090^\circ, 6060^\circ, 3030^\circ with the xx-, yy-, zz-axes. Find its direction cosines.

Step 1 — take cosines: l=cos90=0l = \cos 90^\circ = 0, m=cos60=12m = \cos 60^\circ = \dfrac{1}{2}, n=cos30=32n = \cos 30^\circ = \dfrac{\sqrt{3}}{2}.

Step 2 — verify: 0+14+34=10 + \dfrac{1}{4} + \dfrac{3}{4} = 1.

Answer: (0,12,32)\left(0, \dfrac{1}{2}, \dfrac{\sqrt{3}}{2}\right) — the identity check is a free mark, always show it.

Example 2 — DCs from DRs

Find the direction cosines of a line with direction ratios 2,1,22, -1, 2.

Step 1 — the normaliser: 4+1+4=3\sqrt{4 + 1 + 4} = 3.

Answer: (23,13,23)\left(\dfrac{2}{3}, -\dfrac{1}{3}, \dfrac{2}{3}\right) — or the same triple with all signs flipped; both describe the line.

Example 3 — DCs of a line through two points

Find the direction cosines of the line through A(2,4,5)A(-2, 4, -5) and B(1,2,3)B(1, 2, 3).

Step 1 — DRs by subtraction: 3,2,83, -2, 8.

Step 2 — normalise: 9+4+64=77\sqrt{9 + 4 + 64} = \sqrt{77}.

Answer: (377,277,877)\left(\dfrac{3}{\sqrt{77}}, \dfrac{-2}{\sqrt{77}}, \dfrac{8}{\sqrt{77}}\right).

Example 4 — Line through a point, parallel to a vector

Find the vector and cartesian equations of the line through (5,2,4)(5, 2, -4) parallel to 3i^+2j^8k^3\hat{i} + 2\hat{j} - 8\hat{k}.

Step 1 — vector form: r=5i^+2j^4k^+λ(3i^+2j^8k^)\vec{r} = 5\hat{i} + 2\hat{j} - 4\hat{k} + \lambda\left(3\hat{i} + 2\hat{j} - 8\hat{k}\right).

Step 2 — cartesian form:

Answer: x53=y22=z+48\dfrac{x - 5}{3} = \dfrac{y - 2}{2} = \dfrac{z + 4}{-8} — note z(4)z - (-4) becomes z+4z + 4; sign slips here cost a full part.

Example 5 — Line through two points

Find the equations of the line through A(1,0,2)A(-1, 0, 2) and B(3,4,6)B(3, 4, 6).

Step 1 — direction: AB=4i^+4j^+4k^\overrightarrow{AB} = 4\hat{i} + 4\hat{j} + 4\hat{k}, and any proportional triple works — take 1,1,11, 1, 1.

Step 2 — write both forms: r=i^+2k^+λ(i^+j^+k^)\vec{r} = -\hat{i} + 2\hat{k} + \lambda\left(\hat{i} + \hat{j} + \hat{k}\right).

Answer: x+11=y1=z21\dfrac{x + 1}{1} = \dfrac{y}{1} = \dfrac{z - 2}{1} — simplifying the DRs before writing the equation keeps everything clean.

Example 6 — Reading a cartesian equation correctly

Write the direction ratios and a point on the line 1x2=y+35=2z64\dfrac{1 - x}{2} = \dfrac{y + 3}{5} = \dfrac{2z - 6}{4}.

Step 1 — force standard form: 1x2=x12\dfrac{1-x}{2} = \dfrac{x - 1}{-2} and 2z64=z32\dfrac{2z-6}{4} = \dfrac{z - 3}{2}.

Step 2 — now read off: x12=y+35=z32\frac{x - 1}{-2} = \frac{y + 3}{5} = \frac{z - 3}{2}

Answer: point (1,3,3)(1, -3, 3), DRs 2,5,2-2, 5, 2 — reading DRs before standardising would give the wrong triple 2,5,42, 5, 4.

Example 7 — A line equally inclined to the axes

Find the direction cosines of a line equally inclined to the three coordinate axes.

Step 1 — set l=m=nl = m = n: then 3l2=13l^2 = 1.

Answer: l=m=n=±13l = m = n = \pm\dfrac{1}{\sqrt{3}} — the DRs are simply 1,1,11, 1, 1.

Worked Examples — Angles and Shortest Distances

Example 8 — Angle between two lines (DRs given)

Find the angle between the lines with direction ratios 3,5,43, 5, 4 and 1,1,21, 1, 2.

Step 1 — the three ingredients: b1b2=3+5+8=16\vec{b_1}\cdot\vec{b_2} = 3 + 5 + 8 = 16, b1=50=52\vert\vec{b_1}\vert = \sqrt{50} = 5\sqrt{2}, b2=6\vert\vec{b_2}\vert = \sqrt{6}.

Step 2 — the formula: cosθ=16526=16103=8315\cos\theta = \dfrac{16}{5\sqrt{2}\cdot\sqrt{6}} = \dfrac{16}{10\sqrt{3}} = \dfrac{8\sqrt{3}}{15}.

Answer: θ=cos18315\theta = \cos^{-1}\dfrac{8\sqrt{3}}{15} — rationalise before boxing the answer.

Example 9 — Angle between two vector-form lines

Find the angle between r=a1+λ(3i^+2j^+6k^)\vec{r} = \vec{a_1} + \lambda\left(3\hat{i} + 2\hat{j} + 6\hat{k}\right) and r=a2+μ(i^+2j^+2k^)\vec{r} = \vec{a_2} + \mu\left(\hat{i} + 2\hat{j} + 2\hat{k}\right).

Step 1 — only the direction vectors matter: b1b2=3+4+12=19\vec{b_1}\cdot\vec{b_2} = 3 + 4 + 12 = 19, b1=7\vert\vec{b_1}\vert = 7, b2=3\vert\vec{b_2}\vert = 3.

Answer: θ=cos11921\theta = \cos^{-1}\dfrac{19}{21} — the points a1,a2\vec{a_1}, \vec{a_2} play no role in the angle.

Example 10 — Perpendicularity check

Show that the lines with direction ratios 2,1,22, 1, -2 and 1,2,21, 2, 2 are perpendicular.

Step 1 — the dot-product test: 2(1)+1(2)+(2)(2)=2+24=02(1) + 1(2) + (-2)(2) = 2 + 2 - 4 = 0.

Answer: the sum vanishes, so the lines are perpendicular — one line of arithmetic, full marks.

Example 11 — Shortest distance between skew lines

Find the shortest distance between r=i^+2j^+k^+λ(i^j^+k^)\vec{r} = \hat{i} + 2\hat{j} + \hat{k} + \lambda\left(\hat{i} - \hat{j} + \hat{k}\right) and r=2i^j^k^+μ(2i^+j^+2k^)\vec{r} = 2\hat{i} - \hat{j} - \hat{k} + \mu\left(2\hat{i} + \hat{j} + 2\hat{k}\right).

Step 1 — extract the four vectors: a1=(1,2,1)\vec{a_1} = (1,2,1), b1=(1,1,1)\vec{b_1} = (1,-1,1), a2=(2,1,1)\vec{a_2} = (2,-1,-1), b2=(2,1,2)\vec{b_2} = (2,1,2).

Step 2 — cross product: b1×b2=i^j^k^111212=3i^+0j^+3k^,b1×b2=32\vec{b_1}\times\vec{b_2} = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 1 & -1 & 1 \\ 2 & 1 & 2 \end{vmatrix} = -3\hat{i} + 0\hat{j} + 3\hat{k}, \qquad \vert\vec{b_1}\times\vec{b_2}\vert = 3\sqrt{2}

Step 3 — dot with a2a1=(1,3,2)\vec{a_2} - \vec{a_1} = (1, -3, -2): (3)(1)+0(3)+3(2)=9(-3)(1) + 0(-3) + 3(-2) = -9.

Step 4 — divide: d=932=32d = \dfrac{\vert -9\vert}{3\sqrt{2}} = \dfrac{3}{\sqrt{2}}.

Answer: 322\dfrac{3\sqrt{2}}{2} units.

Example 12 — Shortest distance, cartesian data

Find the shortest distance between x+17=y+16=z+11\dfrac{x + 1}{7} = \dfrac{y + 1}{-6} = \dfrac{z + 1}{1} and x31=y52=z71\dfrac{x - 3}{1} = \dfrac{y - 5}{-2} = \dfrac{z - 7}{1}.

Step 1 — extract: a1=(1,1,1)\vec{a_1} = (-1,-1,-1), b1=(7,6,1)\vec{b_1} = (7,-6,1); a2=(3,5,7)\vec{a_2} = (3,5,7), b2=(1,2,1)\vec{b_2} = (1,-2,1).

Step 2 — cross product: b1×b2=4i^6j^8k^\vec{b_1}\times\vec{b_2} = -4\hat{i} - 6\hat{j} - 8\hat{k}, with magnitude 116=229\sqrt{116} = 2\sqrt{29}.

Step 3 — dot with a2a1=(4,6,8)\vec{a_2} - \vec{a_1} = (4, 6, 8): 163664=116-16 - 36 - 64 = -116.

Step 4 — divide: d=116229=5829d = \dfrac{116}{2\sqrt{29}} = \dfrac{58}{\sqrt{29}}.

Answer: 2292\sqrt{29} units — simplify the surd fully: 5829=582929=229\frac{58}{\sqrt{29}} = \frac{58\sqrt{29}}{29} = 2\sqrt{29}.

Example 13 — Distance between parallel lines

Find the distance between r=i^+2j^4k^+λ(2i^+3j^+6k^)\vec{r} = \hat{i} + 2\hat{j} - 4\hat{k} + \lambda\left(2\hat{i} + 3\hat{j} + 6\hat{k}\right) and r=3i^+3j^5k^+μ(2i^+3j^+6k^)\vec{r} = 3\hat{i} + 3\hat{j} - 5\hat{k} + \mu\left(2\hat{i} + 3\hat{j} + 6\hat{k}\right).

Step 1 — same b\vec{b}, so use the parallel formula: a2a1=(2,1,1)\vec{a_2} - \vec{a_1} = (2, 1, -1).

Step 2 — cross product: b×(a2a1)=i^j^k^236211=9i^+14j^4k^,=293\vec{b}\times\left(\vec{a_2} - \vec{a_1}\right) = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ 2 & 3 & 6 \\ 2 & 1 & -1 \end{vmatrix} = -9\hat{i} + 14\hat{j} - 4\hat{k}, \qquad \vert\cdot\vert = \sqrt{293}

Step 3 — divide by b=7\vert\vec{b}\vert = 7:

Answer: 2937\dfrac{\sqrt{293}}{7} units — spotting that the direction vectors match (and switching formulas) is the first mark of the question.