Law of Cosines Calculator

Solve triangles using the Law of Cosines: c² = a² + b² − 2ab×cos(C). Find unknown sides and angles for SAS and SSS cases. Generalizes the Pythagorean theorem to any triangle.

📐 Trigonometry📐 c² = a² + b² - 2ab·cos(C)🔢 Math
Solve for
Side a
Side b
Angle C (degrees) or Side c
(see mode above)
Please enter valid values.

Formula & Reference

VariableSymbolFormulaUnits
Law of Cosines Calculatorc² = a² + b² - 2ab·cos(C)sides and degrees

Step-by-Step Examples

Example 1
SAS

a=8, b=11, C=37°.

  • c²=64+121−2×88×cos(37°)=185−140.55=44.45
  • c=√44.45≈6.67
✓ c ≈ 6.67
Example 2
SSS (Find Angle)

a=5, b=7, c=10.

  • cos(C)=(25+49−100)/70=−26/70=−0.3714
  • C=arccos(−0.3714)≈111.8°
  • Obtuse angle!
✓ C ≈ 111.8°
Example 3
Pythagorean Check

a=3, b=4, C=90°.

  • c²=9+16−2×12×cos90°=25−0=25
  • c=5 ✓ (Pythagorean theorem special case)
✓ c=5 — Pythagorean theorem

Real-World Applications

Common Mistakes to Avoid

⚠️
Using sine rule when cosine is needed

SSS and SAS require Law of Cosines. Law of Sines doesn't work when the included angle is given.

⚠️
Obtuse angles give negative cosine

cos(C)>0 for acute C, cos(C)<0 for obtuse C. A negative value from the formula is valid and expected.

⚠️
Rounding intermediate steps

Avoid rounding until the final answer. Rounding c early and using it to find angles compounds error.

Frequently Asked Questions

What is the Law of Cosines?
Generalizes the Pythagorean theorem: c²=a²+b²−2ab·cos(C). When C=90°, cos(C)=0 and it reduces to a²+b²=c².
When to use it?
SAS: two sides and the INCLUDED angle → find the third side. SSS: all three sides → find any angle.
How is it derived?
Drop a perpendicular from vertex C to side c, creating two right triangles. Apply Pythagorean theorem to each and combine.
What is the relationship to dot product?
For vectors a and b: |a−b|²=|a|²+|b|²−2a·b. Law of Cosines expresses this geometrically: a·b=|a||b|cos(θ).
What is the circumradius?
By Law of Cosines and Sines: R=abc/(4K) where K=area. Or use a/sin(A)=2R from Law of Sines.

Related Math Calculators

Formula Explorer connections

Interpretation: This relationship connects dimensions, coordinates, angles or trigonometric ratios to a geometric measurement. Assumption: Use a consistent angle mode and length unit, identify the intended shape or coordinate system, and verify that the supplied dimensions form valid geometry.

Law of Sines Calculator →Line in 3D Calculator →Matrix Diagonalization Calculator →Math Formula Explorer →