How to Use the Law of Cosines Calculator
This law of cosines calculator supports both SAS (two sides and the included angle) and SSS (all three sides) modes. In SAS mode, enter the two known sides and the angle between them (in degrees) — the calculator finds the third side and all remaining angles. In SSS mode, enter all three side lengths — the calculator finds all three angles using the inverse cosine formula.
Both modes return all six triangle elements (three sides, three angles), the area, perimeter, and triangle type (acute, right, or obtuse). For AAS, ASA, or SSA configurations, use our Law of Sines calculator.
The Law of Cosines Formula
The Law of Cosines has three equivalent forms, one for each angle:
- c² = a² + b² − 2ab·cos(C)
- a² = b² + c² − 2bc·cos(A)
- b² = a² + c² − 2ac·cos(B)
In each form, the side on the left is opposite the angle in the cosine term on the right. The formula generalizes the Pythagorean theorem — when the included angle is 90°, the cosine term vanishes and c² = a² + b².
Solving for an Angle (SSS Case)
Rearranging: cos(A) = (b² + c² − a²) / (2bc). Apply arccos to both sides to find the angle. This only works if the expression inside arccos is between −1 and +1, which is guaranteed when the three sides satisfy the triangle inequality (each side must be less than the sum of the other two).
SAS vs SSS — When to Use Each
Use SAS when you know two sides and the angle formed between them. This is common in navigation (two legs of a journey and the turning angle between them), land surveying, and force vector problems. The formula directly gives the third side.
Use SSS when you know all three side lengths but need to find the angles. This is common in structural engineering (checking if bracing forms the correct angles), GPS triangulation, and geometry problems where sides are measured directly.
Triangle Classification
Once all angles are known, the triangle is classified by its largest angle:
- Acute triangle — all angles less than 90°; all sides satisfy a² + b² > c²
- Right triangle — one angle exactly 90°; the Pythagorean theorem holds exactly
- Obtuse triangle — one angle greater than 90°; the longest side satisfies c² > a² + b²
For right triangles, the Pythagorean theorem calculator is a simpler specialized tool.
Area Formulas
This calculator uses two area formulas depending on the inputs:
- SAS: Area = ½ × a × b × sin(C) — direct when the included angle is known
- SSS (Heron's formula): Area = √(s(s−a)(s−b)(s−c)) where s = (a+b+c)/2
Both formulas give the same result once the triangle is fully solved. Heron's formula is remarkable because it uses only side lengths — no angles required.
Real-World Applications
- Navigation — a ship travels 50 km north, turns, travels 30 km in a new direction; the Law of Cosines finds the straight-line distance back to port
- Surveying — measuring two sides of a triangular plot and the included angle to find the third boundary line
- Structural engineering — verifying that a triangular truss with known member lengths forms the correct angles
- Physics (force vectors) — finding the resultant of two forces using vector addition via the parallelogram law, equivalent to the Law of Cosines
- GPS and trilateration — determining position from three known distances using SSS geometry
Sources & References
- Law of cosines — Wikipedia
- Heron's formula — Wikipedia
- Solution of triangles — Wikipedia