ToolBark
Math

Law of Cosines Calculator

Solve any triangle side or angle with the law of cosines

Solve For

SAS — Two sides and the included angle are known. Finds the third side and all angles.

Known Values

Angle C is the angle between sides a and b.

Examples

Results

Missing Side c8.888194units

Full Triangle

Side a7units
Side b10units
Side c8.888194units
Angle A (opposite a)43.003912°
Angle B (opposite b)76.996088°
Angle C (opposite c)60°
Perimeter25.888194units
Area30.310889units²
Angle sum: 180° (should be 180°)

Formula Reference

Given sides a, b and included angle C, find side c:

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

Then find remaining angles using the law of cosines again:

cos(A) = (b² + c² − a²) / (2bc)
B = 180° − A − C

The law of cosines generalises the Pythagorean theorem: when C = 90°, cos(C) = 0 and the formula reduces to c² = a² + b².

About

The law of cosines calculator instantly solves any triangle when you know two sides and the included angle (SAS) or all three sides (SSS). It applies the cosine rule — c² = a² + b² − 2ab·cos(C) — to find every unknown side and angle, plus the triangle's area and perimeter, with full step-by-step formula display.

FAQ
What is the law of cosines?+

The law of cosines relates the three sides of a triangle to one of its angles: c² = a² + b² − 2ab·cos(C). It generalises the Pythagorean theorem — when C is 90°, cos(C) = 0 and the formula simplifies to c² = a² + b².

When should I use SAS vs SSS mode?+

Use SAS (Side-Angle-Side) mode when you know two sides and the angle between them and need to find the third side. Use SSS mode when all three side lengths are already known and you need to find every interior angle.

Can the law of cosines solve any triangle?+

Yes — the law of cosines works for all triangle types: acute, obtuse, and right-angled. It can solve SAS and SSS cases directly. For ASA or AAS cases the law of sines is typically more convenient, though both laws give the same result.

Why does the triangle inequality matter?+

For a valid triangle, each side must be shorter than the sum of the other two. If this condition is violated — for example sides 1, 2, 10 — no real triangle can be formed and the calculator will show an error instead of a meaningless result.

Related tools