Law of Cosines Calculator (Non-Right Triangles)

The Law of Cosines is used to solve any general triangle (non-right triangle) when you know either all three sides (**SSS**) or two sides and the angle between them (**SAS**). Select your known case below.

Select Your Known Case

The Three Forms of the Law of Cosines

The Law of Cosines is a powerful tool because it works for any triangle. It relates the three sides of a triangle to the cosine of one of its angles.

Formulas to Find a Missing Side (SAS Case)

If you know two sides and the included angle (SAS), use one of these formulas to find the third side:

$$a^2 = b^2 + c^2 - 2bc \cos(\alpha)$$ $$b^2 = a^2 + c^2 - 2ac \cos(\beta)$$ $$c^2 = a^2 + b^2 - 2ab \cos(\gamma)$$

Formulas to Find a Missing Angle (SSS Case)

If you know all three sides (SSS), you can rearrange the primary formula to find any angle:

$$\alpha = \cos^{-1} \left( \frac{b^2 + c^2 - a^2}{2bc} \right)$$ $$\beta = \cos^{-1} \left( \frac{a^2 + c^2 - b^2}{2ac} \right)$$ $$\gamma = \cos^{-1} \left( \frac{a^2 + b^2 - c^2}{2ab} \right)$$

Law of Cosines vs. Law of Sines

The Law of Cosines is typically the starting point for solving a triangle in the **SAS** and **SSS** cases. Once you have used the Law of Cosines to find one missing value, it is often easier and less ambiguous to use the **Law of Sines** to find the remaining angles.

The Law of Sines (used in ASA, AAS, and SSA cases) is:

$$\frac{a}{\sin(\alpha)} = \frac{b}{\sin(\beta)} = \frac{c}{\sin(\gamma)}$$

The Law of Cosines avoids the "ambiguous case" (SSA), making it the safer choice when applicable.

Frequently Asked Questions (FAQ)

What is the Law of Cosines used for?

What is the Law of Cosines formula for finding side 'a'?

When should I use the Law of Cosines instead of the Law of Sines?

Does the Law of Cosines work for right triangles?


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\]
','
Formula (extracted LaTeX)
\[a^2 = b^2 + c^2 - 2bc \cos(\alpha)\]
a^2 = b^2 + c^2 - 2bc \cos(\alpha)
Formula (extracted LaTeX)
\[b^2 = a^2 + c^2 - 2ac \cos(\beta)\]
b^2 = a^2 + c^2 - 2ac \cos(\beta)
Formula (extracted LaTeX)
\[c^2 = a^2 + b^2 - 2ab \cos(\gamma)\]
c^2 = a^2 + b^2 - 2ab \cos(\gamma)
Formula (extracted LaTeX)
\[\alpha = \cos^{-1} \left( \frac{b^2 + c^2 - a^2}{2bc} \right)\]
\alpha = \cos^{-1} \left( \frac{b^2 + c^2 - a^2}{2bc} \right)
Formula (extracted LaTeX)
\[\beta = \cos^{-1} \left( \frac{a^2 + c^2 - b^2}{2ac} \right)\]
\beta = \cos^{-1} \left( \frac{a^2 + c^2 - b^2}{2ac} \right)
Formula (extracted text)
$a^2 = b^2 + c^2 - 2bc \cos(\alpha)$ $b^2 = a^2 + c^2 - 2ac \cos(\beta)$ $c^2 = a^2 + b^2 - 2ab \cos(\gamma)$
Formula (extracted text)
$\alpha = \cos^{-1} \left( \frac{b^2 + c^2 - a^2}{2bc} \right)$ $\beta = \cos^{-1} \left( \frac{a^2 + c^2 - b^2}{2ac} \right)$ $\gamma = \cos^{-1} \left( \frac{a^2 + b^2 - c^2}{2ab} \right)$
Formula (extracted text)
$\frac{a}{\sin(\alpha)} = \frac{b}{\sin(\beta)} = \frac{c}{\sin(\gamma)}$
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
, ', svg: { fontCache: 'global' } }; ]], displayMath: [['\\[','\\]']] }, svg: { fontCache: 'global' } };, svg: { fontCache: 'global' } };