• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Basic Mathematics
  • ⌕
Home ❯ Law of Cosines Calculator

Law of Cosines Calculator

Solve an oblique triangle from SAS or SSS data with the law of cosines. The calculator validates the triangle, finds all missing sides and angles, and reports perimeter and area with a diagram scaled to the current measurements.

Solve the triangle with the cosine rule

c2=a2+b2−2abcos(γ)

Result

Side c:
—
Angles:
—
Perimeter:
—
Area:
—
The triangle updates to scale with the sides calculated from the current data.

Choosing SAS or SSS before applying the cosine rule

Choose SAS when two sides and their included angle are known; choose SSS when all three sides are known. In SAS the direct formula finds the opposite side, while in SSS its rearranged arccos form finds the angles.

A third side from two sides and their included angle

For a = 5, b = 6 and γ = 30°, c = √(5² + 6² − 2·5·6·cos 30°) ≈ 3.01. Substituting that unrounded side back into the formula checks the result.

Why the triangle inequality matters

SSS data must satisfy the triangle inequality. In SAS, the included angle must be strictly between 0° and 180°; the endpoints collapse the figure into a line.

Choosing the law of cosines instead of the law of sines

Use the cosine law first for SSS and SAS because these cases determine one triangle directly. Use the sine law when a complete opposite side–angle pair is available, especially for ASA or AAS data.

At γ = 90°, cos γ = 0 and the formula becomes c² = a² + b². The Pythagorean theorem is therefore the right-triangle special case of the cosine law.

Questions about the cosine rule

When is the cosine rule better than the sine rule?

Use it directly for SAS or SSS data. The sine rule is usually more direct when a side and its opposite angle are known.

Does it work for right triangles?

Yes. At 90°, cos(90°) = 0 and the formula becomes the Pythagorean theorem.

Why is SSA not offered here?

SSA may produce zero, one or two triangles. The separate sine-rule tool reports that ambiguity explicitly.

Which angle should be calculated first with SSS data?

Calculate the angle opposite the longest side first. This reduces the risk of choosing an inconsistent supplementary angle later.

Jean Carlos Novaes

About Jean Carlos Novaes

I hold a degree in Computer Science from the Federal University of Bahia (2017) and I am the editor and founder of this website.

Footer

Basic Mathematics

Basic Mathematics website with clear school content for elementary and high school students. Learn easily and efficiently!

ABOUT

  • About Us
  • Contact
  • Site Map

LEGAL

  • How to Cite
  • Cookie Policy
  • Privacy Policy
  • Content License
English
  • English
  • Portuguese (Português)
  • German (Deutsch)
  • Italian (Italiano)

© 2015–2026 · Basic Mathematics · All rights reserved.