Law of Cosines Calculator

Enter two sides and the angle between them, and find the third side and the remaining angles using the law of cosines.

Side c
6.40
c² = a² + b² − 2ab·cos(C)
Angle A
38.66°
Angle B
51.34°
Embed on your website →

How to use the law of cosines calculator

  1. Enter side a and side b.
  2. Enter the angle C between these two sides, in degrees.
  3. Side c and the two remaining angles update automatically.

What is the law of cosines?

The law of cosines generalizes the Pythagorean theorem to all triangles, not just right triangles: c² = a² + b² − 2ab·cos(C). It's used to find the third side of a triangle when you know the other two sides and the angle between them (SAS), or to find all the angles when you know all three sides (SSS).

Note: if angle C is 90°, cos(C) becomes 0, and the formula reduces to the Pythagorean theorem (c² = a² + b²) — the law of cosines is thus a generalization that works for all angles, not just right angles.

Frequently asked questions

How does the law of cosines relate to the Pythagorean theorem?

The Pythagorean theorem is a special case of the law of cosines where the angle between the two known sides is exactly 90° — the term −2ab·cos(C) disappears, since cos(90°) = 0.

When do I use the law of cosines instead of the law of sines?

Use the law of cosines when you know two sides and the angle between them, or all three sides. Use our law of sines calculator when you instead know two angles and one side.

What is the law of cosines used for in practice?

Among other things, in surveying, navigation and physics — for example, to calculate the distance between two points when you know the distances from a third point and the angle between them (triangulation).

Embed this calculator on your website

Copy the code below to show this calculator directly on your blog or website — completely free.