Three-Dimensional Geometry • Topic 1 of 4

Direction Cosines & Direction Ratios

Every line in space points in a definite direction, and the cleanest way to record that direction with numbers is through its direction cosines. If a directed line makes angles $\alpha,\beta,\gamma$ with the positive $x$, $y$ and $z$ axes, then its direction cosines are

$$l=\cos\alpha,\qquad m=\cos\beta,\qquad n=\cos\gamma.$$

These three numbers travel together as an ordered triple $(l,m,n)$. Reversing the direction of the line replaces every angle by its supplement, so the direction cosines become $(-l,-m,-n)$. An undirected line therefore has two sets of direction cosines, equal and opposite; we usually quote either one.

The fundamental identity

The single most important fact in this whole topic is that direction cosines are never independent — they always satisfy

$$l^2+m^2+n^2=1.$$

This follows from dropping a perpendicular: if a point on the line at distance $r$ from the origin has coordinates $(x,y,z)$, then $x=lr,\ y=mr,\ z=nr$, and $x^2+y^2+z^2=r^2$ forces $l^2+m^2+n^2=1$. The identity is both a check (any claimed triple of cosines must satisfy it) and a tool (given two cosines, the third is fixed up to sign).

Direction ratios

In practice we rarely know the cosines directly; we know three numbers proportional to them. Any three numbers $a,b,c$ (not all zero) that are proportional to $l,m,n$ are called direction ratios (DRs) of the line. Unlike cosines, direction ratios are not unique: if $(a,b,c)$ is a set of DRs, so is $(ka,kb,kc)$ for any non-zero $k$. They carry the direction but not the scale.

From ratios to cosines

To turn direction ratios into direction cosines, divide each by the magnitude $\sqrt{a^2+b^2+c^2}$:

$$l=\dfrac{a}{\sqrt{a^2+b^2+c^2}},\quad m=\dfrac{b}{\sqrt{a^2+b^2+c^2}},\quad n=\dfrac{c}{\sqrt{a^2+b^2+c^2}}.$$

The $\pm$ sign on the square root reflects the two possible directions of the line. Conversely, the direction cosines are themselves a valid (and the unique normalised) set of direction ratios, because $l:m:n=a:b:c$.

Direction ratios from two points

The most common way a line is handed to you is via two points on it. The line through $A(x_1,y_1,z_1)$ and $B(x_2,y_2,z_2)$ has direction ratios equal to the coordinate differences:

$$\big(x_2-x_1,\ y_2-y_1,\ z_2-z_1\big).$$

Its direction cosines follow by dividing these by $AB=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$.

Direction cosines of the axes

AxisAngles with $x,y,z$Direction cosines
$x$-axis$0^\circ,90^\circ,90^\circ$$(1,0,0)$
$y$-axis$90^\circ,0^\circ,90^\circ$$(0,1,0)$
$z$-axis$90^\circ,90^\circ,0^\circ$$(0,0,1)$

Collinearity via direction ratios. Three points $A,B,C$ are collinear precisely when $\vec{AB}$ and $\vec{AC}$ have proportional direction ratios — that is, the two lines they determine point the same way. This is far quicker than the distance test and is the standard exam method.

Deeper Insight — why direction cosines are the "address" of a direction. Direction ratios tell you which way a line points but leave the scale free; direction cosines pin down the same information in a canonical, scale-free form because the identity $l^2+m^2+n^2=1$ removes the one remaining degree of freedom. That is exactly why every later formula in this chapter — angle between lines, the projection of a segment, the shortest distance — can be written in terms of cosines or, equivalently, of any direction ratios. Get comfortable sliding between the two: think in ratios while computing (no square roots), then normalise to cosines only when an angle or a unit vector is actually required.

A 3D axis frame with a position vector OP making angles alpha, beta and gamma with the x, y and z axes; direction cosines are l=cos alpha, m=cos beta, n=cos gamma. Direction Cosines of a Line OP x y z O P OP γ β α l = cosα, m = cosβ, n = cosγ l² + m² + n² = 1
1
Worked Example
Find the direction cosines of a line with direction ratios $1,2,2$.
Solution
  1. Magnitude $=\sqrt{1^2+2^2+2^2}=\sqrt{9}=3$.
  2. Divide each ratio by $3$: $l=\tfrac13,\ m=\tfrac23,\ n=\tfrac23$.
  3. Check: $l^2+m^2+n^2=\dfrac{1+4+4}{9}=1.$ ✓

Answer: $\left(\tfrac13,\tfrac23,\tfrac23\right)$.

2
Worked Example
Find direction ratios of the line joining $A(1,2,3)$ and $B(4,5,6)$.
Solution
  1. Subtract coordinates: $(4-1,\ 5-2,\ 6-3)=(3,3,3)$.
  2. Direction ratios may be scaled, so divide by $3$.

Answer: DRs are $(3,3,3)$, or simplified $(1,1,1)$.

3
Worked Example
A line makes equal angles with the three axes. Find its direction cosines.
Solution
  1. Equal angles means $l=m=n$.
  2. Substitute in the identity: $l^2+l^2+l^2=1\Rightarrow 3l^2=1$.
  3. So $l=\pm\dfrac{1}{\sqrt3}$.

Answer: $\left(\pm\tfrac{1}{\sqrt3},\pm\tfrac{1}{\sqrt3},\pm\tfrac{1}{\sqrt3}\right)$; the angle is $\cos^{-1}\!\left(\tfrac{1}{\sqrt3}\right)\approx 54.7^\circ$.

