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).

Radians
7. Measuring Angles
3 problems
Topic
Solving Right Triangles
8. Trigonometric Functions on Right Triangles
5 problems
Topic
Inverse Sine, Cosine, & Tangent
11. Inverse Trigonometric Functions and Basic Trig Equations
5 problems
Topic
Law of Sines
13. Non-Right Triangles
5 problems
Topic
Law of Cosines
13. Non-Right Triangles
5 problems
Topic
Area of SAS & ASA Triangles
13. Non-Right Triangles
5 problems
Topic
7. Measuring Angles
4 topics 8 problems
Chapter
8. Trigonometric Functions on Right Triangles
4 topics 7 problems
Chapter
11. Inverse Trigonometric Functions and Basic Trig Equations
3 topics 7 problems
Chapter
13. Non-Right Triangles
3 topics 8 problems
Chapter
Radians
1. Measuring Angles
6 problems
Topic
Patrick
Solving Right Triangles
2. Trigonometric Functions on Right Triangles
4 problems
Topic
Patrick
Inverse Sine, Cosine, & Tangent
5. Inverse Trigonometric Functions and Basic Trigonometric Equations
7 problems
Topic
Patrick
Law of Sines
7. Non-Right Triangles
5 problems
Topic
Patrick
Law of Cosines
7. Non-Right Triangles
4 problems
Topic
Patrick
Area of SAS & ASA Triangles
7. Non-Right Triangles
3 problems
Topic
1. Measuring Angles
4 topics 11 problems
Chapter
Patrick
2. Trigonometric Functions on Right Triangles
4 topics 7 problems
Chapter
Patrick
5. Inverse Trigonometric Functions and Basic Trigonometric Equations
3 topics 9 problems
Chapter
Patrick
7. Non-Right Triangles
3 topics 4 problems
Chapter
Patrick
Solving Right Triangles
12. Trigonometric Functions
5 problems
Topic
12. Trigonometric Functions - Part 1 of 3
4 topics 12 problems
Chapter
12. Trigonometric Functions - Part 2 of 3
4 topics 12 problems
Chapter
Ally
12. Trigonometric Functions - Part 3 of 3
2 topics 6 problems
Chapter
Dot Product Calculator
Calculate dot product, angle, orthogonality, and vector projections
Trigonometry Calculator
Calculate trig values, inverse trig, and right-triangle solving in degrees or radians, with steps
Law of Sines Calculator
Solve triangles using Law of Sines, including SSA ambiguous cases
Area Calculator
Calculate area for 20 shapes with formulas, steps, unit conversion, and diagrams
Relative Velocity Calculator
Calculate relative velocity in 1D and 2D motion with riverboat, airplane wind, and moving observer problems
Electric Field Calculator
Calculate electric fields from point charges with vectors, force mode, visuals, and step-by-step solutions
Pythagorean Theorem Calculator
Find hypotenuse, solve missing leg, or check if sides make right triangle
Spaceflight & Orbital Mechanics Calculator
Calculate orbital velocity, escape velocity, delta-v, transfers, and spacecraft orbits around celestial bodies
Unit Circle Calculator
Calculate sin, cos, tan, quadrant, reference angle, and unit circle coordinates
Complex Numbers Calculator
Add, subtract, multiply, and divide complex numbers — with Argand diagrams and step-by-step solutions
Radians ↔ Degrees Converter
Convert angles between radians and degrees instantly
Distance Calculator
Calculate distance in 2D, 3D, point-to-line, speed/time, lat-long, or scaled grid modes
Triangle Calculator
Solve right and any triangle (SSS, SAS, ASA, SSA). Find sides, angles, area, perimeter
Right Triangle Calculator
Solve right triangles: sides, angles, area, perimeter, steps, visual
Back to all calculatorsAll calculators