## Direction cosines

We can find the angle between two nonzero vectors using the dot product:

vec u * vec v = |vec u||vec v|cos theta qquad => qquad cos theta = (vec u * vec v)/(|vec u||vec v|).

Often, we want to determine the angle that a certain vector makes with the coordinate axes. To do this, we just put hat i, hat j, and hat k in the place of vec v one at a time and solve for the angle. Since this operation is so common, it is worthwhile to work out specific equations.

Let’s start with the x-axis. If we have a vector vec u in component form, then

cos theta = (vec u * hat i)/(|vec u||hat i|) = ([u_1,u_2,u_3] * [1,0,0])/(|vec u|(1)) = u_1/|vec u|.

When we dot vec u with one of the standard basis vectors, we are effectively choosing one of its components. Simplifying the equation for the other two axes is just as easy. To avoid confusion, we use three different Greek letters to represent the three angles:

Axis Basis Cosine Value
x hat i cos alpha u_1//|vec u|
y hat j cos beta u_2//|vec u|
z hat k cos gamma u_3//|vec u|