Overview
The law of cosines solves a triangle when two sides and the included angle are known, or when all three sides are known. It relates the third side to the squares of the other sides and the cosine of the included angle, generalizing the Pythagorean theorem.
Formula
c² = a² + b² − 2ab cos C.
How it works
Enter the two sides
a and b are the sides forming angle C.
Enter the included angle
The angle between sides a and b.
Compute the third side
c = √(a² + b² − 2ab cos C).
Compute the other angles
Use the law again or the law of sines.
Worked examples
Example 1: a = 5, b = 7, C = 60°
c = √(25 + 49 − 35) = √39 ≈ 6.2450.
Example 2: a = 3, b = 4, C = 90°
c = √(9 + 16) = 5, the Pythagorean case.
Frequently asked questions
When should I use the law of sines instead?
When two angles and a side are known, the law of sines is faster.
Does it work with obtuse angles?
Yes. The cosine of an obtuse angle is negative, making the third side larger.
How do I check the solution?
Confirm the angles sum to 180° and the longest side faces the largest angle.
This calculator is for educational and informational purposes only and is not a substitute for professional advice.