The law of cosines is a generalisation of the Pythagorean theorem that works for any triangle. When angle C = 90°, cos(90°) = 0, and the formula reduces to the familiar a² + b² = c².
A triangle has sides a = 5, b = 7, and included angle C = 60°. Find side c.
c² = a² + b² − 2ab·cos(C)c² = 25 + 49 − 2(5)(7)·cos(60°)c² = 74 − 70(0.5) = 74 − 35 = 39