Math

Law of Cosines Calculator

Find a triangle's third side from two sides and the included angle.


Law of Cosines Calculator

Find a triangle’s third side using the law of cosines, given two known sides and the angle between them.

How it works

The formula is c = √(a² + b² − 2ab·cos(C)). Sides of 5 and 7 with a 60° included angle give a third side of about 6.245.

What this does not include

This is distinct from this site’s SSS triangle solver, which does the reverse — starting from three known sides to find the angles, rather than starting from two sides and an angle to find the third side.

How to use this calculator

  1. Enter the two known sides.
  2. Enter the angle between them (the included angle).

A worked example

Sides 5 and 7 with a 60° included angle: third side c = √(a²+b²−2ab·cosC) = 6.245.

Sides 8 and 10 with a 45° included angle: third side c = 7.1318.

What the variables mean

Variable Meaning
a, b Two known side lengths
Angle C The included angle between sides a and b

Edge cases worth knowing

The law of cosines generalizes the Pythagorean theorem — at a 90° angle, cos(90°)=0, and the formula reduces exactly to a²+b²=c², so the familiar right-triangle rule is really just a special case of this one.

An angle of 0° makes the “triangle” degenerate into a straight line with no real area, so the calculator declines to show a result for that case.

Frequently asked questions

Why is this called the “SAS” case?

Side-Angle-Side — you know two sides and the angle sandwiched between them, the specific configuration this version of the law of cosines is set up to solve.

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

The Pythagorean theorem is a special case of the law of cosines when the included angle is exactly 90°, since cos(90°) = 0 and the formula reduces to c² = a² + b².

What if the included angle is very small?

The third side shrinks toward the difference between the two known sides (|a − b|), since a very small angle means the two sides point in nearly the same direction.

Be the first to rate this

Written and checked by the Calculator Folks editorial team. How we write and review

Related calculators