Precalculus

Law of Sines and Law of Cosines: When to Use Each

Law of Sines and Law of Cosines: When to Use Each — CalculusCalc cover image

The law of sines is ( frac{a}{sin A} = frac{b}{sin B} = frac{c}{sin C} ); use it when you know a side and its opposite angle (ASA, AAS, SSA). The law of cosines is ( c^2 = a^2 + b^2 – 2abcos C ); use it when you know three sides (SSS) or two sides and the included angle (SAS). With ( C = 90^circ ), the law of cosines becomes the Pythagorean theorem.

SOH-CAH-TOA only works in right triangles. For any triangle, two formulas take over: the law of sines and the law of cosines. Between them they can solve every triangle, meaning find all three sides and all three angles from three known parts (as long as at least one is a side).

Throughout, side ( a ) is opposite angle ( A ), side ( b ) is opposite angle ( B ), and side ( c ) is opposite angle ( C ).

The law of sines

$$frac{a}{sin A} = frac{b}{sin B} = frac{c}{sin C}$$

Law of cosines: A silhouette of a person with geometric shapes and letters A², B², C².

Each side divided by the sine of its opposite angle gives the same number. (That number is the diameter of the circle through the triangle’s three corners.)

Use it when you know a side and its opposite angle, plus one more part: the ASA, AAS and SSA cases.

The law of cosines

$$c^2 = a^2 + b^2 - 2abcos C$$

and similarly ( a^2 = b^2 + c^2 – 2bccos A ) and ( b^2 = a^2 + c^2 – 2accos B ).

Use it when you know all three sides (SSS) or two sides and the angle between them (SAS). To find an angle from three sides, rearrange:

$$cos C = frac{a^2 + b^2 - c^2}{2ab}$$

If ( C = 90^circ ), then ( cos C = 0 ) and the law of cosines becomes ( c^2 = a^2 + b^2 ). It’s the Pythagorean theorem with a correction term for non-right angles.

Which law should I use?

What you knowCaseUse
3 sidesSSSlaw of cosines (for the angles)
2 sides and the included angleSASlaw of cosines (for the third side)
2 angles and the side between themASAangle sum, then law of sines
2 angles and a side not between themAASangle sum, then law of sines
2 sides and an angle not between themSSAlaw of sines (check for 0, 1 or 2 triangles)
3 anglesAAAnot enough: infinitely many similar triangles

Example 1: SSS

Solve the triangle with ( a = 5 ), ( b = 6 ), ( c = 7 ).

Largest angle first (it’s opposite the longest side):

$$cos C = frac{25 + 36 - 49}{2(5)(6)} = frac{12}{60} = 0.2 quadRightarrowquad C approx 78.46^circ$$

Second angle: ( cos A = frac{36 + 49 – 25}{2(6)(7)} = frac{60}{84} approx 0.714 ), so ( A approx 44.42^circ ).

Third angle: ( B = 180^circ – 78.46^circ – 44.42^circ approx 57.12^circ ).

Example 2: SAS

Two sides of a triangle are 7 and 9, with a ( 60^circ ) angle between them. Find the third side.

$$c^2 = 49 + 81 - 2(7)(9)cos 60^circ = 130 - 63 = 67 quadRightarrowquad c = sqrt{67} approx 8.185$$

Example 3: AAS

( A = 30^circ ), ( B = 45^circ ), ( a = 10 ). First ( C = 105^circ ). Then

$$b = frac{asin B}{sin A} = frac{10 cdot frac{sqrt2}{2}}{frac12} = 10sqrt2 approx 14.142, qquad c = frac{10sin 105^circ}{sin 30^circ} approx 19.319$$

Example 4: a real-world distance

Two hikers leave camp on paths ( 50^circ ) apart. One walks 4 km, the other 6 km. How far apart are they?

That’s SAS with the included angle ( 50^circ ):

$$d^2 = 16 + 36 - 48cos 50^circ approx 52 - 30.85 = 21.15 quadRightarrowquad d approx 4.60 text{ km}$$

The ambiguous case (SSA)

When you know two sides and an angle not between them, the law of sines gives ( sin B ), and there may be two angles with that sine (one acute, one obtuse), one, or none.

Two blank road signs pointing in opposite directions against a blue sky.

Example 5: two triangles. ( a = 6 ), ( b = 8 ), ( A = 30^circ ).

$$sin B = frac{8sin 30^circ}{6} = frac23 quadRightarrowquad B approx 41.81^circ text{ or } B approx 138.19^circ$$

