Skip to content
ENExplore Calculators

Law of Cosines Calculator

Solve a triangle using the cosine rule: c² = a² + b² − 2ab·cos C.

About Law of Cosines Calculator

The Law of Cosines generalises the Pythagorean theorem to any triangle: c² = a² + b² − 2ab·cos C. Use it for SAS (two sides + included angle) or SSS (three sides) configurations.

Formula

Law of Cosines

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

a
First side
b
Second side
c
Side opposite angle C
C
Included angle

Worked example

With the default values below, Law of Cosines Calculator returns Side c of 6.244998. Change any input above and every figure here is recalculated in your browser.

Inputs used

Known valuesone of Two sides + included angle (SAS), Three sides (SSS)
Two sides + included angle (SAS)
Side aminimum 0.001
5
Side bminimum 0.001
7
Angle C (degrees, between a and b)accepts 0.01–179.99
60
Side cminimum 0.001
8

Results

Side c
6.244998
Angle A
43.897886 °
Angle B
76.102114 °

Step by step

  1. 1Apply cosine rule= 39
  2. 2Side c= 6.244998
  3. 3Angle A= 43.89788625°
  4. 4Angle B= 76.10211375°

Assumptions and limits

  • The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

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

When C = 90°, cos(90°) = 0, so it reduces to c² = a² + b², which is exactly the Pythagorean theorem.

Can I use Law of Cosines if I know two angles?

If you know two angles, you know the third (they sum to 180°). The Law of Sines is simpler in that case. Law of Cosines is best for SSS or SAS.

Law of Cosines Calculator – Calculate Side c & Angle A