Timeless Theorems of Mathematics/Law of Cosines



The law of cosines explains the relation between the sides and an angle of a triangle. The law states that for any triangle $$\Delta ABC$$, if $$\angle ACB=\theta$$, $$AB=c$$, $$AC=b$$ and $$BC=a$$, then $$c^2 = a^2+b^2-2ab\cdot \cos\theta$$. For $$\theta=\frac{\pi}{2}, \Delta ABC$$ is a right angle and $$c^2 = a^2 + b^2$$, we have proved it as the pythagorean theorem earlier.

Statement
In any triangle, the square of one side's length is equal to the difference between the sum of the squares of the other two sides' lengths and twice the product of those two sides' lengths and the cosine of the included angle.

Assume, $$\Delta ABC$$ is a triangle where $$\angle ACB=\theta,$$ $$AB=c$$ $$AC=b$$ and $$BC=a.$$ It is needed to be proved that, $$c^2 = a^2+b^2-2ab\cdot \cos\theta$$.

Let us extend the line segment $$BC$$ to $$BD$$ (only for obtuse triangles), where $$AD\perp BD$$. Assume $$AD=h$$ and $$CD = k$$.

For obtuse triangles:
According to the Pythagorean theorem, we can say that, for $$\Delta ACD,$$ $$b^2 = k^2 + h^2$$

Similarly, for the triangle $$\Delta ABD,$$ $$c^2 = h^2 + (a+k)^2$$ $$= h^2 + a^2 + k^2 + 2ak$$ $$= a^2 + b^2 + 2ak$$.

We will be using this value for further proof. But now, let's determine some trigonometric values for the triangles.

Here, $$\angle ACD = \pi - \theta$$.

Therefore, $$\frac{k}{b} = \cos(\pi -\theta)$$

Or, $$k = b\cdot\cos(\pi-\theta)$$ $$= b[\cos(\pi)\cdot cos(\theta) + \sin(\pi)\cdot \sin(\theta)]$$ $$= -b\cdot\cos(\theta)$$

Now, $$c^2 = a^2 + b^2 + 2ak$$.

$$\therefore c^2 = a^2 + b^2 - 2ab\cdot\cos\theta$$. [Proved]

For acute angles:
Like as the proof we have proved before, according to the Pythagorean theorem, we can say that, for $$\Delta ACD,$$ $$b^2 = k^2 + h^2$$

Similarly, for the triangle $$\Delta ABD,$$ $$c^2 = h^2 + (a-k)^2$$ $$= h^2 + a^2 + k^2 - 2ak$$ $$= a^2 + b^2 - 2ak$$.

Here, $$\angle ACD = \theta$$.

Therefore, $$\frac{k}{b} = \cos\theta$$ $$\Rightarrow k = b\cdot\cos\theta$$

Now, $$c^2 = a^2 + b^2 - 2ak$$.

$$\therefore c^2 = a^2 + b^2 - 2ab\cdot\cos\theta$$. [Proved]

[Note: Whatever the triangle is, the formula, $$c^2 = a^2 + b^2 - 2ab\cdot\cos\theta$$ works.]