Skip to content
Study Hall
Lesson 6 of 10Trigonometric Functions
Unit 4 · Lesson 6 of 10

The Cosine Law

When the sine law can't get started (SAS or SSS), the cosine law solves the triangle instead — and rearranges cleanly to find any missing angle.

6 min read12 practice questionsAsk AI about this →

Key things to remember

  1. 1Cosine law: , where is included between sides and .
  2. 2Use it for SAS (find the missing side) or SSS (find any angle).
  3. 3Rearranged to solve for an angle: .
  4. 4A negative value of means is obtuse — this is expected, not an error.
  5. 5It comes from Pythagoras plus ; at it reduces to .
  6. 6Solving a whole triangle: cosine law first (largest angle in SSS), then the sine law for the smaller angles, then the angle sum.

Picture a golfer whose tee shot travels m but hooks off the line to the hole, which is m away. How far is the ball from the hole now? You know two sides and the angle BETWEEN them, but no angle is paired with the side opposite it, so the sine law has nothing to start from. The same thing happens when a surveyor measures three sides of a field and wants its corner angles. The cosine law handles both situations. It is a generalization of the Pythagorean theorem: for a right angle, and the formula collapses exactly into . For any other angle, the extra term corrects for the triangle not being right-angled.

C is the angle INCLUDED between sides a and b; c is the side opposite C.
ABCabcc² = a² + b² - 2ab·cosCUse when you know:SAS — two sides + the included angle → find the 3rd sideSSS — all three sides → find any angle; at C=90°, cosC=0 → c²=a²+b² (Pythagoras)
Fig 1Angle C sits between the two known sides a and b; side c is opposite C.

Where the cosine law comes from

Drop the altitude from vertex to side , meeting it at a point . In the right triangle , is the hypotenuse, so and . That leaves along the base. Now apply the Pythagorean theorem to the OTHER right triangle, , whose hypotenuse is . Expanding the square and grouping the terms produces , and the Pythagorean identity turns that bracket into . What is left is the cosine law. The same algebra works from any vertex, so the law has three versions, one for each angle: , and . The pattern is always the same: the side on the left is opposite the angle inside the cosine, and the other two sides appear everywhere else.

The correction term also explains a useful piece of intuition. Think of sides and as two arms joined by a hinge at . Close the hinge (small ) and the tips come together, so is short; open it wide (large ) and the tips spread apart, so is long. The formula captures this exactly: when is acute, , so something is SUBTRACTED and ; at nothing is subtracted (Pythagoras); when is obtuse, , so the term becomes an ADDITION and . You can use this as an instant check: if the included angle is obtuse, the side you find must be longer than it would be in a right triangle.

VideoKhan Academy splits the triangle with an altitude and applies the Pythagorean theorem, showing where the extra -2ab cos C term comes from. Law of cosines is the American name for the cosine law.Watch on YouTube

Choosing between the sine law and the cosine law

What you are givenLaw to start withWhy
SAS (two sides and the angle between them)Cosine law for the third sideNo angle is paired with its opposite side yet
SSS (three sides)Cosine law for an angleNo angles are known at all
AAS or ASA (two angles and a side)Sine lawThe third angle gives a complete pair
SSA (two sides and a non-included angle)Sine law, then check the ambiguous caseThe given angle is paired with its opposite side
A right triangleSOH CAH TOA or PythagorasQuickest; both laws reduce to these anyway
The deciding question: do I already know an angle together with the side opposite it?

Once the cosine law has produced one new piece, you usually HAVE a complete angle/opposite-side pair, so you can switch to the sine law for the rest of the triangle, which is quicker. There is one trap. The inverse sine key only returns acute angles, so if a remaining angle could be obtuse, the sine law may hand you the wrong one. The fix is to choose the order carefully. In an SSS triangle, find the LARGEST angle first with the cosine law (it is opposite the longest side, and it is the only angle that could be obtuse); the other two angles are then guaranteed acute, so the sine law is safe. After an SAS calculation, use the sine law for the angle opposite the SHORTER of the two remaining sides, then finish with the angle sum of . If in doubt, use the cosine law again: the inverse cosine returns angles from to and never misses an obtuse one.

