What Is the Law of Cosines?
The Law of Cosines relates the lengths of the three sides of any triangle to the cosine of one of its angles. It is a generalization of the Pythagorean theorem: when the included angle is 90°, the cosine term vanishes and the formula reduces to \(c^2 = a^2 + b^2\). This makes it the go-to tool for solving triangles when you know two sides and the angle between them (the SAS case).
How to Use This Calculator
Enter the two known side lengths, a and b, and the included angle C (the angle between those two sides, in degrees). The calculator returns the third side c, the two remaining angles A and B, and the area of the triangle. Angle C must be between 0° and 180°.
The Formula Explained
The core equation is $$c^2 = a^2 + b^2 - 2ab\cos(C)$$ Take the square root to get side c. Once all three sides are known, the remaining angles are found by rearranging the same law: \(\cos(A) = \frac{b^2 + c^2 - a^2}{2bc}\). The triangle area uses the SAS formula \(\text{Area} = \tfrac{1}{2}ab\sin(C)\).
Worked Example
Suppose a = 5, b = 7, and C = 60°. Then $$c^2 = 25 + 49 - 2(5)(7)\cos(60°) = 74 - 70(0.5) = 74 - 35 = 39,$$ so \(c = \sqrt{39} \approx 6.245\). The area is $$\tfrac{1}{2}\cdot 5\cdot 7\cdot\sin(60°) = 17.5 \times 0.8660 \approx 15.16.$$
FAQ
When should I use the Law of Cosines instead of the Law of Sines? Use the Law of Cosines for SAS (two sides and the included angle) or SSS (three sides) problems. Use the Law of Sines when you have an angle paired with its opposite side.
What units does the angle use? Enter the angle in degrees; the calculator converts to radians internally.
Can it handle obtuse triangles? Yes. For angles greater than 90°, \(\cos(C)\) is negative, which correctly makes side c longer.