Trigonometry

Law of Sines and Law of Cosines — Formulas, When to Use, Examples

The law of sines and law of cosines (sine and cosine rules): proofs, which one to use, the ambiguous SSA case, triangle area and 12 worked examples.

The law of sines says that in any triangle \( \frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} \), where each side \( a, b, c \) is opposite the angle \( A, B, C \) with the same letter. The law of cosines says that \( c^2 = a^2 + b^2 - 2ab\cos C \), and likewise for the other two sides. Use the law of sines when you know a side and the angle opposite it (plus one more side or angle), and the law of cosines when you know two sides and the angle between them, or all three sides. After this lesson you will be able to pick the right law for any triangle, find missing sides and angles, recognize and solve the ambiguous case, find the area from two sides and an angle, and solve distance and height problems that involve triangles without a right angle.

What are the law of sines and the law of cosines?

SOHCAHTOA works only in right triangles (see SOHCAHTOA and right triangle trigonometry). The two laws in this lesson work in every triangle: acute, right or obtuse. In the UK and in IB courses they are called the sine rule and the cosine rule; the content is identical.

Both laws use the standard labeling. Name the vertices \( A \), \( B \), \( C \) and the angles at those vertices by the same letters. Then name each side with the lowercase letter of the angle opposite it: side \( a \) is across from angle \( A \), and so on.

Triangle ABC with the standard labels: side a opposite angle A, side b opposite angle B, side c opposite angle CABCcab
Standard labeling: each side is named after the angle opposite it

Notice the pattern in the law of cosines: the side on the left and the angle on the right always match, and the other two sides appear in the rest of the formula. When \( C = 90^\circ \), \( \cos C = 0 \) and the formula becomes \( c^2 = a^2 + b^2 \): the law of cosines is the Pythagorean theorem with a correction term for angles that are not right angles.

Why are the laws true?

Each law has a short proof using a height of the triangle and right-triangle trigonometry. Seeing the proofs makes the formulas much easier to remember.

Proof of the law of sines

Drop the height \( h \) from \( C \) to the line \( AB \). It splits the triangle into two right triangles. In the left one, \( h = b\sin A \); in the right one, \( h = a\sin B \). The two expressions describe the same height, so

\[ b\sin A = a\sin B \quad \Longrightarrow \quad \frac{a}{\sin A} = \frac{b}{\sin B}. \]

Dropping the height from a different vertex gives the same result for \( c \) and \( C \). (If the angle at \( A \) or \( B \) is obtuse, the foot of the height lands outside the triangle, and the same argument works because \( \sin(180^\circ - x) = \sin x \).)

Triangle ABC with the height h from C to side AB: in the left right triangle h = b sin A, in the right one h = a sin B, so b sin A = a sin BhABCbah = b sin Ah = a sin B
The height \( h \) computed two ways gives \( b\sin A = a\sin B \)

Proof of the law of cosines

Put \( C \) at the origin and side \( a \) along the positive x-axis, so \( B = (a, 0) \). The vertex \( A \) is at distance \( b \) from \( C \), at angle \( C \), so \( A = (b\cos C, b\sin C) \). The distance formula gives

\[ c^2 = (b\cos C - a)^2 + (b\sin C)^2 = b^2\cos^2 C - 2ab\cos C + a^2 + b^2\sin^2 C. \]

Since \( \cos^2 C + \sin^2 C = 1 \), this simplifies to \( c^2 = a^2 + b^2 - 2ab\cos C \). The argument does not care whether \( C \) is acute or obtuse.

The extended law of sines

The common ratio has a geometric meaning: it equals the diameter of the circle through the three vertices (the circumcircle), \( \frac{a}{\sin A} = 2R \). This is useful whenever a question mentions the circumradius \( R \).

Which law should you use, and how do you solve a triangle?

Look at what you are given. Triangle data are usually described by letters for sides (S) and angles (A), in the order they appear around the triangle.

  • AAS or ASA (two angles and any side): find the third angle from \( A + B + C = 180^\circ \), then use the law of sines.
  • SAS (two sides and the angle between them): use the law of cosines to find the third side.
  • SSS (three sides): use the law of cosines to find an angle.
  • SSA (two sides and an angle that is not between them): use the law of sines, but watch out for the ambiguous case, which can give zero, one or two triangles.

