The law of cosines
The law of cosines generalizes the Pythagorean theorem to any triangle: c squared = a squared plus b squared minus 2ab times the cosine of the included angle C. This calculator uses it two ways — from two sides and the angle between them (SAS), or from all three sides (SSS) — to find every remaining side and angle, plus the area and perimeter.
How it solves
In the SAS case, the formula gives the third side directly, then each angle follows by rearranging the same law: cos A = (b squared plus c squared minus a squared) divided by 2bc. In the SSS case, all three angles come straight from that rearrangement, with the area from Herons formula.
When to use it instead of the law of sines
The law of cosines handles exactly the cases the law of sines cannot start from — two sides with the included angle, or three sides — and it never suffers the ambiguous-case problem, making it the safer choice for side-heavy data.
Related tools
For two angles and a side, use the law of sines calculator; for 90-degree triangles, the right triangle calculator.
Worked example
Sides a = 5, b = 7 with included angle C = 60 give c = the square root of (25 + 49 – 35) = the square root of 39, about 6.24, with an area near 15.16.
FAQ
Which angle is the included one?
In SAS mode, angle C sits between sides a and b, and the side opposite it, c, is the one solved first.
What if three sides cannot form a triangle?
If the longest side meets or exceeds the sum of the other two, no triangle exists and the calculator flags it.
