How to find direction cosines and direction angles of a vector

A vector in three dimensions makes an angle with each positive coordinate axis. We’ll find those angles from the vector’s components, then use the same idea to find a third angle when we know the first two.

Divide each component by the magnitude

For a nonzero vector a=⟨a1,a2,a3⟩, let α, β, and γ be the angles with the positive x-, y-, and z-axes. Each angle is between 0 and π radians. Dividing by the magnitude gives the unit vector in the same direction.

|a|=a12+a22+a32

Each component of that unit vector is the cosine of the angle with its axis.

cosα=a1|a|cosβ=a2|a|cosγ=a3|a|

Those three numbers are the direction cosines. Take the inverse cosine of each one to get the direction angles.

Find the direction angles of a vector

For a=⟨5,-3,1⟩, the magnitude is 25+9+1=35. Use that magnitude in all three fractions.

α=arccos(535)≈32.3°β=arccos(-335)≈120.5°γ=arccos(135)≈80.3°
The direction angle with the positive y-axis is obtuseA view in the plane of the two rays. The vector and positive y-axis share a starting point, and the angle between them is about 120.5 degrees.a+y axisβ
The negative y-component makes β larger than 90°.

Find the third angle from the other two

The direction cosines are components of a unit vector. Its length is one, so the squares of the three components add to one.

cos2α+cos2β+cos2γ=1

If α=π/3 and β=π/6, the first two squared cosines are 1/4 and 3/4.

14+34+cos2γ=1cosγ=0γ=π2

Dividing by the length also appears when we project one vector onto another. See scalar and vector projections.