How to solve a triangle step by step

"Solving a triangle" means finding all three sides and all three angles from the parts you are given. The same routine works every time.

  1. Sketch the triangle and label it in the standard way, marking the known parts.
  2. Identify the case: AAS, ASA, SAS, SSS or SSA.
  3. If two angles are known, find the third from the angle sum of \( 180^\circ \).
  4. Use the law of cosines for SAS or SSS until you have a matching pair; use the law of sines once you have one.
  5. When finding an angle from its sine, decide whether the obtuse option \( 180^\circ - x \) is possible.
  6. Check: the angles add up to \( 180^\circ \), and the longest side is opposite the largest angle.

How do you use the law of sines and the law of cosines?

The examples below go through the four solvable cases in turn. The ambiguous SSA case has its own section after them.

Using the law of sines: AAS and ASA

When two angles are known, the third follows from the angle sum, and then every side has its opposite angle, so the law of sines finds each missing side in one line.

Example 1: Two angles and a side (AAS)

In triangle \( ABC \), \( A = 40^\circ \), \( B = 65^\circ \) and \( a = 12 \). Find \( C \), \( b \) and \( c \), to two decimal places.

Solution. The third angle is \( C = 180^\circ - 40^\circ - 65^\circ = 75^\circ \). The matching pair is \( a = 12 \) with \( A = 40^\circ \), so

\[ b = \frac{a\sin B}{\sin A} = \frac{12\sin 65^\circ}{\sin 40^\circ} \approx 16.92, \qquad c = \frac{12\sin 75^\circ}{\sin 40^\circ} \approx 18.03. \]

Answer: \( C = 75^\circ \), \( b \approx 16.92 \), \( c \approx 18.03 \).

Check: the largest side \( c \) is opposite the largest angle \( C \), and the smallest side \( a \) is opposite the smallest angle \( A \). That ordering is always true in a triangle and is a quick test of your answer.

Example 2: Two angles and the side between them (ASA)

In triangle \( ABC \), \( A = 50^\circ \), \( B = 60^\circ \) and the side between them is \( c = 20 \). Find \( a \) and \( b \).

Solution. First \( C = 180^\circ - 50^\circ - 60^\circ = 70^\circ \). Now \( c = 20 \) and \( C = 70^\circ \) form a matching pair:

\[ a = \frac{20\sin 50^\circ}{\sin 70^\circ} \approx 16.30, \qquad b = \frac{20\sin 60^\circ}{\sin 70^\circ} \approx 18.43. \]

Answer: \( a \approx 16.30 \), \( b \approx 18.43 \).

Using the law of cosines: SAS and SSS

When there is no matching pair, the law of cosines gets you started: it finds the third side from two sides and the angle between them, or an angle from three sides.

Example 3: Two sides and the included angle (SAS)

In triangle \( ABC \), \( a = 7 \), \( b = 10 \) and \( C = 48^\circ \). Find \( c \) and the other two angles.

Solution. The law of cosines gives

\[ c^2 = 7^2 + 10^2 - 2 \cdot 7 \cdot 10 \cos 48^\circ = 149 - 140\cos 48^\circ \approx 55.32, \qquad c \approx 7.44. \]

For the angles, now that we have the matching pair \( c \) and \( C \), use the law of sines for the smaller of the remaining angles, the one opposite the shorter side \( a = 7 \). That angle must be acute, so there is no ambiguity. With the unrounded value of \( c \) from your calculator,

\[ \sin A = \frac{7\sin 48^\circ}{c} \approx 0.6994, \qquad A \approx 44.38^\circ \]

Then \( B = 180^\circ - 48^\circ - 44.38^\circ = 87.62^\circ \).

Answer: \( c \approx 7.44 \), \( A \approx 44.38^\circ \), \( B \approx 87.62^\circ \).

Example 4: Three sides (SSS)

A triangle has sides \( a = 5 \), \( b = 7 \) and \( c = 8 \). Find all three angles.

Solution. Start with the angle opposite the middle side, \( b = 7 \), because the numbers are friendly:

\[ \cos B = \frac{a^2 + c^2 - b^2}{2ac} = \frac{25 + 64 - 49}{2 \cdot 5 \cdot 8} = \frac{40}{80} = \frac{1}{2}, \qquad B = 60^\circ. \]

