How does law of cosines work with vectors? 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.

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$?
 A: 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:

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*}
A: Okay I found the answer. The reason we use $\angle B$ is because it is equal to $180 - \angle A$ which when implied to $cos$, is equal to $-cos \angle A$. Also I figured the tutorial doesn't use the normal law of cosines but rather this:
$$V_\text{sum}=\sqrt{{V_\text{1}}^2 + {V_\text{2}}^2 + 2V_\text{1}\cdot V_\text{2}\cos \angle (between \space vectors)}$$
Not that it is + instead of - before $cos$. 
A: We all know now which of the following ideas is more closely linked to the theory of of Euclidean Vector Analysis:
Law of cosines
OR
Quaternions
You might even make the claim that if mathematicians (should I say physicists?) three centuries ago focused on trying to elegantly express the Law of Cosines in 3-Space, the development of vector analysis would have been available to humanity at a much earlier time; see  A History of Vector Analysis. 
So we now have the dot product (and the more abstract inner product) that we can learn how to use. But don't ever take it for granted!
Newton gave us the Parallelogram of Force Theory. Perhaps if he had time/interest to think just about math, he would have given us the Polarization Identity and its relation to the Law of Cosines.