4
Worked Example
Can $\tfrac12,\tfrac12,\tfrac12$ be the direction cosines of a line?
Solution
  1. Test the fundamental identity: $\left(\tfrac12\right)^2+\left(\tfrac12\right)^2+\left(\tfrac12\right)^2=\tfrac34$.
  2. Since $\tfrac34\ne 1$, the identity fails.

Answer: No — direction cosines must satisfy $l^2+m^2+n^2=1$.

5
Worked Example
A line makes angles $90^\circ,60^\circ,30^\circ$ with the $x,y,z$ axes. Find its direction cosines and verify them.
Solution
  1. $l=\cos 90^\circ=0$.
  2. $m=\cos 60^\circ=\tfrac12$.
  3. $n=\cos 30^\circ=\tfrac{\sqrt3}{2}$.
  4. Check: $0+\tfrac14+\tfrac34=1.$ ✓

Answer: $\left(0,\ \tfrac12,\ \tfrac{\sqrt3}{2}\right)$.

6
Worked Example
Find the direction cosines of the line joining $P(-2,4,-5)$ and $Q(1,2,3)$.
Solution
  1. DRs $=(1-(-2),\ 2-4,\ 3-(-5))=(3,-2,8)$.
  2. Magnitude $=\sqrt{3^2+(-2)^2+8^2}=\sqrt{9+4+64}=\sqrt{77}$.
  3. Divide each ratio by $\sqrt{77}$.

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

7
Worked Example
If a line has direction ratios $2,-1,-2$, find its direction cosines.
Solution
  1. Magnitude $=\sqrt{2^2+(-1)^2+(-2)^2}=\sqrt{4+1+4}=3$.
  2. Divide each by $3$.

Answer: $\left(\tfrac23,\ -\tfrac13,\ -\tfrac23\right)$.

8
Worked Example
Show that the points $A(2,3,-4),\ B(1,-2,3),\ C(3,8,-11)$ are collinear.
Solution
  1. DRs of $AB=(1-2,\ -2-3,\ 3-(-4))=(-1,-5,7)$.
  2. DRs of $AC=(3-2,\ 8-3,\ -11-(-4))=(1,5,-7)$.
  3. Compare: $(1,5,-7)=-1\times(-1,-5,7)$, so the ratios are proportional.
  4. Both segments share point $A$ and point the same way.

Answer: The points are collinear, since $\vec{AB}$ and $\vec{AC}$ have proportional direction ratios.

9
Worked Example
A line makes angles $90^\circ,135^\circ,45^\circ$ with the $x,y,z$ axes. Find its direction cosines.
Solution
  1. $l=\cos 90^\circ=0$.
  2. $m=\cos 135^\circ=-\tfrac{1}{\sqrt2}$.
  3. $n=\cos 45^\circ=\tfrac{1}{\sqrt2}$.
  4. Check: $0+\tfrac12+\tfrac12=1.$ ✓

Answer: $\left(0,\ -\tfrac{1}{\sqrt2},\ \tfrac{1}{\sqrt2}\right)$.

10
Worked Example
Two of the direction cosines of a line are $l=\tfrac{1}{\sqrt2}$ and $m=\tfrac12$. Find the third.
Solution
  1. Use $l^2+m^2+n^2=1$: $\tfrac12+\tfrac14+n^2=1$.
  2. So $n^2=1-\tfrac34=\tfrac14$.
  3. Hence $n=\pm\tfrac12$ (the line has two possible directions).

Answer: $n=\pm\tfrac12$.

11
Worked Example
Find the direction cosines of the line $\vec r$ joining $A(1,0,0)$ and $B(0,1,1)$.
Solution
  1. DRs $=(0-1,\ 1-0,\ 1-0)=(-1,1,1)$.
  2. Magnitude $=\sqrt{(-1)^2+1^2+1^2}=\sqrt3$.
  3. Divide each by $\sqrt3$.

Answer: $\left(-\tfrac{1}{\sqrt3},\ \tfrac{1}{\sqrt3},\ \tfrac{1}{\sqrt3}\right)$.

Key Points

  • Direction cosines $l,m,n=\cos\alpha,\cos\beta,\cos\gamma$ are the cosines of the angles a line makes with the $x,y,z$ axes.
  • They always satisfy the identity $l^2+m^2+n^2=1$ — use it both to check a triple and to find a missing cosine (up to sign).
  • Reversing the line replaces $(l,m,n)$ by $(-l,-m,-n)$, so an undirected line has two opposite sets of cosines.
  • Direction ratios are any numbers proportional to $l,m,n$; they are not unique (any non-zero multiple works).
  • Convert ratios $a,b,c$ to cosines by dividing each by $\sqrt{a^2+b^2+c^2}$.
  • Line through two points: DRs are the coordinate differences $(x_2-x_1,\ y_2-y_1,\ z_2-z_1)$.
  • Three points are collinear when the direction ratios of $\vec{AB}$ and $\vec{AC}$ are proportional.
  • Axis direction cosines: $x$-axis $(1,0,0)$, $y$-axis $(0,1,0)$, $z$-axis $(0,0,1)$.
Tap an option to check your answer0 / 4
Q1.Direction cosines satisfy:
Explanation: The fundamental identity.
Q2.Direction cosines of a line with DRs $1,2,2$ are:
Explanation: Divide by magnitude $3$.
Q3.DRs of the line joining $(1,2,3),(4,5,6)$ are:
Explanation: Coordinate differences.
Q4.A line equally inclined to all axes has each direction cosine:
Explanation: $3l^2=1\Rightarrow l=1/\sqrt3$.