Math concepts

Law of Sines and Law of Cosines: Which One to Use and When

October 20, 202612 min read
Law of Sines and Law of Cosines: Which One to Use and When

A surveyor knows two sides of a plot and the angle between them, and needs the third side. A pilot knows two angles of a triangle formed with two radio beacons, and one distance. Neither triangle has a right angle, so SOH CAH TOA is no help. These are the jobs of the law of sines and the law of cosines, the two rules that solve any triangle once you know three of its parts (as long as one of them is a side).

The hard part is rarely the formula. It is choosing which law to use, and noticing the one situation where a calculator quietly gives a wrong angle. This guide starts with a decision table, works one example for each case, and then takes a single triangle through all the outcomes of the ambiguous case by changing only one side. If sine and cosine still feel like buttons rather than ideas, the trigonometry guide rebuilds them first.

Notation throughout: angles A, B, C sit opposite sides a, b, c.

Which law to use: start from what you are given

Every solvable triangle problem gives you three parts. Name the pattern, and the law follows:

Given data, law, first unknown to find

You are givenPatternLaw to useFind first
Two angles and a side not between themAASLaw of sinesThird angle (180° minus the other two), then the sides
Two angles and the side between themASALaw of sinesThird angle, then the sides
Two sides and an angle not between themSSALaw of sines, with careThe angle opposite the second known side; check for 0, 1 or 2 triangles
Two sides and the angle between themSASLaw of cosinesThe third side
All three sidesSSSLaw of cosinesThe largest angle (opposite the longest side)
Three anglesAAANeitherNo unique answer: similar triangles of any size fit

This split follows the OpenStax precalculus text: the law of sines covers ASA, AAS and SSA, and the law of cosines is the tool for the two cases the law of sines cannot handle, SAS and SSS (OpenStax, law of sines; OpenStax, law of cosines).

The reason is easy to see from the formulas. The law of sines compares each side with its opposite angle:

asin⁡A=bsin⁡B=csin⁡C\frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C}

To use it, you need at least one complete pair: a side together with the angle across from it. SAS and SSS never give you a complete pair, so you need a different rule to get started.

The law of cosines: Pythagoras plus a correction

The law of cosines, in its three forms, is

a2=b2+c2−2bccos⁡Aa^{2} = b^{2} + c^{2} - 2bc\cos A b2=a2+c2−2accos⁡Bb^{2} = a^{2} + c^{2} - 2ac\cos B c2=a2+b2−2abcos⁡Cc^{2} = a^{2} + b^{2} - 2ab\cos C

Look at the last one with C=90∘C = 90^{\circ}. Then cos⁡C=0\cos C = 0, the final term vanishes, and you are left with a2+b2=c2a^{2} + b^{2} = c^{2}. The law of cosines is the Pythagorean theorem with a correction term for angles that are not right. OpenStax calls the identity it starts from "the Generalized Pythagorean Theorem". The idea is old: Propositions 12 and 13 in Book II of Euclid's Elements prove it for obtuse and acute triangles in purely geometric language, long before cosines existed (Euclid II.12, Clark University edition).

The correction has a clear meaning. When C is acute, cos⁡C\cos C is positive, so c comes out shorter than the Pythagorean value. When C is obtuse, cos⁡C\cos C is negative, and the minus sign turns the correction into an addition, so c comes out longer. Open the angle and the far side stretches; close it and the side shrinks.

Worked SAS example

Two sides are b=8b = 8 and c=11c = 11, with the angle between them A=40∘A = 40^{\circ}. Find the rest.

Third side. Plug into the form that has the known angle:

a2=82+112−2(8)(11)cos⁡40∘=185−134.82=50.18a^{2} = 8^{2} + 11^{2} - 2(8)(11)\cos 40^{\circ} = 185 - 134.82 = 50.18

so a≈7.08a \approx 7.08. For comparison, a right angle at A would have given 185≈13.60\sqrt{185} \approx 13.60; the 40° angle cuts that by almost half.

Remaining angles. Now there is a complete pair (a with A), so the law of sines works. Solve for the angle opposite the shorter of the other two sides, which is b:

sin⁡B=8sin⁡40∘7.08≈0.7260,B≈46.55∘\sin B = \frac{8 \sin 40^{\circ}}{7.08} \approx 0.7260, \quad B \approx 46.55^{\circ}

Then C=180∘−40∘−46.55∘=93.45∘C = 180^{\circ} - 40^{\circ} - 46.55^{\circ} = 93.45^{\circ}.

Notice that C is obtuse. If you had used the law of sines on C instead, the calculator's arcsine would have returned 86.55°, the acute angle with the same sine, and every later number would have been wrong. Solving for the smaller angle first avoids this: in any triangle, the angle opposite a shorter side is smaller, and at most one angle can be 90° or more, so the angle opposite the shorter side is always acute.

