Law of cosines
Use in solving triangles

The theorem is used in solution of triangles, i.e., to find (see Figure 3):

These formulas produce high round-off errors in floating point calculations if the triangle is very acute, i.e., if c is small relative to a and b or γ is small compared to 1. It is even possible to obtain a result slightly greater than one for the cosine of an angle.

The third formula shown is the result of solving for a in the quadratic equation a − 2 ab cos γ + b − c = 0. This equation can have 2, 1, or 0 positive solutions corresponding to the number of possible triangles given the data. It will have two positive solutions if b sin γ < c < b, only one positive solution if c = b sin γ, and no solution if c < b sin γ. These different cases are also explained by the side-side-angle congruence ambiguity.
startend:end_checker, detectable_format:title