Law of Cosines

When the Law of Sines Cannot Start

The law of sines needs a matched pair: a side and the angle opposite it. Two very common setups hand you no such pair:

  • SAS: two sides and the angle between them
  • SSS: all three sides and no angles at all

For these, we need a different tool. That tool is the law of cosines.


The Law

It relates all three sides to one angle:

c2=a2+b22abcosCc^2 = a^2 + b^2 - 2ab\cos C

Here CC is the angle, and cc is the side directly opposite it. The other two sides, aa and bb, are the ones that meet at CC.

The bar on the right is a2+b2a^2 + b^2, and it never changes. The green bar is c2c^2. As the angle CC opens, watch c2c^2 climb past that fixed line or fall below it. The shaded gap between them is the correction, 2abcosC2ab\cos C: it shrinks c2c^2 when CC is acute, vanishes at 90°90°, and grows c2c^2 when CC is obtuse.


It Is Just Pythagoras, Corrected

Look closely at the formula. The first part, a2+b2a^2 + b^2, is the Pythagorean theorem. The last part, 2abcosC-2ab\cos C, is a correction for the angle not being a right angle.

Watch the correction term in the animation as CC passes through 90°90°:

Angle CCcosC\cos CCorrectionResult
acute (<90°< 90°)positivesubtractsc2<a2+b2c^2 < a^2 + b^2
right (=90°= 90°)00vanishesc2=a2+b2c^2 = a^2 + b^2
obtuse (>90°> 90°)negativeaddsc2>a2+b2c^2 > a^2 + b^2

At exactly 90°90° the correction disappears and the law of cosines becomes the Pythagorean theorem.


Example: Two Sides and the Angle Between (SAS)

Given a=6a = 6, b=8b = 8, and the included angle C=60°C = 60°. Find cc.

c2=62+822(6)(8)cos60°=36+6496(0.5)=10048=52\begin{aligned} c^2 &= 6^2 + 8^2 - 2(6)(8)\cos 60° \\[0.5em] &= 36 + 64 - 96(0.5) \\[0.5em] &= 100 - 48 = 52 \end{aligned}

So c=527.21c = \sqrt{52} \approx 7.21.


Example: Three Sides, Find an Angle (SSS)

Rearranged, the law solves for the angle instead. Move the pieces around:

cosC=a2+b2c22ab\cos C = \frac{a^2 + b^2 - c^2}{2ab}

Given a=6a = 6, b=8b = 8, c=7.21c = 7.21. Find CC.

cosC=36+645296=4896=0.5C=arccos(0.5)=60°\begin{aligned} \cos C &= \frac{36 + 64 - 52}{96} \\[0.5em] &= \frac{48}{96} = 0.5 \\[0.5em] C &= \arccos(0.5) = 60° \end{aligned}

Unlike the law of sines, arccos\arccos gives a single answer between 0° and 180°180°, so there is no ambiguous case here.


Which Law, When

You knowUse
AAS, ASA, or SSALaw of Sines
SAS or SSSLaw of Cosines

A simple way to decide: if you have a side paired with its opposite angle, reach for the law of sines. If you are stuck with two sides and the angle between them, or all three sides, reach for the law of cosines.