# Direction cosines

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

$\displaystyle \vec{u} \cdot \vec{v} = \left \lvert \vec{u} \right \rvert \left \lvert \vec{v} \right \rvert \cos{\theta} \qquad \Rightarrow \qquad \cos{\theta} = \frac{\vec{u} \cdot \vec{v}}{\left ( \left \lvert \vec{u} \mid \left \lvert \vec{v} \right \rvert \right ) \right.}$.

Often, we want to determine the angle that a certain vector makes with the coordinate axes. To do this, we just put $\displaystyle \hat{i}$, $\displaystyle \hat{j}$, and $\displaystyle \hat{k}$ in the place of $\displaystyle \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 $\displaystyle \vec{u}$ in component form, then

$\displaystyle \cos{\theta} = \frac{\vec{u} \cdot \hat{i}}{\left \lvert \vec{u} \right \rvert \left \lvert \hat{i} \right \rvert} = \frac{\left [ u_{1} , u_{2} , u_{3} \right ] \cdot \left [ 1 , 0 , 0 \right ]}{\left \lvert \vec{u} \right \rvert \left ( 1 \right )} = \frac{u_{1}}{\left \lvert \vec{u} \right \rvert}$.

When we dot $\displaystyle \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 $\displaystyle \hat{i}$ $\displaystyle \cos{\alpha}$ $\displaystyle u_{1} / \left \lvert \vec{u} \right \rvert$
y $\displaystyle \hat{j}$ $\displaystyle \cos{\beta}$ $\displaystyle u_{2} / \left \lvert \vec{u} \right \rvert$
z $\displaystyle \hat{k}$ $\displaystyle \cos{\gamma}$ $\displaystyle u_{3} / \left \lvert \vec{u} \right \rvert$