This law of cosines calculator solves triangles the law of sines cannot start: two sides with the included angle (SAS), or all three sides (SSS).
c² = a² + b² − 2ab·cos C — Pythagoras, Generalized
Once one side-angle pair is known, the Law of Sines Calculator can finish the job by ratios; this page manufactures that first pair. Part of our Math Calculators collection.
Worked Example (Verified)
- a = 7, b = 9, C = 60° (defaults): c² = 49 + 81 − 126×0.5 = 67 → c = 8.185; then A = 47.78°, B = 72.22° (sum with C: 180.00° ✓)
- The correction term’s sign tells the story: acute C subtracts (side shorter than Pythagoras’ guess), obtuse C adds — the included angle literally opens the opposite side
- SSS sanity trio: 3-4-5 → angles 36.87°, 53.13°, 90.00° — the law of cosines returns the right angle exactly, as it must
- Degenerate warning embodied: sides 2, 3, 6 fail the triangle inequality and this calculator refuses them rather than printing imaginary angles
SAS vs SSS Workflow
- SAS: law of cosines once for the missing side, then (optionally) law of sines for a smaller angle — choose the angle opposite the shorter side to dodge ambiguity.
- SSS: find the largest angle first (opposite the longest side); arccos reports it faithfully, acute or obtuse.
- Area follows either route: ½ab·sin C once any included angle is known.
- Navigation and surveying live here: two measured sides and the angle between them is field data’s natural shape.
Related Tools
- Law of Sines Calculator — AAS/ASA and the SSA check
- Triangle Calculator — area, perimeter and angles basics
- Math Calculators — the full collection
Frequently Asked Questions
What is the law of cosines?
c² = a² + b² − 2ab·cos C (and its cyclic rearrangements). It relates all three sides to one angle, reducing to Pythagoras when that angle is 90°. Use it for SAS (find the third side) and SSS (find any angle via cos A = (b² + c² − a²)/(2bc)).
How do I solve an SAS triangle?
Apply c² = a² + b² − 2ab·cos C for the unknown side — defaults: 7, 9, 60° → c = 8.185 — then find remaining angles with the rearranged law of cosines or the law of sines. The worked example resolves to A = 47.78°, B = 72.22°.
How do I find angles from three sides?
cos A = (b² + c² − a²)/(2bc), cyclically. Find the largest angle first (opposite the longest side) because arccos distinguishes obtuse from acute — the law of sines cannot, which is why SSS belongs to cosines.
Why not always use the law of sines?
It needs a known side opposite a known angle to set its ratio. SAS and SSS data contain no such pair, so cosines goes first. After one pair exists, sines is often the faster finisher — the two laws are partners, not rivals.
What does the triangle inequality check do?
In SSS mode, sides must satisfy a + b > c, a + c > b and b + c > a. Violations describe no triangle (the two shorter sides cannot meet), so the calculator reports that instead of NaN angles.
Is this law of cosines calculator free?
Yes — free, instant, no sign-up.