Law of Cosines Calculator

Solve triangles using the Law of Cosines: c² = a² + b² − 2ab·cos(C). Handles SAS (find missing side) and SSS (find all angles). Includes Heron's area formula, Pythagorean theorem connection, and vector dot-product interpretation.

Side c (SAS)
Angle A (°)
Angle B (°)
Area = ½ab sin(C)
Extended More scenarios, charts & detailed breakdown
Side c
Angle A (°)
Angle B (°)
Area
Professional Full parameters & maximum detail

All Angles & Area

All angles (SSS)
Heron's formula area

Mathematical Connections

Vector dot product link
Pythagorean theorem special case

How to Use This Calculator

  1. For SAS: enter two sides and the included angle to find the missing side.
  2. For SSS: enter all three sides to find all angles.
  3. Use the Generalized tab to explore the Pythagorean and vector connections.

Formula

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

cos(A) = (b²+c²−a²)/(2bc) | Area = ½ab sin(C)

Example

SAS: a=5, b=7, C=60° → c²=25+49−2(5)(7)(0.5)=74−35=39 → c≈6.245

Frequently Asked Questions

  • The Law of Cosines states c² = a² + b² − 2ab·cos(C). It relates all three sides of a triangle to one of its angles, and generalises the Pythagorean theorem to any triangle.
  • Use it when you know SAS (two sides and their included angle) to find the third side, or SSS (all three sides) to find any angle. For AAS or ASA use the Law of Sines instead.
  • When C = 90°, cos(C) = 0, so c² = a² + b². The Law of Cosines reduces to the Pythagorean theorem as a special case.
  • Rearrange: cos(A) = (b² + c² − a²) / (2bc). Then A = arccos of that value. Use this for SSS to find all three angles.
  • Heron's formula computes area from three sides: Area = √(s(s−a)(s−b)(s−c)) where s = (a+b+c)/2. It gives the same area as ½ab·sin(C) computed from the Law of Cosines approach.

Related Calculators

Sources & References (5)
  1. Calculus — James Stewart, Appendix D — Cengage Learning
  2. OpenStax Algebra and Trigonometry — 10.2 Non-right Triangles: Law of Cosines — OpenStax
  3. Khan Academy — Law of Cosines — Khan Academy
  4. NIST DLMF — Trigonometric Identities — NIST
  5. MIT OCW 18.02 Multivariable Calculus — Vectors — MIT OCW