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

I understand that in the cosine rule i.e. $c^2 = a^2 + b^2 - 2ab \cos C$, the cosine function acts to bring down the value of $c^2$ for acute angles ($\cos C>0$, $-2ab\cos C<0$ ) and increase the value of $c^2$ for obtuse angles ($\cos C <0$, $-2ab\cos C > 0$). I still wonder where the $2ab$ term comes from? Any ideas about the intuition behind that?

Regards,

My trigonograph for the Law of Cosines may help: • Nice proof-without-words, +1! But it would be easier to read if the squares in the calculation below were not filled in, since they correspond just to the square outlines in the diagram. – hmakholm left over Monica Oct 22 '17 at 10:48
• @HenningMakholm: Thanks for catching that. The filled-in squares are a bit of a typo-graphical error. In previous versions I've created, the squares are outlines. (Oh, I just realized that I'd uploaded a previous version in this answer ... over five years ago!) – Blue Oct 22 '17 at 11:08
• Nice. Do you also have a picture for the case $\angle C>\pi /2$? – DanielWainfleet Oct 23 '17 at 18:15
• @DanielWainfleet: The obtuse case is drawable, but it takes some artistic finesse to keep the overlapping elements from creating a visual mess. The "equation of boxes" also isn't quite as pretty, because it's tricky to represent the effect of a negative cosine. (I get away with that kind of thing in trigonographs like this one, but that's because I can readily reconcile absolute values in the real equations.) So, I prefer to leave the obtuse case as the proverbial "exercise to the reader". – Blue Oct 23 '17 at 22:54

Based on Pythagorean theorem and Pythagorean trigonometric identity in this triangle 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$$

• This equation can easly be seen by (scaled) unit circle and (scaled) sin, cos. One can also imagine one fixed line $a = AB$ and other line $b = BC$ moving around a point $B$ to form third side $c$ when connecting points $A, C$. So, $c^2_{min} = (a - b)^2, c^2_{mid} = a^2 + b^2, c^2_{max} = (a + b)^2$ and here is visible "cosine effect". – 1b3b Jul 3 at 0:05

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.

• I would have started an "intuitive" explanation exactly the same way (+1). Another point may be that the cosine needs to be multiplied by something quadratic in $a,b,c$. Either for dimensional reasons (all the terms must be square meters, or square feet in the anglosaxon world). Or, if we scale the triangle up by a certain factor $k$, then $a^2,b^2,c^2$ will scale by a factor $k^2$. The cosine won't change because the angle stays the same, so $k^2$ needs to come from somewhere else. – Jyrki Lahtonen Oct 22 '17 at 7:25

On the real line $\mathbb R$ we define the absolute value of a number as

$\tag 1 |x| = \sqrt{x^2}$

The distance between any two numbers $a$ and $b$ on the line is defined as $|a - b|$.

The binomial theorem is useful:

$\tag 2 (a + b)^2 = a^2 + b^2 +2ab$

We also have

$\tag 3 |(a + b)^2| = |a + b|^2 =|a|^2 + |b|^2 \pm 2 |a||b|$

and since $|b - a| \text{ (distance) } = |b + (-a)| = |(-a) + b|$,

$\tag 4 |b - a|^2 =|a|^2 + |b|^2 \pm 2 |a||b|$

When you move from the real line to $\mathbb R \times R$, you want to bring along this idea of distance. Using graphs paper and a ruler, it won't be long before you conclude that for line segment lengths $a$, $b$ and $c$ (distance) forming a triangle in the plane that

$\tag 5 c^2 = a^2 + b^2 + \gamma a b \text{ with } -1 \le \gamma \le 1$

better work.