Law of Cosines

Solve a triangle using the Law of Cosines for SSS or SAS cases.

Formula

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

The Law of Cosines generalizes the Pythagorean theorem. When C=90° it reduces to c²=a²+b².

Examples

a=8, b=6, C=60°

a=5, b=7, C=45°

a=10, b=10, C=90°

Frequently Asked Questions

When do I use the Law of Cosines?

Use it for SSS (three sides) or SAS (two sides and included angle) cases.

How does the Law of Cosines relate to the Pythagorean theorem?

When angle C = 90°, cos(90°) = 0, so c² = a² + b², the Pythagorean theorem.

About this Calculator

Solve a triangle using the Law of Cosines for SSS or SAS cases. All calculations are performed in your browser for instant results. Formulas are mathematically exact using JavaScript's built-in Math functions.