Boneyard Tools

Law of Cosines Calculator

Use the law of cosines to solve a triangle. Pick SAS for two sides and the included angle, or SSS for all three sides, and get the missing sides, all angles and the area.

How to use the law of cosines

  1. Choose SAS (two sides and the included angle C) or SSS (three sides).
  2. Enter the known sides and, for SAS, the included angle in degrees.
  3. Read the remaining side, all three angles and the triangle area.

Examples

SAS: two sides and the included angle

a = 5, b = 7, angle C = 37 degrees
c 4.2539, angle A 45.02, angle B 97.98, area 10.5318

SSS: three sides (3-4-5 triangle)

a = 3, b = 4, c = 5
angle C 90, angle A 36.87, angle B 53.13, area 6

Frequently asked questions

What is the law of cosines?

The law of cosines states that c squared equals a squared plus b squared minus 2ab times the cosine of angle C. It generalizes the Pythagorean theorem to any triangle.

When should I use SAS versus SSS?

Use SAS when you know two sides and the angle between them. Use SSS when you know all three side lengths and want to find the angles.

How is the area calculated?

For SAS the area is one half times a times b times the sine of angle C. For SSS the area comes from Heron's formula using the three sides.

Why are some three-side inputs rejected?

Three lengths only form a triangle when each pair of sides adds up to more than the third. Inputs that break this triangle inequality are rejected.

Are angles in degrees or radians?

Angles are entered and reported in degrees. The included angle is converted to radians internally before the cosine and sine are taken.

Related tools