Law of cosines

Here is everything you need to know about the law of cosines or cosine rule. You’ll learn how to use the cosine rule to find missing sides and angles in an oblique triangle (non-right triangle) and understand when to use the cosine rule instead of using the law of sines, Pythagorean theorem, or SOHCAHTOA (right triangle trigonometry).

Students first learn how to work with the law of cosines in geometry and expand that knowledge as they progress through Algebra 2 and precalculus.

What is the law of cosines?

The law of cosines (or cosine rule) is a formula that can be used to calculate a missing side or missing angle in a triangle. To apply the law of cosines, you need to know the correct arrangement of the formula and what each variable represents.

The law of cosines is typically used when you are given the three sides of a triangle (SSS) or given two sides of a triangle with the included angle measurement, (SAS).

Take a look at the triangle ABC below.

Law of Cosines 1 US

The way you label the sides of a triangle and the angles of a triangle is the same as how you label them when using the law of sines, opposite the angle is the side.

For example, opposite angle A is side a, opposite angle B is side b, and opposite angle C is side c.

The law of cosines or the cosine rule is:

a^{2}=b^{2}+c^{2}-2bc\cos(A)

Take a look at this triangle. If you wanted to solve for the length of side a, you would use the formula a^{2}=b^{2}+c^{2}-2bc\cos(A).

Notice how side a in the formula is isolated on the left hand side of the equation with angle A being used on the right hand side of the equation.

Law of Cosines 2 US

If you need to find a different side or angle, you can use the alternate forms of the law of cosines.

The law of cosines can also be written as:

b^2=a^2+c^2-2 a c \cos (B)

or

c^2=a^2+b^2-2 a b \cos (C)

Let’s look at how to use the law of cosines to solve the triangle.