The same data also gives the area directly, using one-half of two sides times the sine of their included angle (the area formula from the OpenStax section on the law of sines): 12(8)(11)sin⁡40∘≈28.28\tfrac{1}{2}(8)(11)\sin 40^{\circ} \approx 28.28.

SSS: find the largest angle first

Given all three sides, rearrange the law of cosines to isolate the cosine:

cos⁡C=a2+b2−c22ab\cos C = \frac{a^{2} + b^{2} - c^{2}}{2ab}

Take the triangle with sides 5, 7 and 9. The longest side is 9, so start with the angle opposite it:

cos⁡C=25+49−812(5)(7)=−770=−0.1,C≈95.74∘\cos C = \frac{25 + 49 - 81}{2(5)(7)} = \frac{-7}{70} = -0.1, \quad C \approx 95.74^{\circ}

The negative cosine tells you at once that C is obtuse. Now the law of sines is safe for the others, because the remaining two angles must be acute:

sin⁡A=5sin⁡95.74∘9≈0.5528,A≈33.56∘\sin A = \frac{5 \sin 95.74^{\circ}}{9} \approx 0.5528, \quad A \approx 33.56^{\circ}

and B=180∘−95.74∘−33.56∘=50.70∘B = 180^{\circ} - 95.74^{\circ} - 33.56^{\circ} = 50.70^{\circ}. A check with the law of cosines for B gives the same 50.70°.

Do it in the other order and the trap appears. Find A first and then use the law of sines for C: you get sin⁡C≈0.9950\sin C \approx 0.9950, and the arcsine says 84.26°. The true angle is its supplement, 95.74°. Course notes from the University of Houston put the rule plainly: if you have a choice, "it is usually best to find the largest angle first" (UH Math 1330, section 7.3).

The law of sines: AAS and ASA

When you know two angles, the third is free: they add to 180°. After that, the law of sines is a straight proportion.

Say A=40∘A = 40^{\circ}, B=60∘B = 60^{\circ} and a=10a = 10. Then C=80∘C = 80^{\circ}, and the common ratio is

asin⁡A=10sin⁡40∘≈15.557\frac{a}{\sin A} = \frac{10}{\sin 40^{\circ}} \approx 15.557

Multiply it by each sine: b≈15.557×sin⁡60∘≈13.47b \approx 15.557 \times \sin 60^{\circ} \approx 13.47 and c≈15.557×sin⁡80∘≈15.32c \approx 15.557 \times \sin 80^{\circ} \approx 15.32.

There is nothing ambiguous here, because every angle was found by subtraction, not by an arcsine. ASA works the same way: subtract to get the third angle, then you have a side with its opposite angle and the proportion does the rest.

The ambiguous case (SSA): one triangle, three outcomes

SSA is where students lose marks. OpenStax describes it as the case where SSA data "may result in one or two solutions, or even no solution". The cleanest way to see why is to hold everything fixed except one side.

Fix the angle A=30∘A = 30^{\circ} and the side b=10b = 10. Picture side b lying along the ground from vertex C to vertex A, with the 30° angle at A. Side a hangs from C and swings like a gate until it lands on the line leaving A. Whether it lands, and where, depends only on its length.

The key length is the height from C down to that line:

h=bsin⁡A=10sin⁡30∘=5h = b \sin A = 10 \sin 30^{\circ} = 5

Now change only a. Each row below was computed from sin⁡B=bsin⁡Aa\sin B = \dfrac{b \sin A}{a} and checked to 12 significant digits:

SSA outcomes for A = 30°, b = 10

Side aCompared with h = 5 and b = 10sin⁡B\sin BTrianglesAngle BAngle CSide c
4shorter than h1.250nonenonenone
5equal to h1190°60°8.66
8between h and b0.625238.68° or 141.32°111.32° or 8.68°14.91 or 2.42
12at least b0.4167124.62°125.38°19.57

Read it row by row:

  • a = 4. The gate is shorter than the height, so it never reaches the ground. The algebra says the same thing: sin⁡B=1.25\sin B = 1.25, and no angle has a sine above 1. No triangle.
  • a = 5. The gate just touches the ground, straight down. One triangle, with a right angle at B.
  • a = 8. The gate is longer than the height but shorter than b, so it touches the ground at two points, one on each side of the foot of the height. Both are real triangles. The arcsine gives 38.68°; the other answer is its supplement, 180∘−38.68∘=141.32∘180^{\circ} - 38.68^{\circ} = 141.32^{\circ}, and since 30∘+141.32∘<180∘30^{\circ} + 141.32^{\circ} < 180^{\circ} it leaves room for a third angle. You get a wide triangle with c = 14.91 and a thin one with c = 2.42.
  • a = 12. The gate is longer than b, so its second landing point would fall behind A, outside the triangle. The supplement 155.38° plus 30° already passes 180°, so it is rejected. One triangle.

