Law of Cosines Calculator

Solve triangles with the law of cosines.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter two sides and the angle between them to get the third side, or enter all three sides to get the angle. Sides 5 and 6 with C = 60° give c = 5.56776.

How to use

1
Step 1
To find a side: enter a, b and the angle C in degrees, with c = 0.
2
Step 2
To find the angle: enter a, b and c, with C = 0.
3
Step 3
Press Calculate.

How it works

The law of cosines extends Pythagoras to any triangle. With C = 90° the cosine term is 0 and it reduces to c² = a² + b², so sides 3 and 4 give 5. To get an angle, rearrange to cos C = (a² + b² − c²) ÷ 2ab. Three sides only form a triangle if each is shorter than the sum of the other two.

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

Worked example

Find an angle from three sides

Input
a = 7, b = 8, c = 9
Output
C = 73.3985°
Walkthrough
cos C = (49 + 64 − 81) ÷ 112 = 0.285714, and arccos(0.285714) = 73.3985°.

Limitations

  • Angles are in degrees.
  • Impossible triangles are rejected: sides 1, 2, 10 return the error "Impossible triangle: each side must be shorter than the sum of the other two".

Questions

What is c if a = 5, b = 6 and C = 60°?
5.56776.
What is c if a = 3, b = 4 and C = 90°?
c = 5, because cos 90° = 0 and the law of cosines reduces to c² = 3² + 4² = 25.
What is angle C if the sides are 7, 8 and 9?
73.3985°.
What happens with sides 1, 2 and 10?
They cannot form a triangle, so the tool shows an Impossible triangle error.

Features

  • Side or angle
  • Reduces to Pythagoras at 90°
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Rectangle area as product of dimensions

    Khan Academy

    Connects unit squares to length × width for area tools.

    Watch on YouTube
  • Finding mean, median, and mode

    Khan Academy

    Descriptive stats used across statistics tools.

    Watch on YouTube