[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

Use this quiz to check your grade 9 to 12 students’ understanding of Trigonometry. 15+ questions with answers covering a range of 9th to 12th grade trigonometry topics to identify areas of strength and support!

DOWNLOAD FREE
x
[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

[FREE] Trigonometry Check for Understanding Quiz (Grade 9 to 12)

Use this quiz to check your grade 9 to 12 students’ understanding of Trigonometry. 15+ questions with answers covering a range of 9th to 12th grade trigonometry topics to identify areas of strength and support!

DOWNLOAD FREE

Using the law of cosines to find an unknown side

Find side a in the triangle. Remember that side a is opposite angle A and side b is opposite angle B and side c is opposite angle C.

Law of Cosines 3 US

Using the law of cosines,

a^2=b^2+c^2-2 b c \cos (A)

Substitute in the values:

\begin{aligned}&x^2=(6.5)^2+(7.1)^2-2(6.5)(7.1) \cos (32) \\\\ &x^2=42.25+50.41-78.27 \\\\ &x^2=14.39 \\\\ &\sqrt{x^2}=\sqrt{14.39} \\\\ &x=3.79 \end{aligned}

Side a is approximately 3.79 \, cm which makes sense looking at the sketch of the triangle.

Using the law of cosines to find an unknown angle

Find angle \theta in the triangle. Remember to label the triangle as A, \, B, \, C and a, \, b, \, c to help decide which equation to use.

Law of Cosines 4 US

The way the triangle is labeled, angle \theta is angle B so the arrangement of the law of cosines that should be used is:

b^2=a^2+c^2-2 a c \cos (B)

Substitute the values into the equation.

(27.5)^2=(13.8)^2+(29.7)^2-2(13.8)(29.7) \cos B

\begin{aligned} & 756.25=190.44+882.09-819.72 \cos B \\\\ & 756.25=1072.53-819.72 \cos B \end{aligned}

756.25-1072.53=1072.53-1072.53-819.72 \cos B

\begin{aligned} & - \, 316.28=- \, 819.72 \cos B \\\\ & \cfrac{- \, 316.28}{- \, 819.72}=\cfrac{- \, 819.72 \cos B}{- \, 819.72} \end{aligned}

(0.3858)=\cos B \quad (Use the inverse cosine to solve)

\begin{aligned} & \cos ^{-1}(0.3858)=\cos ^{-1}(\cos B) \\\\ & 67.31=\text { angle } B \\\\ & \text { Angle } B=\text { angle } \theta \approx 67.31^{\circ} \end{aligned}

What is the law of cosines?

What is the law of cosines?

Common Core State Standards

How does this relate to high school math?

  • High School Geometry – Similarity, Right Triangles, and Trigonometry – HSG-SRT.D.10 (+)
    Prove the Laws of Sines and Cosines and use them to solve problems.

  • High School Geometry – Similarity, Right Triangles, and Trigonometry – HSG-SRT.D.11 (+)
    Understand and apply the Law of Sines and the Law of Cosines to find unknown measurements in right and non-right triangles (example, surveying problems, resultant forces).

How to find the missing side or angle of a triangle using the law of cosines

In order to find the missing side or angle of a triangle using the law of cosines:

  1. Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.
  2. State the law of cosines, then substitute the given values into the formula.
  3. Solve the equation.

Cosine rule examples (missing side)

Example 1: find a missing side using the cosine rule

Find the value of x for triangle ABC, correct to 2 decimal places.

Law of Cosines 5 US

  1. Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

Law of Cosines 6 US

2State the law of cosines, then substitute the given values into the formula.

Looking at how the triangle is labeled, x is the same as side c.

So, the arrangement of the law of cosines should be:

c^2=a^2+b^2-2 a b \cos C

Substitute in the values:

x^2=(12.5)^2+(14)^2-2(12.5)(14) \cos (38)

3Solve the equation.

\begin{aligned}& x^2=(12.5)^2+(14)^2-2(12.5)(14) \cos (38) \\\\ & x^2=156.25+196-350(0.7880) \\\\ & x^2=352.25-275.8 \\\\ & x^2=76.25 \\\\ & \sqrt{x^2}=\sqrt{76.25} \\\\ & x=8.74 \\\\ & x=\text { side } c \approx 8.74\mathrm{~cm} \end{aligned}

Example 2: find a missing side using the cosine rule

Find the length of XY for triangle XYZ.

Law of Cosines 7 US

Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

State the law of cosines, then substitute the given values into the formula.

Solve the equation.

Example 3: find a missing side using the cosine rule

Find the length of side b in triangle ABC. Round your answer to the nearest tenth.

Law of Cosines 9 US

Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

State the law of cosines, then substitute the given values into the formula.

Solve the equation.

Law of cosines examples (missing angle)

Example 4: find a missing angle using the cosine rule

Find the measure of the angle \theta for the isosceles triangle ABC. Round your answer to the nearest tenth.

Law of Cosines 11 US

Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

State the law of cosines, then substitute the given values into the formula.

Solve the equation.

Example 5: find a missing angle using the cosine rule

Find the measure of angle \theta for triangle EFG. Round your answer to the nearest hundredth.

Law of Cosines 13 US

Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

State the law of cosines, then substitute the given values into the formula.

Solve the equation.

Example 6: find a missing obtuse angle using the cosine rule

Find the measure of angle \theta for triangle XYZ. Write your answer to 2 decimal places.

Law of Cosines 15 US

Label each angle \textbf{(A, \, B, \, C)} and each side \textbf{(a, \, b, \, c)} of the triangle.

State the law of cosines, then substitute the given values into the formula.

Teaching tips for the law of cosines

  • Provide opportunities for students to investigate the law of cosines through platforms such as Desmos where they can determine when the law of cosines works and when it doesn’t.

  • Give students different scenarios to determine when the law of cosines works. For example, when the triangle has known parts set up as ASA, \, AAS, \, SAS, \, and SSS.

  • Instead of giving students a worksheet to practice problems, have them do scavenger hunts or game playing.

  • Incorporate game playing using math apps for students to practice skills.

Easy mistakes to make

  • Using the Pythagorean Theorem instead of the Law of Cosines
    For example, solving for x by doing:

    \begin{aligned}& 12^2+12^2=x^2 \\\\ & 144+144=x^2 \\\\ & 288=x^2 \\\\ & \sqrt{288}=x \end{aligned}

    This would be incorrect because the triangle does not have a right angle so the Pythagorean Theorem cannot be used. Instead, apply the law of cosines.

    Law of Cosines 17 US

  • Labeling the triangle incorrectly
    Labeling the triangle incorrectly can lead to incorrect calculations and incorrect use of the law of sines. For example, this triangle has been incorrectly labeled with the side next to the angle.

    Law of Cosines 18 US
    Remember, the correct way is to label the angles and across from the angle is the side.

  • Using the sine function instead of the cosine function
    For example, when applying the law of cosines accidentally typing the sin function or the inverse sine function on the calculator.

  • Using the law of cosines incorrectly
    For example, using a^2=b^2+c^2+2 b c \cos (A) instead of a^2=b^2+c^2-2 b c \cos (A). A common error is to add the 2 b c \operatorname {cos}(A) instead of subtracting it.

  • Solving the law of cosines incorrectly
    For example, when using the law of cosines when the side lengths are given to be a = 20, \, b = 14, \, c = 17 and you have to find the angle A .

    \begin{aligned}& a^2=b^2+c^2-2 b c \operatorname {cos}(A) \\\\ & 20^2=14^2+17^2-2(14)(17) \cos A \\\\ & 400=196+289-476 \cos A \\\\ & 400=485-476 \cos A \end{aligned}

    - \, 85 9 \cos A

    The correct way to solve this would be:

    \begin{aligned}& 20^2=14^2+17^2-2(14)(17) \cos A \\\\ & 400=196+289-476 \cos A \\\\ & 400=485-476 \cos A \end{aligned}

    - \, 85=- \, 476 \cos A \quad (divide both sides by - \,476)

    0.1786=\cos A \quad (use the inverse cosine function)

    \begin{aligned} & \cos ^{-1}(0.1786)=\cos ^{-1}(\cos A) \\\\ & 79.71^{\circ}=\text { Angle } A \end{aligned}

Practice law of cosine questions

1. Use the law of cosines to find the length of the third side of a triangle which is represented by x. Round your answer to the nearest tenth.

 

Law of Cosines 19US

13.6 \, cm
GCSE Quiz False

13.2 \, cm
GCSE Quiz False

15.2 \, cm
GCSE Quiz True

4.2 \, cm
GCSE Quiz False

Label the triangle:

 

Law of Cosines 20 US

 

Use the labeled triangle to write the correct arrangement of the law of cosines:

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& x^2=12^2+8^2-2 \times 12 \times 8 \times \cos (97) \\\\ & x^2=208-192 \cos (97) \\\\ & x^2=231.3989 \end{aligned}

 

x=\sqrt{231.3989} \quad (take the square root)

 

x=15.2 \quad (rounded to the nearest tenth)

2. Find the length of x for triangle PQR. Write your answer to the nearest tenth.

 

Law of Cosines 21 US

10.2 \, cm
GCSE Quiz False

5.8 \, cm
GCSE Quiz True

8.3 \, cm
GCSE Quiz False

10.5 \, cm
GCSE Quiz False

Label the triangle:

 

Law of Cosines 22 US

 

Use the labeled triangle to write the correct arrangement of the law of cosines:

 

The law of cosines states:

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& x^2=6.3^2+5.4^2-2 \times 6.3 \times 5.4 \times \cos (59) \\\\ & x^2=68.85-68.04 \cos (59) \\\\ & x^2=33.8068 \end{aligned}

 

x=\sqrt{33.8068} \quad (take the square root)

 

x=5.8 \quad (rounded to the nearest tenth)

3. Find the length of XY for triangle XYZ. Write your answer to the nearest tenth.

 

Law of Cosines 23 US

11.6 \, cm
GCSE Quiz False

3.3 \, cm
GCSE Quiz False

5.8 \, cm
GCSE Quiz False

10.5 \, cm
GCSE Quiz True

Label the triangle:

 

Law of Cosines 24 US

 

Use the labeled triangle to write the correct arrangement of the law of cosines.

 

The law of cosines states:

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& a^2=6^2+6^2-2 \times 6 \times 6 \times \cos (122) \\\\ & x^2=72-72 \cos (122) \\\\ & x^2=110.154187 \end{aligned}

 

x=\sqrt{110.154187} \quad (take the square root)

 

x=10.5 \quad (nearest tenth)

4. Find the measure of angle \theta for triangle ABC. Round the angle to the nearest tenth.

 

Law of Cosines 25 US

43.8^{\circ}
GCSE Quiz False

1.00^{\circ}
GCSE Quiz False

28.0^{\circ}
GCSE Quiz False

134^{\circ}
GCSE Quiz True

Label the triangle:

 

Law of Cosines 26 US

 

Use the labeled triangle to write the correct arrangement of the law of cosines:

 

The law of cosines states:

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& 12^2=5.2^2+7.8^2-2(5.2)(7.8) \cos A \\\\ & 144=27.04+60.84-81.12 \cos A \\\\ & 144=87.88-81.12 \cos A \\\\ & 56.12=- \, 81.12 \cos A \\\\ & \cfrac{56.12}{- \, 81.12}=\cfrac{- \, 81.12 \cos A}{- \, 81.12} \\\\ & – \, 0.6918=\cos A \end{aligned}

 

\cos ^{-1}(- \, 0.6918)=\cos ^{-1}(\cos A) \quad (use the inverse cosine function)

 

\begin{aligned} & 133.8^{\circ}=\text { Angle } A=\theta \\\\ & 133.8^{\circ}=\theta \end{aligned}

5. Find the measure of angle \theta for triangle XYZ. Round your answer to the nearest tenth.

 

Law of Cosines 27 US

30.4^{\circ}
GCSE Quiz True

59.6^{\circ}
GCSE Quiz False

1.00^{\circ}
GCSE Quiz False

36.7^{\circ}
GCSE Quiz False

Label the triangle:

 

Law of Cosines 28 US

 

Use the correct arrangement for the law of cosines

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& 8.3^2=15.1^2+9.8^2-2(15.1)(9.8) \cos A \\\\ & 68.89=228.01+96.04-295.96 \cos A \\\\ & 68.89=324.05-295.96 \cos A \\\\ & – \, 255.16=- \, 295.96 \cos A \\\\ & \cfrac{- \, 255.16}{- \, 295.96}=\cfrac{- \, 295.96 \cos A}{- \, 295.96} \\\\ & 0.8621=\cos A \end{aligned}

 

\cos ^{-1}(0.8621)=\cos ^{-1}(\cos A) \quad (use the inverse cosine function)

 

\theta=30.4^{\circ}

6. Find the measure of angle \theta for triangle EFG. Write your answer to 2 decimal places.

 

Law of Cosines 29 US

73.60^{\circ}
GCSE Quiz False

16.10^{\circ}
GCSE Quiz True

1.00^{\circ}
GCSE Quiz False

81.95^{\circ}
GCSE Quiz False

Label the triangle:

 

Law of Cosines 30 US

 

Use the correct arrangement for the law of cosines

 

a^2=b^2+c^2-2 b c \cos (A)

 

Substitute in the values:

 

\begin{aligned}& 7^2=25^2+25^2-2(25)(25) \cos A \\\\ & 49=625+625-1250 \cos A \\\\ & 49=1250-1250 \cos A \\\\ & – \, 1201=- \, 1250 \cos A \\\\ & \cfrac{- \, 1201}{- \, 1250}=\cfrac{- \, 1250}{- \, 1250} \cos A \\\\ & 0.9608=\cos A \end{aligned}

 

\cos ^{-1}(0.9608)=\cos ^{-1}(\cos A) \quad (Use the inverse cosine function)

 

\begin{aligned} & 16.1^{\circ}=\text { Angle } A=\theta \\\\ & 16.1^{\circ}=\theta \end{aligned}

Law of cosines FAQs

Can you use the law of cosines to solve for the sides and angles of any triangle?

You can use the law of cosines to find the angles and sides of any triangle. However, if the triangle is a right triangle using Pythagoras’s theorem or right triangle trigonometry might be more efficient.

Is there a law of tangents rule?

There is a law of tangents, but it is rarely or never taught in high school. However, if you pursue mathematics in college, there is a possibility you will learn about it.

Can you use the law of cosines to find the angles and sides of an acute triangle?

Yes, you can use the law of cosines to find the missing sides and angles of any acute triangle. However, look to see what values are given because the law of sines might be more efficient.

Are there other ways to find the area of a triangle other than \bf \textbf{A}=\bf{\cfrac{1}{2}} \, \textbf{b}\textbf{h}?

Yes, there are other ways you can find the area of a triangle.

When learning trigonometry, you will learn how to find the area of a triangle using the formula, A=\cfrac{1}{2} \, b c \sin A which can also be written as A=\cfrac{1}{2} \, a c \sin B or A=\cfrac{1}{2} \, a b \sin C.

These formulas can be used when you have two known sides of a triangle and the angle in between them.

When using the law of cosines, will you have to solve quadratic equations?

Yes, there might be situations when you will have to solve quadratic equations when using law of cosines. For example, when you have two sides and a non-included angle.

Will I have to use law of cosines or law of sines to solve word problems?

Yes, just like the pythagorean theorem, you will have to be able to apply the law of sines and cosines to word problems. The rules can also be used when working with vectors.

The next lessons are

  • Circle math
  • Sectors arcs and segments
  • Circle theorems

Still stuck?

At Third Space Learning, we specialize in helping teachers and school leaders to provide personalized math support for more of their students through high-quality, online one-on-one math tutoring delivered by subject experts.

Each week, our tutors support thousands of students who are at risk of not meeting their grade-level expectations, and help accelerate their progress and boost their confidence.

One on one math tuition

Find out how we can help your students achieve success with our math tutoring programs.

x

[FREE] Common Core Practice Tests (3rd to 8th Grade)

Prepare for math tests in your state with these 3rd Grade to 8th Grade practice assessments for Common Core and state equivalents.

Get your 6 multiple choice practice tests with detailed answers to support test prep, created by US math teachers for US math teachers!

Download free