How to solve a triangle with the law of cosines

The Law of Cosines defines the relationship between the side lengths of a triangle and the cosine of its angles. It applies specifically to triangles where two sides and the included angle are known (SAS), or where all three side lengths are known (SSS).

The setup

For a triangle with sides aa, bb, and cc opposite angles AA, BB, and CC, the Law of Cosines states: c2=a2+b22abcos(C)c^2 = a^2 + b^2 - 2ab \cos(C). By permutation, a2=b2+c22bccos(A)a^2 = b^2 + c^2 - 2bc \cos(A) and b2=a2+c22accos(B)b^2 = a^2 + c^2 - 2ac \cos(B).

The steps

  1. Identify the given triangle parameters as SAS (Side-Angle-Side) or SSS (Side-Side-Side). 2. Select the variation of the Law of Cosines that isolates the unknown side (for SAS) or the unknown angle (for SSS). 3. Substitute the known values and evaluate. 4. If finding an angle, isolate the cosine term and use the inverse cosine function. 5. Use the Law of Sines or repeat the Law of Cosines to find the remaining angles.

Checking the result

Verify that the sum of the angles equals exactly 180 degrees (A+B+C=180A + B + C = 180^\circ). Confirm that the longest side is opposite the largest angle, and the shortest side is opposite the smallest angle.

Common errors

Failing to take the square root of c2c^2 when solving for a side length. Executing calculations with the calculator set to radians instead of degrees. Subtracting 2ab2ab from a2+b2a^2 + b^2 before multiplying by cos(C)\cos(C).

Worked example

Solve for the largest angle CC in a triangle with side lengths a=5a = 5, b=7b = 7, and c=9c = 9.

Identify the knowns: a=5a = 5, b=7b = 7, c=9c = 9. Choose the equation isolating angle CC: c2=a2+b22abcos(C)c^2 = a^2 + b^2 - 2ab \cos(C). Substitute values: 92=52+722(5)(7)cos(C)9^2 = 5^2 + 7^2 - 2(5)(7) \cos(C). Evaluate squares and products: 81=25+4970cos(C)81 = 25 + 49 - 70 \cos(C). Simplify: 81=7470cos(C)81 = 74 - 70 \cos(C). Isolate the cosine term: 7=70cos(C)7 = -70 \cos(C), so cos(C)=0.1\cos(C) = -0.1. Evaluate inverse cosine: C=cos1(0.1)C = \cos^{-1}(-0.1). Result: C95.74C \approx 95.74^\circ.

FAQ

Run your own problem

References: Stewart, J., Redlin, L., & Watson, S. (2015). Precalculus: Mathematics for Calculus. · OpenStax Algebra and Trigonometry, Chapter 10. · Khan Academy Unit: Trigonometric equations and identities.

See also