These conditions match the four pictures in the OpenStax section: a shorter than the height gives no triangle, a equal to the height gives a right triangle, a between the height and b gives two, and a at least as long as b gives one (for an acute angle A).

The routine to keep: after any SSA arcsine, write down the supplement too and test whether it fits with the given angle. If it does, there are two answers, and the problem usually wants both. If A itself is obtuse, the picture is simpler: a must be longer than b, or there is no triangle at all.

Common mistakes

Using the law of sines on SAS or SSS. Without a complete side and opposite angle pair, the proportion has two unknowns. Start with the law of cosines.

Forgetting the second SSA triangle. The calculator only returns the acute arcsine. Always test its supplement.

Finding an obtuse angle with arcsine. In SAS and SSS, find the largest angle with the law of cosines, or find the smaller angles first with the law of sines.

Calculator in radian mode. cos⁡40\cos 40 in radians is about −0.667-0.667, not 0.7660.766. If a side comes out longer than the sum of the other two, check the mode.

Rounding early. Keep full precision for the side you found before using it in the next step; the answers above were carried at full precision and rounded only at the end.

Practice problems

Try each one before reading the answer.

  1. SAS. b=6b = 6, c=9c = 9, A=60∘A = 60^{\circ}. Find a.
  2. SSS. A triangle has sides 4, 6 and 8. Find its largest angle.
  3. SSA. A=40∘A = 40^{\circ}, b=12b = 12, a=9a = 9. How many triangles fit, and what are the possible values of c?

Answers.

  1. a2=36+81−108cos⁡60∘=63a^{2} = 36 + 81 - 108\cos 60^{\circ} = 63, so a=63≈7.94a = \sqrt{63} \approx 7.94.
  2. The largest angle is opposite 8: cos⁡C=16+36−6448=−0.25\cos C = \dfrac{16 + 36 - 64}{48} = -0.25, so C≈104.48∘C \approx 104.48^{\circ}.
  3. The height is 12sin⁡40∘≈7.7112 \sin 40^{\circ} \approx 7.71, and 9 sits between 7.71 and 12, so two triangles. sin⁡B≈0.8571\sin B \approx 0.8571 gives B≈58.99∘B \approx 58.99^{\circ} or 121.01∘121.01^{\circ}, then C≈81.01∘C \approx 81.01^{\circ} or 18.99∘18.99^{\circ}, and c≈13.83c \approx 13.83 or 4.564.56.

Math Zen's trigonometry practice includes the law of sines and cosines next to trig ratios, identities and inverse functions, with fresh numbers on every attempt, so the choice between the two laws becomes automatic. The same cosine reappears in the dot product, which the vectors guide explains as a natural next step.

Frequently asked questions

When do you use the law of sines vs the law of cosines?

Use the law of sines for AAS, ASA and SSA. Use the law of cosines for SAS and SSS, where no side comes with its opposite angle.

Is the law of cosines the same as the Pythagorean theorem?

It is the general version. Set the angle to 90° and the −2abcos⁡C-2ab\cos C term drops out, leaving a2+b2=c2a^{2} + b^{2} = c^{2}.

What is the ambiguous case of the law of sines?

SSA data can describe zero, one or two triangles. Compare side a with the height h=bsin⁡Ah = b \sin A and with side b to tell which.

Why should I find the largest angle first?

An angle and its supplement have the same sine, so an arcsine cannot tell 84° from 96°. The largest angle is the only one that can be obtuse; find it with the law of cosines and the rest are safe.

Common Questions

When do you use the law of sines vs the law of cosines?
Look at what the triangle gives you. Two angles and a side (AAS or ASA), or two sides and an angle that is not between them (SSA): use the law of sines. Two sides and the angle between them (SAS), or all three sides (SSS): use the law of cosines, because the law of sines needs a known side and its opposite angle as a pair, and those two cases do not provide one.
Is the law of cosines the same as the Pythagorean theorem?
It is the general version. The law of cosines says c² = a² + b² - 2ab cos C. When C is 90 degrees, cos C is 0, the last term disappears, and what is left is a² + b² = c². Euclid already proved geometric versions of the law for obtuse and acute triangles in Book II of the Elements.
What is the ambiguous case of the law of sines?
It is the SSA case: two sides and an angle that is not between them. Those three facts can fit no triangle, exactly one, or two different triangles. Compare the side opposite the known angle with the height h = b sin A: shorter than h gives none, equal to h gives one right triangle, between h and b gives two, and at least b gives one.
Why should I find the largest angle first?
Because the sine of an angle and the sine of its supplement are equal, so an arcsine can return 84 degrees when the true angle is 96. Only the largest angle of a triangle can be obtuse. Find it with the law of cosines, where a negative cosine shows the obtuse angle directly, and the remaining angles are guaranteed acute, so the law of sines gives them safely.

Put This Into Practice