The dot product of two unit vectors in 2D

The dot product of two unit vectors \(\hat{a}, \hat{b}\) is \(\cos \theta\), where \(\theta\) is the angle between the unit vectors.

Proof

We remember the rotation formula from Formula for rotating a vector in 2D:

\[\begin{split}x_2 = \cos \beta x_1 - \sin \beta y_1 \\ y_2 = \sin \beta x_1 + \cos \beta y_1\end{split}\]

Now consider the unit vector \(\hat{a} = (x_1, y_1)\) rotated by \(\theta\) to get \(\hat{b} = (x_2, y_2)\):

\[\begin{split}\hat{a} \cdot \hat{b} = x_1 x_2 + y_1 y_2 \\ = x_1 (\cos \theta x_1 - \sin \theta y_1) + y_1 (\sin \theta x_1 + \cos \theta y_1) \\ = \cos \theta x_1^2 - \sin \theta x_1 y_1 + \sin \theta x_1 y_1 + \cos \theta y_1^2 \\ = \cos \theta (x_1^2 + y_1^2)\end{split}\]

Because we have assumed \(\hat{a}\) is a unit vector, \(\| \hat{a} |\ = x_1^2 + y_1^2 = 1\) and:

\[\hat{a} \cdot \hat{b} = \cos \theta\]

Dot product of not-unit vectors

Now take two non-unit vectors \(\vec{x}, \vec{y}\):

\[\begin{split}\hat{x} = \frac{1}{\| \vec{x} \|}\vec{x} \\ \hat{y} = \frac{1}{\| \vec{y} \|}\vec{y}\end{split}\]

From the rules of the dot product and the result from the unit vectors above:

\[\vec{x} \cdot \vec{y} = \| \vec{x} \| \| \vec{y} \| \cos \theta\]