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.
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.
Choosing between the sine law and the cosine law
| What you are given | Law to start with | Why |
|---|---|---|
| SAS (two sides and the angle between them) | Cosine law for the third side | No angle is paired with its opposite side yet |
| SSS (three sides) | Cosine law for an angle | No angles are known at all |
| AAS or ASA (two angles and a side) | Sine law | The third angle gives a complete pair |
| SSA (two sides and a non-included angle) | Sine law, then check the ambiguous case | The given angle is paired with its opposite side |
| A right triangle | SOH CAH TOA or Pythagoras | Quickest; both laws reduce to these anyway |
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.'
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.