Geometry formula reference

Law of Cosines

Relates the sides of any triangle to the cosine of one included angle.

Open in editor
LaTeXc^2=a^2+b^2-2ab\cos C

Variables

  • a, b, c: side lengths
  • C: angle opposite side c

How to use this formula

Relates the sides of any triangle to the cosine of one included angle.

Important notes

  • It reduces to the Pythagorean theorem when C is 90 degrees.
  • Use matching opposite side-angle pairs.

Quick example

For a = 3, b = 4, and C = 90°, c = 5.

Applicability, worked calculation, and verification

Domain and applicability

Use the law of cosines for a Euclidean triangle when the paired side lengths and included or opposite angle are identified consistently.

Assumptions and domain checks

  • Side lengths are positive and form a valid triangle.
  • Angle C is opposite side c, and all angle measurements use a consistent degree or radian mode.

Do not use this formula when

  • Do not use Law of Cosines when the stated lengths, angles, or geometric conditions do not match the figure or use inconsistent units.

Boundary and special cases

  • At C=0° or 180°, the configuration becomes degenerate and should be interpreted as a limiting case rather than an ordinary triangle.
  • For C=90°, the law of cosines must reduce exactly to the Pythagorean theorem.

Equivalent and alternative forms

  • Solving for the angle gives C=arccos((a²+b²−c²)/(2ab)) when a and b are nonzero and the ratio lies in [−1,1].

Worked example

Input

a=3, b=4, C=90°

Output

c=5

For a=3, b=4, and C=90°, c²=9+16−24·0=25, so c=5.

  1. Label each side opposite its corresponding angle and identify the known side-angle relationship.
  2. Substitute a, b, and C into c²=a²+b²−2ab cos C with the correct angle mode.
  3. Evaluate the squared length before taking the nonnegative square root for the physical side length.
  4. Verify that the three side lengths satisfy the triangle inequality and that the result reduces to the Pythagorean theorem when C=90°.

Independent verification

Check the triangle inequalities and, for a right angle, confirm that the cosine term vanishes and the equation becomes c²=a²+b².

Common mistakes

  • Do not pair an angle with the wrong opposite side.
  • Check calculator angle mode and preserve the negative sign before 2ab cos C.

Continue the workflow

Use Law of Cosines in your own work

  1. Check the domainMatch the variables and assumptions to the problem before substituting values.
  2. Copy the exact notationPreserve grouping, signs, and exponents in c^2=a^2+b^2-2ab\cos C.
  3. Edit or convertOpen the expression in the LaTeX editor, then export it for your document or web page.

Review and verification

Last reviewed: 2026-07-26

Review method: Reviewed the notation, variable definitions, applicability conditions, worked example, boundary cases, and independent verification method for Law of Cosines.

Verified against: OpenStax Algebra and Trigonometry 2e

Automated quality check: Passed the core formula indexing gate.

Formula references

  • Algebra and Trigonometry 2eOpenStax, Rice University — Reviewed algebra, functions, sequences, trigonometry, and analytic geometry definitions and examples.

Frequently asked questions

What is the Law of Cosines used for?

Relates the sides of any triangle to the cosine of one included angle.

Can I copy this formula as LaTeX?

Yes. Copy c^2=a^2+b^2-2ab\cos C or open it in the LaTeX editor.

What should I check before using it?

Confirm that each variable, unit, domain restriction, and assumption matches the problem.

Reuse, attribution, and correction

Share this reference without losing its source

Copy a citation, permanent link, Markdown link, or self-contained embed card. Each reusable format points readers back to the maintained canonical page.

Report an issue

Search the whole reference

Symbols, formulas, guides, tools and commands

Start typing to search.

move · Enter open · Esc close