Skip to main content

Law of Cosines Calculator

Solve triangles using the Law of Cosines: c² = a² + b² − 2ab·cos(C). Perfect for SAS (two sides + included angle) and SSS (three sides). Includes a live triangle diagram, smart validity checks, and student-friendly step-by-step.

Which method should I use?

Have SSS or SAS? → Law of Cosines
Have ASA / AAS / SSA? → Law of Sines ✅ (SSA can be ambiguous)

Background

The Law of Cosines is a triangle-solving formula that generalizes the Pythagorean theorem to any triangle (not just right triangles). It connects three sides and an included angle: c² = a² + b² − 2ab·cos(C).

It’s the best tool when you have SAS (two sides + the included angle) or SSS (three sides). For ASA/AAS (two angles + a side) and most SSA cases, the Law of Sines is usually the better first move.

Enter values

Tip: Geometry problems almost always use degrees.

Rounding affects display only.

SAS (find a missing side)

Included angle means it sits between the two known sides.

Included angle reminder

If you know sides a and b, the included angle is C.
Law of Cosines uses: c²=a²+b²−2ab·cos(C)

Output: side c (opposite angle C).

SSS (find an angle via arccos)

We’ll use arccos and clamp for safety.

Triangle inequality is checked automatically: a+b>c, a+c>b, b+c>a.

Solve using SAS

Plan

1) Use Law of Cosines to find c.
2) Use Law of Sines to find A and B (fast + stable).
3) Use angle sum as a final check.

Solve using SSS

Plan

Use Law of Cosines three times to find angles A, B, C via arccos. Triangle inequality is checked first.

Options

Chips prefill and calculate immediately.

Result

No results yet. Enter values and click Calculate.

How to use this calculator

  • Pick a mode: Find a side (SAS), Find an angle (SSS), or Solve the whole triangle.
  • Choose degrees or radians, enter values, then click Calculate.
  • Use the diagram to sanity check: bigger angle ↔ bigger opposite side.

How this calculator works

  • Law of Cosines (side form): c² = a² + b² − 2ab·cos(C).
  • Law of Cosines (angle form): cos(C) = (a² + b² − c²) / (2ab), then C = arccos(…).
  • Triangle inequality (SSS): each pair of sides must sum to more than the third.

Formula & Equation Used

Side from SAS: c = √(a² + b² − 2ab·cos(C))

Angle from SSS: C = arccos((a² + b² − c²)/(2ab))

Angle sum: A + B + C = 180° (or π radians)

Example Problem & Step-by-Step Solution

Example 1 — SAS (find a side)

Given a=7, b=10, C=60°. Find c.

  1. Use Law of Cosines: c² = a² + b² − 2ab·cos(C).
  2. Plug in: c² = 7² + 10² − 2·7·10·cos(60°).
  3. Compute: c² = 49 + 100 − 140·0.5 = 79.
  4. So c = √79 ≈ 8.89.

Example 2 — SSS (find an angle)

Given a=7, b=8, c=9. Find angle C.

  1. Compute cos(C)=(a²+b²−c²)/(2ab).
  2. Plug in: cos(C)=(49+64−81)/(2·7·8)=32/112≈0.2857.
  3. Then C=arccos(0.2857)≈73.40°.

Example 3 — Solve whole triangle (SAS)

Given a=5, b=8, C=110°. Solve the triangle.

  1. Find c with Law of Cosines.
  2. Then use Law of Sines to compute A and B.
  3. Check: A+B+C=180°.

Frequently Asked Questions

Q: When should I use Law of Cosines?

When you have SSS or SAS. It’s the best “first move” in those cases.

Q: Why do you clamp the arccos input?

Because rounding can produce tiny values like 1.0000000002, which would break arccos. Clamping keeps it safe.

Q: Can I solve SSA with Law of Cosines?

Not reliably. SSA is usually a Law of Sines scenario and can be ambiguous (0/1/2 triangles).