The law of cosines generalises Pythagoras to triangles that are not right-angled. It states that the square on one side equals the sum of the squares on the other two, minus twice their product times the cosine of the angle between them. When that angle is 90 degrees the cosine is zero and the correction term vanishes, leaving Pythagoras exactly.
Rearranged for the angle it becomes a direct formula, and applying it three times gives every angle in the triangle. The sign of the cosine tells you the type immediately: a negative cosine means an obtuse angle, zero means right-angled and all positive means acute. The three angles must sum to 180 degrees, which the page reports as an arithmetic check.
The formula
a, b, c- The three side lengths
A- The angle opposite side a
B, C- The angles opposite sides b and c
How it works, step by step
- Enter the three side lengths.
- The gauge shows the largest angle, which is always opposite the longest side.
- All three angles appear below along with the sum check.
- The classification tells you whether the triangle is acute, right-angled or obtuse.
Worked examples
Sides of 7, 10 and 5
The largest angle is opposite the 10 side: cos B = (49 + 25 − 100) ÷ 70 = -0.371429, giving 111.804 degrees. The negative cosine confirms an obtuse triangle.
A 3-4-5 triangle
cos of the angle opposite the 5 side is (9 + 16 − 25) ÷ 24 = 0, so that angle is exactly 90 degrees. The other two are 36.870 and 53.130 degrees.
How to read your score
Frequently asked questions
How does this relate to Pythagoras?
It is the general case. When the angle is 90 degrees its cosine is zero and the law of cosines collapses to a squared plus b squared equals c squared.
Which angle is the largest?
Always the one opposite the longest side. That relationship holds in every triangle and is a useful sanity check on your arithmetic.
How do I tell an obtuse triangle from the sides alone?
Compare the square of the longest side with the sum of the squares of the other two. If it is larger, the triangle is obtuse; equal means right-angled; smaller means acute.
Why do I get an error for some side combinations?
Because they violate the triangle inequality. If one side is at least as long as the other two combined, no triangle can be formed and no angles exist.
Angles from side lengths
| Sides | Angle opposite a | Angle opposite b | Angle opposite c | Type |
|---|---|---|---|---|
| 3, 4, 5 | 36.87 | 53.13 | 90.00 | Right-angled |
| 5, 5, 5 | 60.00 | 60.00 | 60.00 | Acute |
| 7, 10, 5 | 40.54 | 111.80 | 27.66 | Obtuse |
| 6, 7, 8 | 46.57 | 57.91 | 75.52 | Acute |
| 5, 12, 13 | 22.62 | 67.38 | 90.00 | Right-angled |
| 2, 3, 4 | 28.96 | 46.57 | 104.48 | Obtuse |
| 10, 10, 6 | 72.54 | 72.54 | 34.92 | Acute |
In every row the three angles sum to 180 degrees.