Enter two sides and the included angle, or all three sides, to solve a triangle with the law of cosines.
How to Use the Law of Cosines Calculator
In Two Sides & Angle mode, enter sides a and b plus the angle C between them to find the third side and remaining angles. In Three Sides mode, enter a, b, and c directly to solve for all three angles instead.
The law of cosines generalizes the Pythagorean theorem to triangles without a right angle, by adding a correction term that accounts for the included angle:
c² = a² + b² − 2ab × cos(C)
Set C to 90° and cos(90°) drops to zero, collapsing the formula straight back into the ordinary Pythagorean theorem — the law of cosines isn't a separate rule so much as the Pythagorean theorem's more general ancestor.
Rearranged to solve for an angle instead of a side, the same relationship works in reverse once all three sides are known:
A = cos⁻¹((b² + c² − a²) ÷ 2bc)
B = cos⁻¹((a² + c² − b²) ÷ 2ac)
C = 180° − A − B
That reverse form is what Three Sides mode runs — useful for surveying or triangulation problems where three distances get measured directly and the angles between them are what's actually unknown.