method
Law of Cosines Calculator
Apply the Law of Cosines (c\u00B2 = a\u00B2 + b\u00B2 \u2212 2ab\u00B7cos C) to solve triangles from SSS or SAS inputs. Step-by-step solution with all derived properties.
Click to show tips
Try an Example
Pick a scenario to see how the calculator works, then adjust the values
Find Angles from Three Sides (SSS)
A triangular park has paths of 120 m, 90 m, and 150 m. Find the angle at each corner.
Key values: a = 120 m · b = 90 m · c = 150 m
Find Third Side from Two Sides and Included Angle (SAS)
Two roads diverge at 55° — one is 8 km, the other is 12 km. What is the straight-line distance between their ends?
Key values: a = 8 km · b = 12 km · C = 55°
The Law of Cosines
The law of cosines generalizes the Pythagorean theorem to any triangle:
When , the cosine term vanishes () and you recover . The law of cosines handles what the Pythagorean theorem cannot: oblique (non-right) triangles.
By symmetry, equivalent forms exist for each side:
SSS Case: Three Sides Known
Rearrange the formula to find an angle when all three sides are known:
Example: Triangle with sides a = 5, b = 7, c = 8:
Strategy: In SSS problems, find the largest angle first (opposite the longest side). If it turns out to be obtuse, the other two angles must be acute, which avoids the ambiguous case when using the law of sines afterward.
SAS Case: Two Sides and Included Angle
Given sides and with included angle , find the third side directly:
Example: Sides 10 and 12, included angle 50°:
Law of Cosines vs. Law of Sines
| Situation | Use |
|---|---|
| SSS (three sides) | Law of Cosines |
| SAS (two sides + included angle) | Law of Cosines |
| ASA / AAS (two angles + one side) | Law of Sines |
| SSA (two sides + non-included angle) | Law of Sines (ambiguous case!) |
The law of cosines never produces an ambiguous case. The inverse cosine function returns a unique angle in , which is exactly the valid range for triangle angles. The law of sines can give two possible angles (the “ambiguous case”) because .
Geometric Derivation
Place the triangle with vertex C at the origin and side along the x-axis. Then vertex A is at and vertex B is at . The distance formula gives:
which is exactly the law of cosines. This coordinate proof shows it is simply the distance formula applied to a triangle.
Frequently Asked Questions
What is the law of cosines?
The law of cosines states that , where is the angle opposite side . It generalizes the Pythagorean theorem to all triangles. When , the cosine term vanishes and the formula reduces to .
When do I use the law of cosines instead of the law of sines?
Use the law of cosines for SSS (three sides known) and SAS (two sides and the included angle). Use the law of sines for ASA, AAS, and SSA cases. The law of cosines never produces an ambiguous case, making it the safer choice when applicable.
How do I find an angle using the law of cosines?
Rearrange to , then take the inverse cosine. For example, with sides 5, 7, and 8: , so .
Why doesn't the law of cosines have an ambiguous case?
The inverse cosine function returns a unique angle in , which is exactly the valid range for triangle angles. The law of sines can give two possible angles because , but cosine does not have this ambiguity.
How is the law of cosines derived?
Place vertex C at the origin with side along the x-axis. Vertex B is at . Applying the distance formula gives , which is the law of cosines.
More Math Calculators
Explore the category