 WE USE THE LAW OF COSINES to solve triangles that are not right-angled.  In particular, when we know two sides of a triangle and their included angle, then the Law of Cosines enables us to find the third side. Thus if we know sides a and b and their included angle θ, then the Law of Cosines states:

 c² = a² + b² − 2ab cos θ

(The Law of Cosines is a extension of the Pythagorean theorem; because if θ were a right angle, we would have c² = a² + b².)

Proof of the Law of Cosines Let ABC be a triangle with sides a, b, c.  We will show

c² = a² + b² − 2ab cos C

Draw BD perpendicular to CA, separating triangle ABC into the two right triangles BDC, BDA.  BD is the height h of triangle ABC.

Call CD x.  Then DA is the whole b minus the segement x:  b − x.

Also, since

 x a = cos C,

then

x  =  a cos C .  .  .  .  .  .  . (1)

Now, in the right triangle BDC, according to the Pythagorean theorem,

h² + x² = a²,

so that

h² = a² − x².  .  .  .  .  .  (2)

In the right triangle BDA,

c² = h² + (bx

c² = h² + b² − 2bx + x²

For h², let us substitute line (2):

c² = a² − x² + b² − 2bx + x²

c² = a² + b² − 2bx

Finally, for x, let us substitute line (1):

c² = a² + b² − 2b· a cos C

That is,

c² = a² + b² − 2ab cos C

This is what we wanted to prove.

In the same way, we could prove that

a² = b² + c² − 2bc cos A

and

b² = a² + c² − 2ac cos B.

This is the Law of Cosines.