Precalculus Intermediate

Law of Cosines Calculator

Solve oblique triangles using c² = a² + b² − 2ab·cos C. Choose SAS (Side-Angle-Side) or SSS (Side-Side-Side) to find all six triangle measurements plus area — with a labeled diagram and numbered steps.

Live Calculator · Step-by-Step · Precalculus
Inputs
c² = a² + b² − 2ab·cos C
Side a
Side b
Angle C (°)
Load an example:
Results
Choose SAS or SSS, enter the known measurements, then press Solve Triangle to find all six values and the area.
Side a
Side b
Side c
Angle A
Angle B
Angle C
Area
Step-by-Step Solution
Triangle Diagram
Triangle sides Angle arcs Labels
Law of Cosines — All Three Forms

The Law of Cosines generalizes the Pythagorean theorem to any triangle. Write one form for each angle you might want to find:

Find cc² = a² + b² − 2ab·cos C
Find bb² = a² + c² − 2ac·cos B
Find aa² = b² + c² − 2bc·cos A
Solve for Ccos C = (a²+b²−c²) / (2ab)
Solve for Acos A = (b²+c²−a²) / (2bc)
Solve for Bcos B = (a²+c²−b²) / (2ac)
Use the Law of Cosines when you have SAS (two sides + included angle) or SSS (all three sides). For AAS/ASA/SSA triangles, use the Law of Sines instead.
Connection to the Pythagorean Theorem

When angle C = 90°, cos 90° = 0, so the entire last term vanishes:

c² = a² + b² − 2ab·(0) = a² + b²

That is exactly the Pythagorean theorem — so it's just a special case of the Law of Cosines!

When C < 90° the −2ab·cos C term is negative, making c shorter than the hypotenuse would be. When C > 90° the term is positive (cos is negative), making c longer. The law captures all three cases in one formula.

Quick check: enter a=3, b=4, C=90° (SSS equivalent: a=3, b=4, c=5). You should get a perfect right triangle with angles 90°, ~53.13°, ~36.87°.

Need help with the Law of Cosines?

Book a live session with a Naruhodo tutor — we'll walk through triangle solving, Law of Cosines vs. Law of Sines, and everything else in Precalculus.

Book a Session →