The law of cosines, otherwise known as the cosine formula or cosine rule, gives a formula that relates the lengths of the sides of a triangle to the cosine of one of its angles.
where is the angle between the sides and , with opposite side .
The following interface solves for either the value of or .