Math

Law of Cosines Calculator

Enter two sides and the included angle (SAS) to solve the rest of the triangle.

Your numbers

Your results

Side c
Side c
—
Angle A (°)
—
Angle B (°)
—
Area
—

Law of Cosines Calculator by TheCalcTools

How the Law of Cosines Calculator works

Enter two sides and the angle between them.

The law of cosines gives the third side: c² = a² + b² − 2ab cos C.

The other two angles then follow from the same law.

The formula

c² = a² + b² − 2ab·cos CArea = ½ ab sin C

Worked example

Using the default values shown in the calculator:

Side a7
Side b10
Included angle C (°)40
  1. c² = 49 + 100 − 2 × 7 × 10 × cos 40° = 149 − 107.246 = 41.754.
  2. c = 6.4617.
  3. Angle A = 44.13° and angle B = 95.87°.

Result:

Side c6.4617
Angle A (°)44.13
Angle B (°)95.87
Area22.4976

Frequently asked questions

How is it related to the Pythagorean theorem?

When C = 90° the cosine term is zero and the law of cosines reduces to a² + b² = c².

Can it find an angle from three sides?

Yes. Rearrange to cos C = (a² + b² − c²) ÷ 2ab. The triangle area calculator does this for you.

Sources and further reading

More in Math · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.