Where does the $-2ab$ term come from in the cosine law?

Solution 1:

My trigonograph for the Law of Cosines may help:

enter image description here

Solution 2:

Based on Pythagorean theorem and Pythagorean trigonometric identity in this triangle

enter image description here

we have $$c^2 = (a-b\cos C)^2 + (b \sin C)^2 \\ = a^2 - 2ab \cos C + b^2\cos^2 C + b^2 \sin^2 C \\ = a^2 - 2ab \cos C + b^2$$

Solution 3:

Let's accept that $c^2=a^2+b^2$ for a right Euclidean triangle. Then for a degenerate obtuse triangle, where we take angle $C\to\pi$, we have $c^2 \to (a+b)^2 = a^2+b^2+2ab$. On the other hand, as we take $C\to0$, we find $c^2\to(a-b)^2 = a^2+b^2-2ab$.

It is apparent that length $c^2$ is a function of angle $C$ between sides $a$ and $b$. We see that $c^2=a^2+b^2-2ab\cos C$ modulates between our boundary cases an provides every value in between.