MATHEMATICSTrigonometryMathematics Calculator
🔢

Law of Cosines — Generalized Pythagorean Theorem

c² = a² + b² - 2ab·cos(C). Solve any triangle given SAS (two sides + included angle) or SSS (all three sides). Reduces to Pythagorean theorem when C = 90°.

Did our AI summary help? Let us know.

Why: Understanding law of cosines helps you make better, data-driven decisions.

How: Enter Solve Mode, Side a, Side b to calculate results.

Run the calculator when you are ready.

Start CalculatingExplore mathematical calculations

Examples — Click to Load

law-of-cosines.sh
CALCULATED
$ solve --mode findSide --triangle
Side a
3
Side b
4
Side c
5
Area
6
∠A
36.869898°
∠B
53.130102°
∠C
90°
Mode
findSide
Share:
Law of Cosines Result
c = 5
Area = 6
∠A=36.869898°∠B=53.130102°∠C=90°
numbervibe.com/calculators/mathematics/trigonometry/law-of-cosines-calculator

Triangle Dimensions

Side Lengths

Angle Proportions

Calculation Breakdown

FORMULA
Law of Cosines
c² = a² + b² - 2ab·cos(C)
ext{Generalizes} ext{Pythagorean} ext{theorem}
SOLUTION
25
a²+b²-2ab·cos(C)
PRIMARY RESULT
SIDE C
5
√(c^{2})
ANGLES
Angle A
36.869898°
ANGLES
Angle B
53.130102°
AREA
Area
6
½ cdot a cdot b cdot \text{sin}(C)

For educational and informational purposes only. Verify with a qualified professional.

Key Takeaways

  • c² = a² + b² - 2ab·cos(C) — generalizes the Pythagorean theorem to any triangle
  • • Use for SAS (two sides + included angle) or SSS (all three sides)
  • • When C = 90°, cos(C) = 0 and it reduces to c² = a² + b²
  • • For obtuse angles, cos(C) < 0 so c² > a² + b²
  • • Area = ½·a·b·sin(C) uses the included angle

Did You Know?

📐Euclid had a geometric form of the Law of Cosines in Elements — the -2ab·cos(C) term comes from projectionSource: History of Mathematics
🛰️GPS uses the Law of Cosines for trilateration — finding position from distances to satellitesSource: GPS Technical Specs
🔺When C=90°, the Law of Cosines becomes the Pythagorean theorem. It's the same formula, extendedSource: Khan Academy
📡In physics, the Law of Cosines appears in vector addition: |A+B|² = |A|² + |B|² + 2|A||B|cos(θ)Source: Physics textbooks
🏗️Structural engineers use it to find diagonal lengths and forces in frameworksSource: Engineering Toolbox
🌐Spherical Law of Cosines is used in astronomy and navigation for great-circle distancesSource: Navigation standards

How It Works

Finding Side c (SAS)

Given sides a, b and included angle C: c² = a² + b² - 2ab·cos(C). Take the square root. The -2ab·cos(C) term adjusts for the angle — when C=90° it vanishes.

Finding Angle C (SSS)

Given all three sides: cos(C) = (a² + b² - c²) / (2ab). Then C = arccos(...). Use the angle opposite the side you are solving for.

When to Use vs Law of Sines

Law of Cosines: SAS, SSS. Law of Sines: AAS, ASA, SSA. Prefer Cosines when you have sides and an included angle.

Expert Tips

C is the Included Angle

For SAS, angle C must be between sides a and b. The side you find (c) is opposite angle C.

Check Triangle Inequality

For SSS, verify a+b>c, a+c>b, b+c>a before solving. Otherwise no triangle exists.

Obtuse Angles

When C>90°, cos(C)<0 so c² > a²+b². The "correction" term adds to the sum. See Cosine Calculator.

Area Formula

Area = ½·a·b·sin(C) uses the same two sides and included angle. No need to find c first.

Comparison: Law of Cosines vs Other Methods

FeatureLaw of CosinesLaw of SinesPythagorean
Best forSAS, SSSAAS, ASA, SSARight triangles
RequiresSides + angle or 3 sides2 angles + side2 sides, 90°
Ambiguous caseNoYes (SSA)No
FormulaQuadratic in cLinear ratioc²=a²+b²
When C=90°→ PythagoreanStill worksDirect
Area½ab·sin(C)Via sides½ab
DerivationCoordinate geometryArea formulaSimilar triangles
3D extensionSpherical versionSpherical versionN/A

Frequently Asked Questions

How does the Law of Cosines relate to the Pythagorean theorem?

When angle C = 90°, cos(C) = 0, so c² = a² + b² - 0 = a² + b². The Law of Cosines is the generalization for any angle.

When should I use Law of Cosines vs Law of Sines?

Use Law of Cosines for SAS (two sides + included angle) or SSS (all three sides). Use Law of Sines for AAS, ASA, or SSA.

What if c² is negative?

No triangle exists with those measurements. The angle may be impossible, or you may have swapped sides. Check your inputs.

Can I find all three angles with SSS?

Yes. Find one angle with the Law of Cosines, then use the Law of Sines for the others, or apply the Law of Cosines twice more.

How is the Law of Cosines derived?

Place the triangle in the coordinate plane with one vertex at the origin. Use the distance formula and the definition of cosine. The -2ab·cos(C) term comes from the dot product.

What about obtuse triangles?

The Law of Cosines works for all triangles. For obtuse C, cos(C) &lt; 0, so the correction term is positive and c² &gt; a² + b².

What units for sides and angles?

Sides can be any length unit. Angles in degrees or radians — ensure consistency. The calculator uses your chosen unit.

Is there a spherical Law of Cosines?

Yes. For spherical triangles (e.g., on Earth's surface), different formulas apply. Used in navigation and astronomy.

Law of Cosines by the Numbers

Find Side Formula
2
Solve Modes (SAS/SSS)
90°
→ Pythagorean
½ab·sin(C)
Area Formula

Disclaimer: Results for educational use. Verify triangle validity for engineering applications.

👈 START HERE
⬅️Jump in and explore the concept!
AI

Related Calculators