What this calculator does
The law of cosines is useful when you know two sides and the included angle, or when all three sides are known and you need the angles.
When to use the Law of Cosines
The law of cosines is most useful for two common triangle cases: SAS and SSS. Use it when you know two sides and the included angle and need the third side, or when you know three sides and need the angles.
| Case | Known information | What to calculate first |
|---|---|---|
| SAS | Two sides and the included angle | The missing third side |
| SSS | Three sides | One angle at a time |
| Right triangle | Two sides and a 90° angle | Pythagorean theorem may be simpler |
Formula reference
For side c opposite angle C, the law of cosines is:
c² = a² + b² − 2ab cos(C)
To find angle C from three sides, rearrange it as:
cos(C) = (a² + b² − c²) / (2ab)
The calculator uses degrees for the included angle.
Step-by-step SAS example
Suppose side a = 8, side b = 11, and included angle C = 40°. The missing side c is found by substituting into c² = a² + b² − 2ab cos(C). After side c is known, the remaining angles can be solved from the completed side lengths.
- Square the two known sides.
- Multiply 2 × a × b × cos(C).
- Subtract that product from a² + b².
- Take the square root to get the missing side.
Common Law of Cosines mistakes
- The angle must be the included angle between the two known sides for SAS.
- Use degree mode if your angle is in degrees.
- Do not use the law of sines first for an SSS case; there is no known angle yet.
- Check whether the three sides form a valid triangle before calculating angles.
Related triangle calculators
More triangle calculators
Find Missing Side
Use Pythagorean theorem or law of cosines depending on the triangle case.
Open calculator →Right Triangle with Steps
Solve right-triangle side and angle questions with a formula explanation.
Open calculator →Triangle Angle Calculator
Find missing angles from sides or from two known angles.
Open calculator →SSS Triangle Calculator
Solve a triangle when all three sides are known.
Open calculator →SAS Triangle Calculator
Use two sides and the included angle.
Open calculator →Law of Cosines
Solve common oblique triangle cases.
Open calculator →