Derivation of Cosine Law
The following are the formulas for cosine law for any triangles with sides a, b, c and angles A, B, C, respectively.
Consider the triangle to the right:
Cosine function for triangle ADB
Pythagorean theorem for triangle ADB
Pythagorean theorem for triangle CDB
Substitute h2 = c2 - x2
Substitute x = c cos A
The other two formulas can be derived in the same manner.