Advertisement

Law of Cosines Calculator

Solve triangles with the law of cosines: SAS mode finds the third side, SSS mode finds an angle.

Law of Cosines

Pick a mode, then enter the known parts.

Result
-

Enter numbers to see the result.

Angle A
-
Angle B
-
Formula: c^2 = a^2 + b^2 - 2ab cos C. Angle: cos C = (a^2 + b^2 - c^2) / (2ab).
Advertisement

Pythagoras, generalized

The law of cosines extends Pythagoras to any triangle: c^2 = a^2 + b^2 - 2ab cos C. When angle C is 90 degrees the cosine term vanishes and you get a^2 + b^2 = c^2 back. It is the right tool whenever you know two sides and the included angle.

Angles from three sides

Rearranged, the same formula gives any angle from the three sides: cos C = (a^2 + b^2 - c^2) / (2ab). The tool validates the triangle inequality first, so impossible side triples are rejected with an explanation.

Law of Cosines FAQs

How do I find side c if a=5, b=7, C=60 deg?
c = sqrt(25 + 49 - 70 x 0.5) = sqrt(39), about 6.245. The defaults are preloaded in SAS mode.
What is the law of cosines formula?
c^2 = a^2 + b^2 - 2ab cos C, where C is the angle between sides a and b and c is the side opposite it.
How do I find an angle from three sides?
Switch to SSS mode and enter a, b, c. The tool computes C = arccos((a^2 + b^2 - c^2) / (2ab)).
Why does it reject my sides?
Three lengths must satisfy the triangle inequality: each pair must sum to more than the third. Otherwise no triangle exists.
Is my data sent to a server?
No. Everything is computed locally in your browser.
Advertisement