Direction cosines

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

uv=uvcosθcosθ=uv(uv)\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 i^\displaystyle \hat{i}, j^\displaystyle \hat{j}, and k^\displaystyle \hat{k} in the place of v\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 u\displaystyle \vec{u} in component form, then

cosθ=ui^ui^=[u1,u2,u3][1,0,0]u(1)=u1u\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 u\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 i^\displaystyle \hat{i} cosα\displaystyle \cos{\alpha} u1/u\displaystyle u_{1} / \left \lvert \vec{u} \right \rvert
y j^\displaystyle \hat{j} cosβ\displaystyle \cos{\beta} u2/u\displaystyle u_{2} / \left \lvert \vec{u} \right \rvert
z k^\displaystyle \hat{k} cosγ\displaystyle \cos{\gamma} u3/u\displaystyle u_{3} / \left \lvert \vec{u} \right \rvert