Last updated October 5, 2026 · Report an error
The law of cosines generalizes the Pythagorean theorem to any triangle, not just right triangles — letting you find a missing angle from three known sides, or a missing side from two sides and the angle between them.
This calculator solves either direction of the law of cosines.
How it works
Choose whether you know all three sides or two sides plus the included angle. The calculator applies the appropriate rearrangement of the law of cosines formula to solve for the missing angle or side.
- Enter what do you know?.
- Enter side a.
- Enter side b.
- Enter side c (if using all three sides).
- Enter included angle C in degrees (if using two sides + angle).
- Click Calculate to see your results.
Examples
3-4-5 right triangle
Given sides 3, 4, and 5, the law of cosines finds the angle opposite the side of length 5 to be exactly 90°, confirming this is a right triangle.
Who should use it
- Finding a triangle's angle from its three side lengths for a trigonometry course.
- Finding a missing side length from two sides and the angle between them, like in navigation or surveying.
Industry applications
- Trigonometry and mathematics education
- Surveying, navigation, and engineering
Advantages
- Solves both directions of the law of cosines from a single tool.
- Validates the triangle inequality for the three-sides case.
Limitations
- Doesn't handle the SSA (two sides + non-included angle) case — that's the law of sines' domain, and is ambiguous in general.
Common mistakes to avoid
- Trying to use two sides and a NON-included angle (SSA) with this tool — the law of cosines specifically needs the angle between the two given sides, not just any angle.
- Entering side lengths that violate the triangle inequality, which don't describe any real triangle.
Best practices
- Use the law of cosines for SAS (two sides + included angle) or SSS (three sides) cases; use the law of sines instead for AAS or ASA cases (two angles known).
Tips
- The law of cosines works for ANY triangle (acute, right, or obtuse) — unlike some simplified formulas that only work for right triangles, making it one of the most generally useful trigonometric tools.