Rearranging to find an angle

Starting from , add to both sides and subtract , then divide by to isolate . Apply the inverse cosine to finish. In the rearranged formula, the side opposite the unknown angle is the one being SUBTRACTED in the numerator; the other two sides are squared and added, and multiplied together in the denominator. Getting this pairing wrong is the most common error in SSS questions, so say it out loud as you write: 'the side opposite the angle I want goes last, with a minus sign.'

Negative cosine is not an error
If comes out negative, that's completely normal — it just means is obtuse. The inverse cosine correctly returns an angle between and for a negative input. But if the value is greater than or less than , the three lengths cannot form a triangle (the two shorter sides must add to more than the longest), so recheck the data or your arithmetic.
VideoUses the cosine law both ways: finding the third side when two sides and the contained angle are known (SAS), and finding an angle when all three sides are known (SSS).Watch on YouTube

The cosine law in applied and 3D problems

Navigation problems are classic SAS triangles: a ship sails one leg, turns, and sails a second leg, and you want the straight-line distance back to port. The included angle is the angle between the two legs at the turning point, which you usually find from the bearings (for example, a turn from a bearing of to changes direction by , so the interior angle between the legs is ). In 3D problems, look for a horizontal triangle on the ground whose two sides come from vertical right triangles. A lighthouse keeper who sees two boats at known angles of depression can find each boat's horizontal distance from the base with tangent, then use the cosine law with the horizontal angle between the boats to find how far apart they are. As with the sine law, sketch each plane's triangle flat, keep full calculator precision between stages, and only round the final answer.

Worked examples

Reveal one step at a time and try to beat it to the next line.

Example 1
In , , , and the included angle . Find side .
Example 2
In , all three sides are known: , , . Find angle (opposite the longest side).
Example 3
Solve completely, given cm, cm and cm. Round angles to the nearest tenth of a degree.
Example 4
From the top of a m lighthouse, the angle of depression to boat is and to boat is . At the base of the lighthouse, the horizontal angle between the directions to the two boats is . How far apart are the boats, to the nearest metre?

Where marks get lost

  • Using the cosine law with an angle that ISN'T included between the two known sides — for SAS, the angle must sit between the two given sides.
  • Forgetting to take the square root at the end when solving for a side (leaving the answer as instead of ).
  • Panicking when comes out negative — that's a valid, expected result for an obtuse angle, not a mistake.
  • Mixing up which side is squared alone vs. which two are multiplied together in the rearranged angle formula.
  • Evaluating in the wrong order: computing or subtracting before multiplying. Work out as one number first, then subtract it.

Flashcards 9

Cosine law
Cosine law rearranged for an angle
When to use cosine law
Negative
+ 5 more

Practice

1
In , , included angle . Find (round to 2 decimals).
2
Which given information REQUIRES the cosine law (sine law can't start)?
3
A triangle has sides . Find angle (opposite the longest side), rounded to 1 decimal.
°
4
If comes out negative when solving SSS, what does that tell you about angle ?
5
In , , included angle . Find .
6
In the formula , which angle must be?
7
In , , and the included angle . Find side (round to 2 decimals).
8
A golfer's tee shot travels m but is off the straight line to the hole, which is m from the tee. How far is the ball from the hole, in metres (round to 1 decimal)?
m
9
A ship sails km from port, turns, and sails km more. The interior angle between the two legs at the turning point is . How far is the ship from port, in km (round to 1 decimal)?
km
10
A triangular garden has sides m, m and m. Find its largest angle in degrees (round to 1 decimal).
°
11
Match each situation to the best first step.
Two sides and the angle between them
Three sides
Two angles and one side
Two sides and an angle not between them
12
Put the steps for solving an SSS triangle in the safest order.
  1. 1Check that larger angles sit opposite longer sides
  2. 2Find the third angle from the angle sum
  3. 3Use the sine law for a second angle
  4. 4Identify the longest side
  5. 5Use the cosine law for the angle opposite it

Spot a mistake on this page? Let us know