[Math] How does law of cosines work with vectors

geometryvectors

I just recently started physics for fun and started with the basics but something is already bugging me. It is about the implementation of law of cosines to sum of vectors.

I know how it works with triangles. I get the logic about the interaction between the two edges and the angle between them. But there is something I don't understand about choosing which angle we should use for the formula.

In the following visual:

  • Orange vector's magnitude is $2$ and angle is $0^\circ$.

  • Green vector's magnitude is $2$ and angle is $45^\circ$.

  • Grey is sum.

  • Blue is X line.

  • Red is Y line.

image of vectors

Now angle $\angle B = 45^\circ$ and therefore $\angle A = 135^\circ$. If we consider the shape as a triangle, then in order to find the grey line, we must implement the law of cosines with $\cos 135^\circ$. Like this:

$$V_\text{grey}=\sqrt{{V_\text{orange}}^2 + {V_\text{green}}^2 – 2V_\text{orange}\cdot V_\text{green}\cos 135^\circ}$$

However, on the tutorial I have seen on the internet, when calculating the sum of vector forces, they use $\cos 45^\circ$ in the formula instead, saying we must use the angle between the vectors (in the tutorial they both originate from the $(0,0)$ point). But then, when generating the shape geometrically, we technically don't use the angle that is facing the edge we want to find the value of. Can someone explain why we use $\cos 45^\circ$ and not $\cos 135^\circ$?

Best Answer

The law of cosines is just an expansion of a vector identity.

\begin{align*} \|V_3\|^2&=\|V_1+V_2\|^2\\ &=(V_1+V_2)\cdot(V_1+V_2)\\ &=V_1\cdot V_1+V_2\cdot V_2+2 V_1\cdot V_2\\ &=\|V_1\|^2+\|V_2\|^2+2 \|V_1\| \|V_2\| \cos(\theta) \end{align*}

Where, in the dot product identity, $\theta$ is the angle between the vectors. This alone solves your problem and proves that you should use forty five degrees!

But where did you go wrong? There's lots of confusion with the minus sign because of the law for triangles. Take the following diagram:

enter image description here

say, $V_1$ is the vector from B to C, and $V_2$ is the vector from C to A. $C$ is the angle you want to use in the above vector formula $\|V_3\|^2=\|V_1\|^2+\|V_2\|^2+2 \|V_1\| \|V_2\| \cos(\theta)$. But the "$\theta$" in that formula is actually $\theta=\pi-C$. Then:

\begin{align*} c^2&=\|V_3\|^2\\ &=\|V_1\|^2+\|V_2\|^2+2 \|V_1\| \|V_2\| \cos(\pi-C)\\ &=\|V_1\|^2+\|V_2\|^2+2 \|V_1\| \|V_2\|\left( \cos(\pi)\cos(C)-\sin(\pi)\sin(C)\right)\\ &=\|V_1\|^2+\|V_2\|^2-2 \|V_1\| \|V_2\|\cos(C)\\ &=a^2+b^2-2 ab\cos(C)\\ \end{align*}

Related Question