The law of cosines formula
The law of cosines relates the three sides of any triangle to one of its angles. It is most useful when you have two sides and the angle between them (SAS) or all three sides (SSS). For a right triangle the formula reduces to the Pythagorean theorem because cos(90) is zero.
c^2 = a^2 + b^2 - 2ab * cos(C)
Finds side c from sides a, b and included angle C.
cos(C) = (a^2 + b^2 - c^2) / (2ab)
Finds angle C from all three sides.