Direction cosines and direction ratios

Every line in three-dimensional space has an orientation, and direction cosines and direction ratios are the two ways to pin that orientation down as numbers. Direction cosines are the cosines of the angles a line makes with the positive xx-, yy-, and zz-axes; direction ratios are any three numbers proportional to them. Together they turn a geometric picture into algebra that feeds directly into the rest of the Three-Dimensional Geometry chapter — the equation of a line, the angle between two lines, and the shortest distance between skew lines all start from a set of direction cosines or ratios. This section leans on Vector Algebra, specifically the dot product and the magnitude of a vector, so those ideas should already feel familiar. The core skill is converting freely between the two representations: direction ratios are quick to read off from coordinates or a given vector, while direction cosines are the "normalised," ready-to-use version that behaves like the components of a unit vector.

The core insight

Direction cosines l,m,nl, m, n are the cosines of a line's angles with the coordinate axes and always satisfy l2+m2+n2=1l^2+m^2+n^2=1, while direction ratios are any set of numbers proportional to l,m,nl, m, n that becomes the direction cosines once divided by its own magnitude.

The core idea

A directed line LL makes angles α\alpha, β\beta, γ\gamma with the positive xx-, yy-, zz-axes. Its direction cosines are simply the cosines of those angles:

l=cos⁡α,m=cos⁡β,n=cos⁡γl = \cos\alpha, \quad m = \cos\beta, \quad n = \cos\gamma

where: α,β,γ\alpha, \beta, \gamma are the angles the line makes with the xx-, yy-, zz-axes respectively, and l,m,nl, m, n are the corresponding direction cosines. Because (l,m,n)(l, m, n) are exactly the components of the unit vector pointing along the line, they obey the identity that anchors this whole topic:

l2+m2+n2=1l^2 + m^2 + n^2 = 1

Any three numbers a,b,ca, b, c that are merely proportional to l,m,nl, m, n — that is, a=λla = \lambda l, b=λmb = \lambda m, c=λnc = \lambda n for some nonzero λ\lambda — are called direction ratios. Direction ratios are easy to obtain (straight from coordinates, from the components of a vector along the line, or from the coefficients in an equation), but unlike direction cosines they are not unique: any nonzero multiple of a valid triple is equally valid. Direction cosines, by contrast, are unique up to an overall sign, because an undirected line can be traversed in two opposite senses, giving (l,m,n)(l, m, n) and (−l,−m,−n)(-l, -m, -n).

Figure
A line through the origin making angle gamma with the z axis, with its foot dropped to the xy plane and the unit direction vector labelled l m n
Direction cosines as the components of a unit vector x y z O P (l, m, n) gamma l = cos alpha, m = cos beta, n = cos gamma, and l squared + m squared + n squared = 1

To convert direction ratios a,b,ca, b, c into direction cosines, divide by the magnitude:

l=aa2+b2+c2,m=ba2+b2+c2,n=ca2+b2+c2l = \dfrac{a}{\sqrt{a^2+b^2+c^2}}, \qquad m = \dfrac{b}{\sqrt{a^2+b^2+c^2}}, \qquad n = \dfrac{c}{\sqrt{a^2+b^2+c^2}}

where: a,b,ca, b, c are any given direction ratios and a2+b2+c2\sqrt{a^2+b^2+c^2} is their magnitude. A useful special case worth memorising: a line parallel to the xx-axis has direction cosines (1,0,0)(1, 0, 0); parallel to the yy-axis, (0,1,0)(0, 1, 0); parallel to the zz-axis, (0,0,1)(0, 0, 1). Direction cosines are the "cleaned up" version precisely because they can be plugged directly into formulas expecting a unit vector — for instance the cosine of the angle between two lines with direction cosines (l1,m1,n1)(l_1,m_1,n_1) and (l2,m2,n2)(l_2,m_2,n_2) is simply l1l2+m1m2+n1n2l_1l_2+m_1m_2+n_1n_2, with no extra normalising step. Direction ratios always need that extra step first.

Derivation AWhy direction cosines satisfy l squared plus m squared plus n squared equals 1

The goal is to show, using nothing beyond the distance formula and the definition of direction cosines as cosines of angles with the axes, that any line's direction cosines ll, mm, nn must satisfy l2+m2+n2=1l^2+m^2+n^2=1 — the single identity that every direction-cosine problem in this chapter ultimately relies on.

Step 1. Set up the line through the origin OO and let it pass through a point P(x,y,z)P(x, y, z). Its distance from the origin is r=x2+y2+z2r = \sqrt{x^2+y^2+z^2} by the distance formula.

Step 2. Drop a perpendicular from PP to the xx-axis. The right triangle formed shows that the angle α\alpha between OPOP and the xx-axis satisfies cos⁡α=x/r\cos\alpha = x/r, since xx is the projection of OPOP onto the xx-axis and rr is the length of OPOP. The same reasoning for the yy- and zz-axes gives cos⁡β=y/r\cos\beta = y/r and cos⁡γ=z/r\cos\gamma = z/r.

