# Scalar product and direction cosines

When I learned about the scalar product in high school, I was somewhat
surprised by how lucky its properties are.

The treatment is usually this:
define $ x \cdot y = |x| |y| \cos \theta $, where $ \theta $ is the
angle between $ x $ and $ y $. Then deduce that $ x \cdot y $ is
linear on the left and right arguments. Then, deduce that $ (x_1 \vec i +
x_2 \vec j + x_3 \vec k) \cdot (y_1 \vec i + y_2 \vec j + y_3 \vec k) = x_1 y_1
+ x_2 y_2 + x_3 y_3 $

Now, define the direction cosines of a vector $ x $ as the cosines of
the angles the vector forms with the basis vectors. By definition: $ x =
|x| (\cos \phi_1, \cos \phi_2, \cos \phi_3) $.

If we define $ \theta
$ as the angle between $ x $ and $ y $, $ \alpha_i $ as the
angles between $ x $ and the axis, and $ \beta_i $ as the angles
between $ y $ and the axis, we have: $ \cos \theta = \sum_i \cos
\alpha_i \cos \beta_i $.

This last formula mystified me. The deduction was so purely algebraic that I found it unsatisfactory. I wanted to see the geometric meaning.

A more geometric deduction follows: $ (\cos \alpha_1, \cos \alpha_2,
\cos \alpha_3) $ is a point $ a $ on the unit sphere. If we take another
point $ b $ on the unit sphere, the subtend an angle $ \theta $:

On the unit sphere, we can find the angle $ \theta $ subtended by $
a $ and $ b $, by calculating the distance $ l $ between them:

As you can see in the picture, $ l = 2 \sin \frac{\theta}{2} $. Therefore: $$ 2 \sin \frac{\theta}{2} = \sqrt{\sum (\cos \alpha_i - \cos \beta_i)^2}$$ By basic trigonometry: $$ \sin \frac{\theta}{2} = \sqrt{\frac{1 - \cos \theta}{2}}$$ Putting the above two together: $$ 4 \frac{1 - \cos \theta}{2} = \sum (\cos \alpha_i - \cos \beta_i)^2 = \sum (\cos^2 \alpha_i - 2 \cos \alpha_i \cos \beta_i + \cos^2 \beta_i)$$ Since $ a$ and $ b$ are both on the unit sphere: $$ 4 \frac{1 - \cos \theta}{2} = 2 - \sum 2 \cos \alpha_i \cos \beta_i $$, and $$ \cos \theta = \sum \cos \alpha_i \cos \beta_i$$

In this deduction of $ \cos \theta $, we didnâ€™t assume any knowledge of the scalar product. In fact, we could have used it as a basis for the definition of the scalar product.