The direction cosines of a line are the cosines of the angles it makes with the x-, y-, and z-axes. For any direction ratios (a,b,c), the direction cosines are found by dividing each by the overall magnitude:
(l,m,n)=(a2+b2+c2a,a2+b2+c2b,a2+b2+c2c)
Worked example: a coordinate axis
Write the direction cosines of the x-axis.
Solution: The x-axis points entirely along x with no y or z component, so its direction cosines are simply (1,0,0).
Worked example: a line through two points
Find the direction cosines of the line joining (1,0,0) and (0,1,1).
Solution: The direction ratios are the difference of coordinates: (0−1,1−0,1−0)=(−1,1,1). The magnitude is 1+1+1=3, so the direction cosines are:
(−31,31,31)
Worked example: from given angles
A line makes angles of 90∘, 60∘, and 30∘ with the positive x-, y-, and z-axes respectively. Find its direction cosines.
Solution: Direction cosines are literally the cosines of those angles:
(cos90∘,cos60∘,cos30∘)=(0,21,23)
Continue learning
Direction cosines (or the direction ratios behind them) are exactly what's needed to write down a line's equation in 3D.