Step 3. By definition l=cos⁡αl = \cos\alpha, m=cos⁡βm = \cos\beta, n=cos⁡γn = \cos\gamma, so l=x/rl = x/r, m=y/rm = y/r, n=z/rn = z/r. Square each and add: l2+m2+n2=x2r2+y2r2+z2r2=x2+y2+z2r2l^2+m^2+n^2 = \dfrac{x^2}{r^2}+\dfrac{y^2}{r^2}+\dfrac{z^2}{r^2} = \dfrac{x^2+y^2+z^2}{r^2}.

Step 4. But x2+y2+z2=r2x^2+y^2+z^2 = r^2 by the very definition of rr in Step 1, so the fraction collapses to r2/r2=1r^2/r^2 = 1. Hence l2+m2+n2=1l^2+m^2+n^2=1 for every line, and (l,m,n)(l, m, n) is exactly the unit vector along the line from OO toward PP.

Worked example

Problem. A line has direction ratios 2,−3,62, -3, 6. Find its direction cosines and the angle it makes with the zz-axis.

Step 1. Compute the magnitude of (a,b,c)=(2,−3,6)(a, b, c) = (2, -3, 6): 22+(−3)2+62=4+9+36=49=7\sqrt{2^2+(-3)^2+6^2} = \sqrt{4+9+36} = \sqrt{49} = 7.

Step 2. Divide each direction ratio by this magnitude to get the direction cosines: l=27l = \dfrac{2}{7}, m=−37m = \dfrac{-3}{7}, n=67n = \dfrac{6}{7}.

Step 3. Check the identity as a sanity test: l2+m2+n2=449+949+3649=4949=1l^2+m^2+n^2 = \dfrac{4}{49}+\dfrac{9}{49}+\dfrac{36}{49} = \dfrac{49}{49} = 1, confirming the values are genuine direction cosines.

Step 4. The angle with the zz-axis is γ=cos⁡−1(n)=cos⁡−1 ⁣(67)≈31.0∘\gamma = \cos^{-1}(n) = \cos^{-1}\!\left(\dfrac{6}{7}\right) \approx 31.0^\circ, a fairly small tilt away from the zz-axis, consistent with n=6/7n = 6/7 being the largest of the three cosines.

The direction cosines are (27,−37,67)\left(\dfrac{2}{7}, \dfrac{-3}{7}, \dfrac{6}{7}\right), and the line makes an angle of about 31.0∘31.0^\circ with the zz-axis.

Competitive stretch

If a student mistakenly treats the raw direction ratios 2,−3,62, -3, 6 as direction cosines without normalising, the identity check fails immediately: 22+(−3)2+62=49≠12^2+(-3)^2+6^2 = 49 \neq 1. That single check is the fastest way to catch this very common slip before it propagates into an angle or distance calculation.

Common traps

  • Using direction ratios directly in the identity. Only direction cosines satisfy l2+m2+n2=1l^2+m^2+n^2=1; direction ratios generally do not, so always normalise first.
  • Forgetting the sign ambiguity. A line has no preferred direction, so both (l,m,n)(l,m,n) and (−l,−m,−n)(-l,-m,-n) are valid direction cosines for it; a directed ray, however, fixes the sign.
  • Blurring "line" and "vector". A vector has a definite direction, so its direction cosines are fixed once the vector is chosen; a line's direction cosines are only fixed up to sign.
  • Arithmetic slip under the square root. A sign error while computing a2+b2+c2\sqrt{a^2+b^2+c^2} throws off every later step — always verify l2+m2+n2=1l^2+m^2+n^2=1 at the end.

Ask the tutor: Want to see how these direction cosines feed into the angle-between-two-lines or shortest-distance formulas coming up next in this chapter?

Why are direction ratios not unique while direction cosines are unique up to sign?

Direction ratios are only required to be proportional to the direction cosines, so any nonzero multiple of a valid triple — 2,−3,62,-3,6 or 4,−6,124,-6,12 or −2,3,−6-2,3,-6 — describes the same line equally well. Direction cosines are pinned down further, by the extra requirement l2+m2+n2=1l^2+m^2+n^2=1, which fixes their size completely. The only freedom left is the overall sign, because a line (unlike a ray) can be walked in either of two opposite senses.

What is the fastest way to convert direction ratios into direction cosines?

Find the magnitude a2+b2+c2\sqrt{a^2+b^2+c^2} of the given direction ratios a,b,ca, b, c, then divide each ratio by that magnitude. The three results are your direction cosines. Always finish by checking that their squares add to 11 — if they do not, you have made an arithmetic error somewhere in the magnitude or the division.

Do direction cosines of a line and of a vector along it always match?

If you pick a specific vector along the line, its direction cosines are fixed by that vector's components, with no sign ambiguity — the vector clearly points one way. The line itself, however, has no built-in direction, so its direction cosines are only defined up to the overall sign (l,m,n)(l,m,n) versus (−l,−m,−n)(-l,-m,-n). A vector along the line gives you one of those two valid choices, not the line's full set of possibilities.

Before this

Where this leads