Law of Cosines Calculator
Solve triangles with the law of cosines from SAS or SSS inputs, including missing sides, angles, area, and perimeter.
Frequently Asked Questions about the Law of Cosines Calculator
What is the law of cosines?
The law of cosines relates the three sides of a triangle to one of its angles: c^2 = a^2 + b^2 - 2ab cos(C), where C is the angle opposite side c. It is a generalization of the Pythagorean theorem, since cos(90 degrees) is 0 and the formula reduces to c^2 = a^2 + b^2 for a right triangle. You can rotate the labels to write the same relation for sides a and b.
When should I use the law of cosines instead of the law of sines?
Use the law of cosines when you know two sides and the included angle (SAS) or all three sides (SSS), because those cases have a single, unambiguous solution. The law of sines is better when you know two angles and a side (AAS or ASA). The law of cosines also avoids the ambiguous case that can produce two valid triangles with the law of sines.
What is the difference between the SAS and SSS modes?
In SAS mode you enter two sides (a and b) and the angle between them (C), and the calculator finds the third side, the other two angles, and the area. In SSS mode you enter all three sides and the calculator finds all three angles and the area. Both modes use the same law of cosines formula, just rearranged to solve for a side or for an angle.
Why does the calculator reject some sets of three sides?
Three lengths only form a triangle when each side is shorter than the sum of the other two, which is the triangle inequality. For example 1, 2, and 3 cannot form a triangle because 1 plus 2 equals 3, so the shape collapses into a straight line. When the inequality fails, the calculator returns no result instead of an impossible triangle.
How does the calculator find the area?
In SAS mode it uses the formula area = (1/2) a b sin(C), since two sides and the included angle are known directly. In SSS mode it uses Heron's formula, area = the square root of s(s - a)(s - b)(s - c), where s is the semiperimeter (a + b + c) divided by 2. Both give the same area for the same triangle.
How does the calculator classify the triangle?
It looks at the largest angle. If the largest angle is exactly 90 degrees the triangle is right, if it is below 90 degrees the triangle is acute, and if it is above 90 degrees the triangle is obtuse. The largest angle always sits opposite the longest side.
Related Calculators
More calculators in "Math"
Law of Sines CalculatorMatrix Inverse CalculatorProportion CalculatorSignificant Figures CalculatorPercentage CalculatorGCF Calculator (Greatest Common Factor)
See all 202 calculators in "Math"