All calculators

Education

Law of Cosines Calculator

Last updated: May 31, 2026

Written by Blake Boege

A Law of Cosines calculator is a mathematical tool that solves oblique or right triangles using the generalized Pythagorean theorem: c² = a² + b² − 2ab·cos(C). Given two sides and their included angle (SAS) or all three side lengths (SSS), it calculates the remaining side length and all unknown interior angles.

Solve oblique or right triangles using side-angle-side (SAS) or side-side-side (SSS) measurements with step-by-step math.

Quick Answer

Solve missing side lengths and angles of a triangle using the Law of Cosines. Supports SAS and SSS inputs with step-by-step math.

e.g. 8

e.g. 11

e.g. 47

ABCabc
Triangle Result

Solved side c

8.0603

Angle A = 46.54°, Angle B = 86.46°

Side a8
Side b11
Side c8.0603
Angle A46.54°
Angle B86.46°
Angle C47°
Perimeter27.0603
Area32.1796

Step-by-step solution

Step 1:Apply Law of Cosines to find side c: c² = a² + b² - 2ab·cos(C)
Step 2:c² = 8² + 11² - 2·(8)·(11)·cos(47°)
Step 3:c² = 64 + 121 - 176·(0.682)
Step 4:c² = 64.9683
Step 5:c = √64.9683 ≈ 8.0603
Step 6:Find Angle A using Law of Cosines: cos(A) = (b² + c² - a²) / (2bc)
Step 7:cos(A) = (11² + 8.0603² - 8²) / (2 · 11 · 8.0603)
Step 8:cos(A) ≈ 0.6878
Step 9:A = arccos(0.6878) ≈ 46.54°
Step 10:Find the third angle B: B = 180° - A - C = 180° - 46.54° - 47° = 86.46°
Was this helpful?

Examples

SAS: a=8, b=11, C=47°

c ≈ 8.08, A ≈ 46.54°, B ≈ 86.46°

SSS: a=8, b=11, c=14

A ≈ 34.09°, B ≈ 50.32°, C ≈ 95.59°

How it works

How the Law of Cosines Works

The Law of Cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. It is formulated as:

The Standard Formulas

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

Rearranged for angles: cos(C) = (a² + b² − c²) / (2ab)

To solve the other oblique triangle cases (such as ASA or AAS), check out our Law of Sines calculator or use the classic Pythagorean theorem calculator if you are working with a right triangle. You can also calculate the final space with our triangle area calculator.

Triangle Inequality Theorem

For three side lengths to form a real triangle, they must satisfy the triangle inequality: the sum of the lengths of any two sides must be strictly greater than the length of the remaining side. If this condition is not met (for example, sides 3, 4, and 8), the sides cannot connect to form a closed shape.

Related Calculators

More tools from Education

Frequently asked questions

Use the Law of Cosines when you are given either all three sides (SSS) or two sides and the included angle (SAS). Use the Law of Sines when you know an angle and its opposite side (AAS, ASA, or the ambiguous SSA case).

The standard formula is c² = a² + b² − 2ab·cos(C). It can be rewritten to solve for any side (e.g., a² = b² + c² − 2bc·cos(A)) or angle (e.g., cos(C) = (a² + b² − c²) / 2ab).

The Law of Cosines is a generalization of the Pythagorean theorem. If the angle C is 90° (a right angle), then cos(90°) = 0, and the formula simplifies exactly to c² = a² + b², which is the Pythagorean theorem.

In SSS mode, a solution is impossible if the side lengths do not satisfy the triangle inequality (the sum of any two sides must be strictly greater than the third side). If the inequality fails, no triangle can exist.