Consider a line PQ with direction cosines l, m, n. Through the origin draw a line parallel to the given line and take a point R(x, y, z) on this line. From R draw a perpendicular RM on the x-axis.

Let OR = r
In right-angled triangle OMR,
∠OMR = 90° and ∠ROM = a
∴ cos α = \(\frac{OM}{OP} = \frac{x}{r}\)
⇒ l = \(\frac{x}{r}\)
⇒ x = lr
Similarly, y = mr and z = nr
Now, OR2 = x2 + y2 + z2
⇒ r2 = (lr)2 + (mr)2 + (nr)2
⇒ r2 = r2 (l2 + m2 + n2)
⇒ 1 = l2 + m2 + n2
Thus, l2 + m2 + n2 = 1