How does $cos(x) = \frac{\vec{v} \cdot \vec{w}}{|\vec{v}| \cdot |\vec{w}|}$ make sense?

In Multivariable Calculus, the professor said that in order to compute the angle $x$ between two vectors $v$ and $w$, we use the formula: $\cos(x) = \frac{\vec{v} \cdot \vec{w}}{|\vec{v}| \cdot |\vec{w}|}$

He also mentioned "Projection" but I didn't understand much of it. The only thing I got was that we can create a right triangle by drawing a perpendicular line from one vector to the head of the other and compute the angle like that using $\cos$, but I don't understand why we're multiplying vectors, or dividing by their magnitudes…how do those operations make sense?

Also, in the specific example, the result of $\cos(x) = \frac{\vec{v} \cdot \vec{w}}{|\vec{v}| \cdot |\vec{w}|}$ ended up being $1/2 = \pi/2$. Where does $\pi/2$ come from here? I can't understand how we go from $1/2$ to $\pi/2$.


Solution 1:

$\textbf{A really nice construction of this proof}$: Let $\textbf{A,B}$ be two vectors and $B$ $\neq O$. We seek a vector $P$ such that, $$(\textbf{A} -P) \cdot \textbf{B} = 0$$ and $P=c\textbf{B}$ for some number $c$. Suppose we can find such a number $c$, namely one satisfying, $$(A-cB) \cdot B = 0$$ We then get $$\textbf{A} \cdot \textbf{B} = c\textbf{B} \cdot \textbf{B}$$ and therefore $c=\frac{ \textbf{A} \cdot \textbf{B}}{\textbf{B} \cdot \textbf{B}}$. From this construction and use of what we know about planee geometry, $$\cos(\theta) = \frac{c||\textbf{B}||}{||\textbf{A}||}$$ and substituting in our value for $c$ we get, $$A \cdot B = ||\textbf{A}|| ||\textbf{B}|| \cos(\theta)$$ \

$\textbf{Picture for our Construction}$

enter image description here

Solution 2:

If $v=\|v\|\cdot(\cos\theta_1,\sin\theta_1)$ and $w=\|w\|\cdot(\cos\theta_2,\sin\theta_2)$, then $$ \begin{eqnarray} \frac{v\cdot w}{\|v\| \|w\|}&=&(\cos\theta_1,\sin\theta_1)\cdot (\cos\theta_2,\sin\theta_2)\\ &=& \cos\theta_1 \cos\theta_2 +\sin\theta_1 \sin\theta_2 \\&=&\cos\left(\theta_2 - \theta_1\right); \end{eqnarray} $$ and $\theta_2-\theta_1$ is the angle between $v$ and $w$.

Solution 3:

Suppose you have two unit vectors $\hat a$ and $\hat b$ and that the angle between them is $\pi/2$.

Then imagine the unit circle, with $\theta = 0$ corresponding to the $\hat a$ direction and $\theta = \pi/2$ corresponding to the $\hat b$ direction.

Now, suppose there is a unit vector $\hat c$ in the plane spanned by $\hat a, \hat b$. It lies on the unit circle, so you can write $\hat c = \hat a \cos \theta + \hat b \sin \theta$.

Now then, how can you solve for $\cos \theta$? By taking a dot product: see, since $\hat a \perp \hat b$, you know that $\hat a \cdot \hat b = 0$. So you solve for the cosine as follows:

$$\hat c \cdot \hat a = (\hat a \cdot \hat a) \cos \theta + (\hat a \cdot\hat b) \sin \theta = \cos \theta$$

All this business about dividing magnitudes is just to convert arbitrary vectors to unit vectors.

The part $\hat a \cos \theta$, which is equal to $(\hat c \cdot \hat a) \hat a$ is called the projection of $\hat c$ onto $\hat a$. You could think of it like the "shadow" $\hat c$ makes onto $\hat a$. The projection is also defined for non-unit vectors, though usually it's more useful to project onto some unit direction, so you don't get two different vector magnitudes confused.