Direction cosines and ratios

Every line drifting through three-dimensional space has a "tilt" against the coordinate axes, and that tilt can be pinned down with three numbers. Point a line from the origin toward A(2,3,−1)A(2,3,-1) and it leans a certain amount toward each axis — direction cosines and direction ratios are simply two ways of writing that lean, one normalised, one raw. This short topic opens the Three-Dimensional Geometry unit of ISC Class 12 Mathematics, and every later formula in the chapter — the equation of a line, the angle between two lines, the shortest distance between skew lines — is built directly on top of it. Master the conversion between ratios and cosines, the identity they satisfy, and the cosine formula for the angle between two lines, and the rest of the chapter becomes mostly bookkeeping.

The core insight

Direction cosines l,m,nl,m,n are the cosines of the angles a line makes with the xx-, yy-, zz-axes and always satisfy l2+m2+n2=1l^2+m^2+n^2=1, while direction ratios a,b,ca,b,c are any triple proportional to them, so dividing by a2+b2+c2\sqrt{a^2+b^2+c^2} turns ratios into cosines and the same dot-product idea gives the angle between two lines.

The core idea

Take a directed line LL in space, making angles α,β,γ\alpha,\beta,\gamma with the positive xx-, yy-, zz-axes. Its direction cosines are the cosines of those angles:

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

where: l,m,nl,m,n are each confined to [−1,1][-1,1], since they are genuine cosines. They are never independent — they always obey the fundamental identity

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

so fixing any two (up to a sign choice for the third) pins the line's direction completely.

Ratios versus cosines. Any triple a,b,ca,b,c proportional to l,m,nl,m,n — that is, a=λla=\lambda l, b=λmb=\lambda m, c=λnc=\lambda n for some non-zero λ\lambda — is called a set of direction ratios. Ratios are what you read off a diagram or a pair of points without touching a square root; cosines are the normalised version you need whenever an actual angle or unit vector is wanted. Converting one to the other is one division:

l=aa2+b2+c2,m=ba2+b2+c2,n=ca2+b2+c2.l=\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}}.

where: a2+b2+c2\sqrt{a^2+b^2+c^2} is the magnitude of the ratio triple, playing the role of a normalising length.

Direction ratios from two points. For P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2), the direction ratios of line PQPQ are read off directly:

x2−x1, y2−y1, z2−z1.x_2-x_1,\ y_2-y_1,\ z_2-z_1.

No square root is needed until cosines are specifically asked for. The figure below shows a line's direction cosines as the cosines of the three angles it makes with the axes, and the equivalent, unnormalised direction ratios sitting alongside as a scaled version of the same direction.

Figure
A line through the origin making angles alpha beta gamma with the x y and z axes, its direction cosines l m n marked as the cosine of each angle
A line and the angles it makes with the axes x z y line L alpha gamma origin l = cos alpha, m = cos beta, n = cos gamma, and l squared + m squared + n squared = 1

Angle between two lines. If two lines have direction cosines l1,m1,n1l_1,m_1,n_1 and l2,m2,n2l_2,m_2,n_2, or direction ratios a1,b1,c1a_1,b_1,c_1 and a2,b2,c2a_2,b_2,c_2, the angle θ\theta between them satisfies

cos⁡θ=l1l2+m1m2+n1n2=a1a2+b1b2+c1c2a12+b12+c12 a22+b22+c22.\cos\theta = l_1l_2+m_1m_2+n_1n_2 = \frac{a_1a_2+b_1b_2+c_1c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\,\sqrt{a_2^2+b_2^2+c_2^2}}.

where: the numerator is a dot-product-style sum and the denominator is the product of the two ratio triples' magnitudes, so the formula works whether you start from cosines or from raw ratios. Two immediate special cases follow from it:

Parallel:a1a2=b1b2=c1c2,Perpendicular:a1a2+b1b2+c1c2=0.\text{Parallel:}\quad \frac{a_1}{a_2}=\frac{b_1}{b_2}=\frac{c_1}{c_2}, \qquad \text{Perpendicular:}\quad a_1a_2+b_1b_2+c_1c_2=0.

A line (as opposed to a directed ray) has direction cosines only up to an overall sign, since (l,m,n)(l,m,n) and (−l,−m,−n)(-l,-m,-n) describe the same line pointing the opposite way.