For the largest angle, opposite \( c = 8 \):

\[ \cos C = \frac{25 + 49 - 64}{2 \cdot 5 \cdot 7} = \frac{10}{70} = \frac{1}{7}, \qquad C \approx 81.79^\circ. \]

Finally \( A = 180^\circ - 60^\circ - 81.79^\circ = 38.21^\circ \).

Answer: \( A \approx 38.21^\circ \), \( B = 60^\circ \), \( C \approx 81.79^\circ \).

The sign of the cosine tells you the type of triangle at once. The largest angle is obtuse exactly when the square of the longest side exceeds the sum of the squares of the other two. Here \( 64 < 25 + 49 \), so the triangle is acute.

Example 5: An exact answer

Two sides of a triangle are 3 and 5, and the angle between them is \( 120^\circ \). Find the exact length of the third side.

Solution. \( \cos 120^\circ = -\frac{1}{2} \), so

\[ c^2 = 3^2 + 5^2 - 2 \cdot 3 \cdot 5 \cdot \left(-\frac{1}{2}\right) = 9 + 25 + 15 = 49, \qquad c = 7. \]

Answer: 7. With an obtuse angle the "minus" term becomes a plus, and the opposite side is longer than it would be in a right triangle.

What is the ambiguous case (SSA)?

When you know two sides and an angle that is not between them, the given information may fit two different triangles, exactly one, or none. Picture the known side \( b \) fixed at angle \( A \), and the side \( a \) swinging from \( C \) like a door: it may miss the base line, touch it once, or cross it in two places.

For an acute angle \( A \), compare \( a \) with the height \( h = b\sin A \):

  • \( a < b\sin A \): no triangle (the side is too short to reach).
  • \( a = b\sin A \): exactly one triangle, with a right angle at \( B \).
  • \( b\sin A < a < b \): two triangles, one with \( B \) acute and one with \( B \) obtuse.
  • \( a \geq b \): exactly one triangle.

If \( A \) is obtuse or right, there is one triangle when \( a > b \) and none otherwise. In practice you do not need to memorize the list: compute \( \sin B \), and then test whether the obtuse partner \( 180^\circ - B \) also fits in a triangle with \( A \).

Example 6: Two possible triangles

In triangle \( ABC \), \( A = 30^\circ \), \( a = 6 \) and \( b = 10 \). Find all possible values of \( B \), \( C \) and \( c \).

Solution. By the law of sines, \( \sin B = \frac{10\sin 30^\circ}{6} = \frac{5}{6} \approx 0.8333 \). The inverse sine gives \( B_1 \approx 56.44^\circ \). The supplementary angle \( B_2 = 180^\circ - 56.44^\circ = 123.56^\circ \) has the same sine, and \( 30^\circ + 123.56^\circ < 180^\circ \), so it also works.

  • Triangle 1: \( C_1 = 180^\circ - 30^\circ - 56.44^\circ = 93.56^\circ \) and \( c_1 = \frac{6\sin 93.56^\circ}{\sin 30^\circ} \approx 11.98 \).
  • Triangle 2: \( C_2 = 180^\circ - 30^\circ - 123.56^\circ = 26.44^\circ \) and \( c_2 = \frac{6\sin 26.44^\circ}{\sin 30^\circ} \approx 5.34 \).

Answer: either \( B \approx 56.44^\circ \), \( C \approx 93.56^\circ \), \( c \approx 11.98 \), or \( B \approx 123.56^\circ \), \( C \approx 26.44^\circ \), \( c \approx 5.34 \).

The ambiguous case with angle A = 30 degrees, b = 10 and a = 6: a circle of radius 6 around C meets the base line twice, at B1 with c about 11.98 and at B2 with c about 5.34, giving two different triangles30°B₁B₂ACb = 10a = 6a = 6
SSA with \( A = 30^\circ \), \( b = 10 \), \( a = 6 \): the side \( a \) can reach the base at two points

Example 7: No triangle, or exactly one

Keep \( A = 30^\circ \) and \( b = 10 \). How many triangles are there if (a) \( a = 4 \); (b) \( a = 12 \)?

