Math July 13, 2026 · 8 Min Read

Law of Cosines Calculator – Guide & Formulas

Solve any triangle using the Law of Cosines. Find missing sides or angles given SAS or SSS configurations with step-by-step results and formulas.

The Law of Cosines Calculator solves any triangle given three sides (SSS) or two sides and the included angle (SAS). Enter your known values to instantly find all missing sides and angles using the cosine rule, with step-by-step derivations.

Key Takeaway

Use the free Law of Cosines Calculator to solve any triangle using the law of cosines. find missing sides or angles given sas or sss configurations with step-by-step results and formulas. Get instant results with step-by-step explanations.

How to Use the Law of Cosines Calculator

  1. Select the known configuration: SSS (three sides) or SAS (two sides + included angle).
  2. Enter the known side lengths and/or angle.
  3. The calculator computes all missing sides and angles.
  4. Review the step-by-step solution and the law of cosines formula used.

The Formula

c² = a² + b² - 2ab·cos(C)

Variable Definitions

  • a, b, c: The three sides of the triangle
  • A, B, C: The angles opposite sides a, b, c respectively
  • cos(C): Cosine of angle C (the included angle in SAS)
  • 2ab·cos(C): The correction term that extends the Pythagorean theorem to non-right triangles

Example: SAS Triangle with a=5, b=7, C=60°

Find side c and angles A and B given two sides and the included angle.

  1. Step 1: Apply law of cosines: c² = a² + b² - 2ab·cos(C).
  2. Step 2: Substitute: c² = 25 + 49 - 2(5)(7)cos(60°) = 74 - 70(0.5) = 74 - 35 = 39.
  3. Step 3: c = √39 ≈ 6.245.
  4. Step 4: Find angle A using: cos(A) = (b² + c² - a²)/(2bc) = (49 + 39 - 25)/(2·7·6.245) = 63/87.43 ≈ 0.7206.
  5. Step 5: A = arccos(0.7206) ≈ 43.9°, and B = 180° - 60° - 43.9° = 76.1°.

Frequently Asked Questions

What is the law of cosines?

The law of cosines states that c² = a² + b² - 2ab·cos(C) for any triangle. It generalizes the Pythagorean theorem to non-right triangles. When C = 90°, cos(90°) = 0, and the formula reduces to c² = a² + b².

When should I use the law of cosines?

Use the law of cosines when you know: (1) three sides (SSS) and need to find angles, or (2) two sides and the included angle (SAS) and need to find the third side. It works for any triangle, not just right triangles.

What is the difference between law of cosines and law of sines?

The law of cosines relates three sides and one angle (c² = a² + b² - 2ab·cos(C)). The law of sines relates sides to their opposite angles (a/sin(A) = b/sin(B)). Use law of cosines for SSS and SAS; use law of sines for ASA and AAS.

How do I find an angle using the law of cosines?

Rearrange the formula: cos(C) = (a² + b² - c²)/(2ab). Calculate the right side, then take arccos to find angle C. This is how you solve SSS triangles.

Does the law of cosines work for right triangles?

Yes. When C = 90°, cos(90°) = 0, so the formula becomes c² = a² + b² - 0 = a² + b², which is the Pythagorean theorem. The law of cosines is a generalization of the Pythagorean theorem.

What is the ambiguous case?

The ambiguous case (SSA) occurs with the law of sines, not the law of cosines. However, the law of cosines can be used to resolve SSA ambiguity: set up the quadratic equation and check how many positive solutions exist.

How do I solve an SSS triangle?

For SSS, use the law of cosines to find the largest angle first (opposite the longest side). Then use the law of cosines or law of sines to find the remaining angles. The angles should sum to 180°.

How do I solve a SAS triangle?

For SAS, use the law of cosines to find the third side: c² = a² + b² - 2ab·cos(C). Then use the law of sines or law of cosines to find the remaining angles.

Can the law of cosines find the area of a triangle?

Indirectly, yes. After finding all sides and angles, you can use the formula Area = (1/2)ab·sin(C). The law of cosines helps you find the needed values first.

What are common mistakes when using the law of cosines?

Common mistakes include: (1) using the wrong angle with the wrong sides (angle must be between the two known sides in SAS), (2) forgetting to take the square root after computing c², (3) using degrees when the calculator expects radians.