AbraCalc

Law of Cosines Calculator

Use the law of cosines to find the third side of any triangle when two sides and the included angle are known. Enter sides a and b with included angle C in degrees to compute side c.

Embed this tool on your site

How to use this tool

  1. Enter side a, side b and included angle c in the fields above.
  2. Results update instantly as you type — or click Calculate.
  3. Read your side c and the full breakdown beneath it.

Formula

c^2 = a^2 + b^2 - 2ab*cos(C)

How it works

Apply the cosine rule: c = √(a² + b² − 2ab cos C), where angle C is in degrees.

Worked example

90-degree case reduces to Pythagorean theorem

  1. a
  2. =
  3. 3
  4. ,
  5. b
  6. =
  7. 4
  8. ,
  9. C
  10. =
  11. 9
  12. 0
  13. .
  14. c
  15. o
  16. s
  17. (
  18. 9
  19. 0
  20. )
  21. =
  22. 0
  23. .
  24. c
  25. =
  26. s
  27. q
  28. r
  29. t
  30. (
  31. 9
  32. +
  33. 1
  34. 6
  35. )
  36. =
  37. 5
  38. .

Common mistakes to avoid

  • Using the angle in degrees without converting to radians when computing cos(C) in manual calculations — most calculators accept degrees directly, but ensure the mode is set correctly.
  • Misidentifying which angle is C — C must be the angle included between sides a and b (the angle at the vertex where the two known sides meet).
  • Using the law of cosines when only one side and two angles are known — in that case the law of sines is more appropriate.

Key terms

Frequently asked questions

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). Use the law of sines when you know two angles and one side (AAS or ASA) or two sides and a non-included angle (SSA, with caution).
Can the law of cosines be rearranged to find an angle?
Yes. cos(C) = (a^2 + b^2 - c^2) / (2ab). If you know all three sides, solve for any angle by rearranging. This is the SSS case.
Does the law of cosines reduce to the Pythagorean theorem for right triangles?
Yes. When C = 90 degrees, cos(C) = 0, and c^2 = a^2 + b^2 - 2ab*0 = a^2 + b^2, which is exactly the Pythagorean theorem.

References & sources