For two vectors $a$ and $b$, why does $\cos(θ)$ equal the dot product of $a$ and $b$ divided by the product of the vectors' magnitudes?

Solution 1:

There are several derivations of this online. Here's where you can start.

Define two vectors $\textbf{a}$ and $\textbf{b}$. Then $ \textbf{a} - \textbf{b}$ is the vector that connects their endpoints and makes a triangle.

Therefore, we have a triangle with side lengths $|\textbf{a}|$, $|\textbf{b}|$, and $|\textbf{a} - \textbf{b}|$. Let the angle between the two vectors be $\theta$. By the Law of Cosines, we have

$$|\textbf{a} - \textbf{b}|^2 = |\textbf{a}|^2 + |\textbf{b}|^2 - 2 |\textbf{a}| |\textbf{b}| \cos (\theta)$$

Now, use the fact that $$ \begin{align*} |\textbf{a}- \textbf{b}|^2 &= (\textbf{a}- \textbf{b}) \cdot (\textbf{a}- \textbf{b})\\ &= \textbf{a} \cdot \textbf{a} - 2 (\textbf{a} \cdot \textbf{b}) + \textbf{b} \cdot \textbf{b} \\ &= |\textbf{a}|^2 - 2 (\textbf{a} \cdot \textbf{b}) + |\textbf{b}|^2 \end{align*} $$

Simplify this equation, and you will get the desired formula.

Solution 2:

Since $(a,b)$ is independent of the basis, just choose a basis where $a$ lies along the $x$ axis: $a=(|a|,0)$, so that: $$ {(a,b)\over|a||b|}={b_x\over|b|}=\cos(\theta), $$ where $\theta$ is the angle between $b$ and $x$ axis (as you may recall from trigonometry), which is the same as the angle between $a$ and $b$.