Derivation AThe angle between two lines from direction ratios

The goal is to derive the cosine formula cos⁡θ=a1a2+b1b2+c1c2a12+b12+c12a22+b22+c22\cos\theta = \dfrac{a_1a_2+b_1b_2+c_1c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\sqrt{a_2^2+b_2^2+c_2^2}} for the angle between two lines starting from nothing but the definition of direction cosines and the ordinary cosine rule already known from Class 11 trigonometry, so that the formula used in every later 3-D geometry problem is not just memorised but seen to follow from first principles.

Step 1. Represent each line by a unit vector along its direction. If line 1 has direction cosines l1,m1,n1l_1,m_1,n_1, the unit vector along it is u^1=(l1,m1,n1)\hat{u}_1=(l_1,m_1,n_1), and likewise u^2=(l2,m2,n2)\hat{u}_2=(l_2,m_2,n_2) for line 2. Both vectors have length 11 because l12+m12+n12=1l_1^2+m_1^2+n_1^2=1 and similarly for the second line — this is exactly the identity stated above, now put to use.

Step 2. Translate both lines so they pass through a common origin, which does not change the angle between them, and drop a perpendicular to form a triangle with the two unit vectors as two sides and the segment joining their tips as the third side. By the distance formula, the squared length of that third side is (l1−l2)2+(m1−m2)2+(n1−n2)2(l_1-l_2)^2+(m_1-m_2)^2+(n_1-n_2)^2.

Step 3. Apply the cosine rule to the triangle formed by u^1\hat{u}_1, u^2\hat{u}_2 and the angle θ\theta between them: the third side squared equals ∣u^1∣2+∣u^2∣2−2∣u^1∣∣u^2∣cos⁡θ=1+1−2cos⁡θ|\hat u_1|^2+|\hat u_2|^2-2|\hat u_1||\hat u_2|\cos\theta = 1+1-2\cos\theta, since both unit vectors have length 11.

Step 4. Equate the two expressions for the third side's squared length and expand the left side. (l1−l2)2+(m1−m2)2+(n1−n2)2=2−2cos⁡θ(l_1-l_2)^2+(m_1-m_2)^2+(n_1-n_2)^2 = 2-2\cos\theta expands to l12+m12+n12+l22+m22+n22−2(l1l2+m1m2+n1n2)=2−2cos⁡θl_1^2+m_1^2+n_1^2+l_2^2+m_2^2+n_2^2-2(l_1l_2+m_1m_2+n_1n_2)=2-2\cos\theta. Using l12+m12+n12=1l_1^2+m_1^2+n_1^2=1 and l22+m22+n22=1l_2^2+m_2^2+n_2^2=1, the left side becomes 2−2(l1l2+m1m2+n1n2)2-2(l_1l_2+m_1m_2+n_1n_2).

Step 5. Cancel the matching 2−2(⋅)2-2(\cdot) on both sides to read off cos⁡θ=l1l2+m1m2+n1n2\cos\theta = l_1l_2+m_1m_2+n_1n_2. Replacing li,mi,nil_i,m_i,n_i by their ratio expressions ai/ai2+bi2+ci2a_i/\sqrt{a_i^2+b_i^2+c_i^2} and so on gives the full direction-ratio version stated above, and setting cos⁡θ=0\cos\theta=0 recovers the perpendicularity condition a1a2+b1b2+c1c2=0a_1a_2+b_1b_2+c_1c_2=0 immediately.

Worked example

Find the direction cosines of the line joining A(2,3,−1)A(2,3,-1) and B(5,−1,3)B(5,-1,3), then use them to find the angle this line makes with the line through the origin having direction ratios (1,1,0)(1,1,0).

Step 1. Direction ratios of ABAB: subtract coordinates, a=5−2=3a=5-2=3, b=−1−3=−4b=-1-3=-4, c=3−(−1)=4c=3-(-1)=4.

Step 2. Magnitude: a2+b2+c2=9+16+16=41\sqrt{a^2+b^2+c^2}=\sqrt{9+16+16}=\sqrt{41}.