Both leave a positive third angle (( C approx 108.19^circ ) or ( 11.81^circ )), so two different triangles fit. Their third sides are ( c approx 11.40 ) and ( c approx 2.456 ).

Example 6: no triangle. ( a = 2 ), ( b = 8 ), ( A = 60^circ ). Then ( sin B = frac{8sin 60^circ}{2} approx 3.46 ), which is impossible, so no triangle exists. Side a is too short to reach the third side.

A quick test: with A acute, compute the height ( h = bsin A ). If ( a < h ) there’s no triangle; if ( a = h ) there’s one right triangle; if ( h < a < b ) there are two; if ( a ge b ) there’s one.

Triangle calculator

Enter any three parts and leave the rest blank. The calculator picks the right law and finds both triangles in the ambiguous case.

Algebra & Trig#33

Triangle Solver (Law of Sines & Cosines)

Enter any three of the six parts (at least one side) and leave the rest blank. Handles SSS, SAS, ASA, AAS and the ambiguous SSA case.

The full-page triangle calculator has more examples.

Area of any triangle

With two sides and the angle between them:

Drafting tools: compass, protractor, and ruler for geometry

$$text{Area} = tfrac12absin C$$

For Example 2, the area is ( tfrac12(7)(9)sin 60^circ approx 27.28 ). With three sides only, use Heron’s formula: with ( s = frac{a + b + c}{2} ), Area ( = sqrt{s(s – a)(s – b)(s – c)} ). For the 5-6-7 triangle, ( s = 9 ) and the area is ( sqrt{9 cdot 4 cdot 3 cdot 2} = sqrt{216} approx 14.70 ).

Why the laws are true

Law of sines. Drop a perpendicular of height h from C to side c. In the two right triangles formed, ( h = bsin A ) and ( h = asin B ). Setting them equal gives ( frac{a}{sin A} = frac{b}{sin B} ).

Pythagorean theorem and a right triangle with sides a, b, c

Law of cosines. Put C at the origin with side b along the x-axis, so ( A = (b, 0) ) and ( B = (acos C, asin C) ). By the distance formula,

$$c^2 = (acos C - b)^2 + (asin C)^2 = a^2(cos^2 C + sin^2 C) - 2abcos C + b^2$$

and ( cos^2 C + sin^2 C = 1 ) (see trig identities).

Common mistakes

  • Mislabeling. Each side must be opposite its matching angle.
  • Missing the second SSA triangle. Your calculator’s ( sin^{-1} ) only gives the acute angle. Always check ( 180^circ ) minus that angle.
  • Order of operations in the law of cosines. Compute ( 2abcos C ) as one term before subtracting: ( 130 – 63 ), not ( (130 – 2)(63) ).
  • Degree mode. Set your calculator to degrees for these problems.
  • Using the law of sines for the largest angle. It’s the only angle that can be obtuse, and ( sin^{-1} ) can’t tell. Therefore, find it with the law of cosines, whose sign shows obtuse angles clearly.

Practice problems

  1. Find side c if ( a = 8 ), ( b = 5 ), ( C = 60^circ ).
  2. Find angle C if ( a = 3 ), ( b = 5 ), ( c = 7 ).
  3. Find side b if ( A = 40^circ ), ( B = 75^circ ), ( a = 12 ).
  4. How many triangles have ( a = 4 ), ( b = 10 ), ( A = 30^circ )?
  5. Find the area of a triangle with sides 6 and 10 and included angle ( 30^circ ).

Answers: (1) 7; (2) ( 120^circ ); (3) about 18.03; (4) none (( sin B = 1.25 )); (5) 15.

FAQ

What is the law of cosines?

( c^2 = a^2 + b^2 – 2abcos C ). However, it relates the three sides of any triangle to one of its angles.

What is the law of sines?

( frac{a}{sin A} = frac{b}{sin B} = frac{c}{sin C} ). Each side over the sine of its opposite angle is the same.

When do you use the law of sines vs cosines?

Sines when you know a side and its opposite angle; cosines for SSS and SAS, where no such pair is known.

What is the ambiguous case?

The SSA situation, where two sides and a non-included angle can produce two triangles, one, or none.

Does the law of cosines work for right triangles?

Yes. When ( C = 90^circ ), it reduces to the Pythagorean theorem. For quick right-triangle shortcuts, see special right triangles.

Further reading

Calculators for this topic

Leave a comment

Your email address will not be published. Required fields are marked *