Solution. (a) \( \sin B = \frac{10 \cdot 0.5}{4} = 1.25 \). No angle has a sine greater than 1, so no triangle exists. (Equivalently, \( a = 4 \) is shorter than the height \( b\sin A = 5 \).)

(b) \( \sin B = \frac{10 \cdot 0.5}{12} = \frac{5}{12} \), so \( B \approx 24.62^\circ \). The partner angle would be \( 155.38^\circ \), but \( 30^\circ + 155.38^\circ > 180^\circ \), so it is impossible. There is exactly one triangle, as expected because \( a > b \).

Answer: (a) none; (b) exactly one, with \( B \approx 24.62^\circ \).

How do you find the area and solve word problems?

The same trigonometry gives a quick area formula, and the two laws together handle most real-world triangle problems: surveying, navigation, heights and distances you cannot measure directly.

The area formula with sine

If you know two sides and the angle between them, the area is

\[ \text{Area} = \frac{1}{2}ab\sin C \]

This follows from "half base times height": with base \( a \), the height is \( b\sin C \), exactly as in the proof of the law of sines. If you know all three sides instead, either find an angle with the law of cosines first, or use Heron's formula, \( \text{Area} = \sqrt{s(s-a)(s-b)(s-c)} \) with \( s = \frac{a+b+c}{2} \).

Example 8: Area from SAS

Find the area of a triangle with sides 8 cm and 11 cm and an included angle of \( 35^\circ \).

Solution. \( \text{Area} = \frac{1}{2} \cdot 8 \cdot 11 \cdot \sin 35^\circ = 44\sin 35^\circ \approx 25.24 \) cm².

Answer: about 25.24 cm².

Word problems

Draw a clear diagram, mark everything you know, and look for a triangle where you have SAS, SSS, or a matching pair. Often you need two steps, one in each of two triangles.

Example 9: Distance across a lake

To find the distance between two points \( A \) and \( B \) on opposite sides of a lake, a surveyor stands at point \( C \) and measures \( CA = 120 \) m, \( CB = 150 \) m and the angle \( ACB = 72^\circ \). How far apart are \( A \) and \( B \)?

Solution. This is SAS, so use the law of cosines:

\[ AB^2 = 120^2 + 150^2 - 2 \cdot 120 \cdot 150 \cos 72^\circ \approx 25775.39, \qquad AB \approx 160.55 \text{ m}. \]

Answer: about 160.55 m (about 161 m).

Example 10: Height from two angles of elevation (exam level)

From a point \( P \) on level ground, the angle of elevation to the top \( T \) of a tower is \( 32^\circ \). After walking 50 m straight toward the tower to point \( Q \), the angle of elevation is \( 47^\circ \). Find the height of the tower.

Solution. Look at triangle \( PQT \). The angle at \( P \) is \( 32^\circ \). The angle at \( Q \) inside the triangle is \( 180^\circ - 47^\circ = 133^\circ \). So the angle at \( T \) is \( 180^\circ - 32^\circ - 133^\circ = 15^\circ \). The side \( PQ = 50 \) is opposite that \( 15^\circ \) angle, which gives a matching pair. By the law of sines,

\[ QT = \frac{50\sin 32^\circ}{\sin 15^\circ} \approx 102.37 \text{ m}. \]

Now use the right triangle formed by \( Q \), \( T \) and the foot of the tower: the height is

\[ h = QT \sin 47^\circ \approx 102.37 \cdot \sin 47^\circ \approx 74.87 \text{ m}. \]

Answer: about 74.87 m. (As a check, the foot of the tower is \( \frac{74.87}{\tan 47^\circ} \approx 69.82 \) m from \( Q \).)

Two angles of elevation to the top of a tower: 32 degrees from P and 47 degrees from Q, 50 meters closer; triangle PQT has angles 32, 133 and 15 degrees, and the tower is about 74.87 meters tall32°47°15°50 mhPQT
Example 10: the oblique triangle \( PQT \) has angles \( 32^\circ \), \( 133^\circ \), \( 15^\circ \)

The SOHCAHTOA lesson solves a problem like this with two tangent equations and some algebra. The law of sines route avoids the algebra: one oblique triangle, then one right triangle.

Example 11: The circumradius

In a triangle, side \( a = 10 \) and the opposite angle \( A = 30^\circ \). Find the radius of the circumscribed circle.