Step 3. Normalise to get the direction cosines: l=341l=\dfrac{3}{\sqrt{41}}, m=−441m=\dfrac{-4}{\sqrt{41}}, n=441n=\dfrac{4}{\sqrt{41}}. Check: l2+m2+n2=9+16+1641=1l^2+m^2+n^2=\dfrac{9+16+16}{41}=1, confirming the identity holds.

Step 4. Angle with the line (1,1,0)(1,1,0) through the origin, using the ratio form of the cosine formula directly on (3,−4,4)(3,-4,4) and (1,1,0)(1,1,0):

cos⁡θ=(3)(1)+(−4)(1)+(4)(0)9+16+161+1+0=−141⋅2=−182.\cos\theta=\frac{(3)(1)+(-4)(1)+(4)(0)}{\sqrt{9+16+16}\sqrt{1+1+0}}=\frac{-1}{\sqrt{41}\cdot\sqrt2}=\frac{-1}{\sqrt{82}}.

Step 5. Since cos⁡θ\cos\theta is negative, θ\theta is obtuse; the acute angle between the two lines is cos⁡−1 ⁣(182)\cos^{-1}\!\left(\dfrac{1}{\sqrt{82}}\right), and neither the parallel nor the perpendicular condition holds here since 9+16+16=41≠09+16+16=41\neq0 and the ratios 3/1,−4/1,4/03/1,-4/1,4/0 are not equal. The direction cosines of ABAB are (341,−441,441)\left(\dfrac{3}{\sqrt{41}},\dfrac{-4}{\sqrt{41}},\dfrac{4}{\sqrt{41}}\right), and the angle it makes with (1,1,0)(1,1,0) is cos⁡−1 ⁣(−182)\cos^{-1}\!\left(\dfrac{-1}{\sqrt{82}}\right), an obtuse angle.

Common traps

  • Confusing direction cosines (unique up to sign, satisfy l2+m2+n2=1l^2+m^2+n^2=1) with direction ratios (any proportional triple, no normalisation condition) — giving (3,−4,4)(3,-4,4) when cosines were asked for is an incomplete answer.
  • Getting the subtraction order wrong (Q−PQ-P instead of P−QP-Q) — this flips every ratio's sign, which represents the same line but the opposite orientation, and can flip the sign of a computed angle if not tracked carefully.
  • Forgetting the denominator's product of magnitudes in the angle formula — a common slip that produces cos⁡θ>1\cos\theta>1, an impossible value that signals an arithmetic error.
  • Mixing up parallel and perpendicular conditions — proportional ratios mean parallel, a vanishing dot-product sum means perpendicular; treating one condition as the other is a frequent conceptual error.

Ask the tutor: want to see one more angle-between-lines problem worked end to end, or a walkthrough of why the identity l2+m2+n2=1l^2+m^2+n^2=1 always holds for any direction — just ask.

Why do direction cosines need the identity l squared plus m squared plus n squared equals 1 but direction ratios do not?

Because l,m,nl,m,n are literal cosines of the angles a unit-length direction vector makes with the axes, and for any unit vector the sum of the squares of its components along perpendicular axes always equals 11 — this is really the distance formula applied to a vector of length one. Direction ratios are only proportional to l,m,nl,m,n, scaled by some factor λ\lambda, so their squares sum to λ2\lambda^2 rather than 11. That is exactly why you divide by a2+b2+c2\sqrt{a^2+b^2+c^2} to convert ratios into cosines — the division removes the scale factor and restores the unit-length condition.

If a question gives me direction ratios, do I always need to convert to direction cosines first?

No. The angle-between-lines formula, and the parallel and perpendicular conditions, all work directly on raw direction ratios without ever normalising them — that is precisely why ratios are convenient for quick computation. You only need to convert to direction cosines when the question specifically asks for cosines, or when you need a genuine unit vector along the line, for instance to write the vector form of a line's equation later in the chapter.

Why can a line have two different sets of direction cosines that look like negatives of each other?

A line by itself has no built-in direction of travel, so (l,m,n)(l,m,n) and (−l,−m,−n)(-l,-m,-n) both describe it equally well — they are the two ways of walking along the same line. This only becomes an issue if a question is careless about order: computing direction ratios as Q−PQ-P instead of P−QP-Q silently swaps you from one valid set to the other. The underlying line, its parallel and perpendicular relationships with other lines, and the unsigned angle it makes with any other line are unaffected either way.

Before this

Where this leads