Free lesson

Every lesson is free, no account needed. Make a free account to save your progress.

Live classGet practice + mocks
  1. Home
  2. Lesson Library
  3. Law of Cosines
UPCAT Math Review · Trigonometry

The Law of Cosines

Pythagoras with a correction term, for triangles that have no right angle.

The problem

Two sides measure 8 and 11, with an angle of 40° between them. Find the third side.

When sines will not help.

The Law of Sines needs a side paired with its opposite angle. Here there is none.

use cosines when you have

two sides and the angle between (SAS)

all three sides (SSS)

use sines when you have

a complete side-angle pair

c² = a² + b² − 2ab · cos C

c is the side you want; C is the angle facing it

Substitute and work left to right.

40° C A B a = 8 b = 11 c = ?

Drawn to scale: the 40° between the 8 and the 11 is what fixes the far side c.

c² = 8² + 11² − 2(8)(11) cos 40°

a = 8, b = 11, C = 40°

= 64 + 121 − 176(0.766)

cos 40° = 0.766

= 185 − 134.8

the correction

c² = 50.2

not the answer yet

c ≈ 7.08

take the square root

c ≈ 7.08

Two things to remember

The whole term 2ab cos C is subtracted as one lump — do the multiplication before subtracting. And the formula gives c2; forgetting the final square root leaves you with 50.2.

It is Pythagoras in disguise.

if C = 90°

a right angle

cos 90° = 0

the term vanishes

c² = a² + b²

the old theorem

C under 90°

cos is positive

c comes out shorter

C over 90°

cos is negative

subtracting a negative — c grows

Squeeze the angle and the far side shrinks. Open it out and the far side stretches.

Three sides, and you want an angle.

Rearrange the same formula.

cos C = a² + b² − c²2ab

sides 5, 7, 9 — find the largest angle

it faces the 9

cos C = (25 + 49 − 81) ÷ (2 · 5 · 7)

c = 9

= −7 ÷ 70 = −0.1

negative, so obtuse

C = cos⁻¹(−0.1) ≈ 95.7°

just past a right angle

A negative cosine always means an obtuse angle — a useful check before you press the button.

Choosing between the two laws.

You are givenUse
two angles and any sideSines
two sides and the angle betweenCosines
all three sidesCosines
two sides and an angle not betweenSines — watch the ambiguity

Cosines opens the door when nothing pairs up. After one use you usually have a complete pair, and Sines finishes the job faster.

Bearings and navigation questions almost always start with two distances and the angle between them — a Law of Cosines setup.

Variations: a 45° angle with a root, a cosine of zero, three sides that do not close.

Two sides are 3√2 and 5, with a 45° angle between them. Find the third side.

c² = (3√2)² + 5² − 2(3√2)(5) cos 45°

SAS

= 18 + 25 − 30√2 × (√22)

(3√2)² = 9 × 2

= 43 − 30 = 13

√2 × √2 = 2, and 30 × 2 ÷ 2 = 30

c = √13

≈ 3.6

Different: a side with a root pairs with cos 45° so the roots cancel, and the answer is itself a root.

A triangle has sides 9, 12 and 15. Find its largest angle.

cos C = (81 + 144 − 225) ÷ (2 · 9 · 12)

C faces the 15

= 0 ÷ 216 = 0

the top vanishes

C = 90°

a 3-4-5 triangle, × 3

Different: a cosine of exactly 0 means a right angle — positive is acute, negative is obtuse, zero is the line between.

Can a triangle have sides 3, 4 and 8? Find the angle facing the 8.

cos C = (9 + 16 − 64) ÷ (2 · 3 · 4)

SSS

= −39 ÷ 24 = −1.625

below −1

no such triangle

a cosine lies between −1 and 1

Different: the formula flags the impossible triangle — 3 + 4 is less than 8, so the sides never meet. A calculator shows an error for cos⁻¹(−1.625); that error is the answer.

Parallelogram ABCD has AB = 6, AD = 4 and ∠A = 60°. Find both diagonals.

BD² = 6² + 4² − 2(6)(4) cos 60° = 52 − 24 = 28

BD faces the 60° at A

BD = √28 = 2√7

the shorter diagonal

AC² = 6² + 4² − 2(6)(4) cos 120° = 52 + 24 = 76

∠B = 180 − 60 = 120°, and BC = AD = 4

AC = √76 = 2√19

the longer diagonal

Different: each diagonal closes a triangle made of two sides of the parallelogram. Consecutive angles add to 180°, so one diagonal faces 60° and the other 120°.

When the unknown side touches the angle: a quadratic.

A triangle has a 120° angle. The two sides along it are 5 and x, and the side facing it is 19. Find x. The formula still works — the unknown just lands in two terms.

19² = x² + 5² − 2(x)(5) cos 120°

the facing side goes on the left

361 = x² + 25 + 5x

cos 120° = −½, so − × − = +

x² + 5x − 336 = 0

set to zero

x = (−5 + √25 + 1344) ÷ 2 = (−5 + 37) ÷ 2

quadratic formula; √1369 = 37

x = 16

the negative root is not a length

Check: 16² + 5² + 5 × 16 = 256 + 25 + 80 = 361 = 19² ✓

The given side must face the given angle

The side on the left of c² = a² + b² − 2ab cos C is always the one opposite C. Putting x there instead (x² = 361 + 25 − …) builds a different triangle altogether.

On the exam

Expect 60° or 120° (cos = ½ or −½) so the arithmetic is exact: two ships or two roads with the angle between, the diagonals of a parallelogram, the largest or smallest angle from three sides, or a side solved from a quadratic. Watch the sign — a 120° angle adds ab instead of subtracting it. Ten-second check: the side facing an obtuse angle is the longest, longer than √a² + b².

Check: is the triangle possible?

triangle inequality 7.08 + 8 > 11 ✓
smallest angle 40° faces the 7.08 shortest side ✓
rough test at 90° it would be 13.6 40° gives less ✓

Remember the flow

SAS or SSS · c² = a² + b² − 2ab cos C · Root it

Negative cosine means an obtuse angle.
Now you try

Practice problem

The problem

Two sides of 6 and 10 meet at 120°. Find the third side.