Solution. By the extended law of sines, \( 2R = \frac{a}{\sin A} = \frac{10}{0.5} = 20 \), so \( R = 10 \).

Answer: \( R = 10 \).

Example 12: Diagonals of a parallelogram

A parallelogram has sides 6 and 10 and an angle of \( 60^\circ \). Find the lengths of both diagonals.

Solution. Each diagonal is the third side of a triangle formed by two adjacent sides. The adjacent angles of a parallelogram are \( 60^\circ \) and \( 120^\circ \).

\[ d_1^2 = 6^2 + 10^2 - 2 \cdot 6 \cdot 10 \cos 60^\circ = 136 - 60 = 76, \qquad d_1 = \sqrt{76} = 2\sqrt{19} \approx 8.72 \]
\[ d_2^2 = 6^2 + 10^2 - 2 \cdot 6 \cdot 10 \cos 120^\circ = 136 + 60 = 196, \qquad d_2 = 14 \]

Answer: \( 2\sqrt{19} \approx 8.72 \) and 14. Notice that \( d_1^2 + d_2^2 = 2(6^2 + 10^2) = 272 \), a neat property of every parallelogram.

What are the most common mistakes?

  • Mismatched pairs. In the law of sines, each side must sit over the sine of the angle opposite it.
  • Forgetting the second triangle in SSA. Always test \( 180^\circ - B \) when you find an angle from its sine.
  • Using the law of sines for an obtuse angle. \( \sin^{-1} \) never returns an obtuse angle; use the law of cosines or find the smallest angle first.
  • Order of operations in the law of cosines. Compute \( 2ab\cos C \) as one product and subtract it from \( a^2 + b^2 \). Writing \( (a^2 + b^2 - 2ab)\cos C \) is wrong.
  • Calculator in radian mode. \( \cos 48 \) in radian mode is about \( -0.640 \), not \( 0.669 \).
  • Rounding too early. Keep the full value of a side you calculated and use it in the next step; round only the final answers.

FAQ about the law of sines and cosines

Can I use these laws in a right triangle?

Yes. They work in every triangle. In a right triangle, though, SOHCAHTOA and the Pythagorean theorem are faster, and the laws reduce to them anyway: with \( C = 90^\circ \), \( \sin C = 1 \) and \( \cos C = 0 \).

Is the sine rule the same as the law of sines?

Yes. "Sine rule" and "cosine rule" are the names used in the UK, Australia and IB courses; "law of sines" and "law of cosines" are the usual US names.

Why does the ambiguous case happen only with SSA?

With AAS, ASA, SAS and SSS, the given parts fix the triangle completely; these are the same conditions as the triangle congruence tests. SSA is not a congruence test, so the data can fit two different triangles.

Do I need to memorize all three versions of the law of cosines?

No. Remember one, \( c^2 = a^2 + b^2 - 2ab\cos C \), and the pattern: the side on the left is opposite the angle in the cosine, and the other two sides appear on the right. Rename the letters to fit your triangle.

How do I know if a triangle is acute or obtuse from its sides?

Compare the square of the longest side \( c \) with \( a^2 + b^2 \). If \( c^2 < a^2 + b^2 \) the triangle is acute, if equal it is right, and if greater it is obtuse. This is the law of cosines read through the sign of \( \cos C \).

Cheat sheet

  • Labeling: side \( a \) is opposite angle \( A \), and so on.
  • Law of sines: \( \frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} = 2R \).
  • Law of cosines: \( c^2 = a^2 + b^2 - 2ab\cos C \); \( \cos C = \frac{a^2 + b^2 - c^2}{2ab} \).
  • AAS, ASA: law of sines. SAS, SSS: law of cosines. SSA: law of sines, check for two triangles.
  • Ambiguous case: if \( \sin B < 1 \), test whether \( 180^\circ - B \) also fits.
  • Area: \( \frac{1}{2}ab\sin C \); Heron: \( \sqrt{s(s-a)(s-b)(s-c)} \).
  • Angles add up to \( 180^\circ \); the longest side is opposite the largest angle.

Practice

Each problem checks your answer at once and has a hint and a full solution.

For more, see all trigonometry practice problems, the lesson on radians and degrees, or browse the other English lessons.

All math lessons Practice problems by topic