Law of Cosines Notes

Published on: September 29, 2026

These Law of Cosines Notes explain how to find a missing side or a missing angle in a triangle that has no right angle, with the working shown line by line. Two sides with the angle between them give the third side, while three sides give the angle facing one of them, so what is given decides which form of the law is written down. The rest is substituting and simplifying what is left. Following the same pattern every time keeps the two cases apart.

A B C a b c

In the diagram, each side is named after the angle opposite it: \(a\) faces \(A\), \(b\) faces \(B\) and \(c\) faces \(C\).

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Rearrange the formula to make the missing value the subject.
  4. Substitute the given values into the formula.
  5. Solve for the missing value.

Formula: Law of Cosines for a Side

This form gives side c from sides a and b and the angle C between them.

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

Formula: Law of Cosines for an Angle

This form gives angle C from all three sides, where c is the side opposite C.

\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)

Useful Tips to Remember

Use the law of cosines when you know two sides and the angle between them, or all three sides. In \(c^2 = a^2 + b^2 - 2ab\cos C\), the angle \(C\) must be opposite the side \(c\). Work out \(2ab\cos C\) as one value before subtracting it. An obtuse angle has a negative cosine, which makes the third side longer.

Required knowledge

Where Is the Law of Cosines Used?

The law of cosines, \(c^2 = a^2 + b^2 - 2ab\cos C\), extends Pythagoras' theorem to triangles without a right angle. It finds the third side when two sides and the angle between them are known, or any angle when all three sides are known. Surveyors use it to measure distances across lakes and fields, navigators use it to find the distance between two ships or planes, and engineers use it to design frames and trusses. It also gives the distance between two objects from their bearings and ranges.

  • Measuring distances across rivers, lakes and fields
  • Finding the distance between two ships or aircraft
  • Designing trusses, frames and robot arms
  • Working out the angles of a triangular plot from its sides
  • Calculating distances between radar positions

Law of Cosines Practice Problems

Example 1 finds the third side from \(a = 6\), \(b = 9\) and \(C = 45^\circ\), and Example 2 finds an angle from the three sides 5, 6 and 7. Examples 3 and 4 give you two more of the same kind to try, \(a = 7,\; b = 10,\; C = 60^{\circ}\) and \(a = 8,\; b = 9,\; c = 12\). Try each one yourself before opening the examples.

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.

See Example 1 Hide Example 1

Problem

\(a = 6,\; b = 9,\; C = 45^{\circ}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Rearrange the formula to make the missing value the subject.
  4. Substitute the given values into the formula.
  5. Solve for the missing value.

Formula

Formula: Law of Cosines for a Side

This form gives side c from sides a and b and the angle C between them.

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

Step 1

Step 1 - Set up the problem.

In this problem: Two sides and the angle between them are known: \(a = 6\), \(b = 9\) and \(C = 45^{\circ}\), and side \(c\) is missing.

\(a = 6,\; b = 9,\; C = 45^{\circ}\)
A B C 45° 6 9 c

Step 2

Step 2 - Write the Law of Cosines in the form that fits what is given.

In this problem: The angle sits between the two known sides, so the form that solves for the third side is \(c^{2} = a^{2} + b^{2} - 2ab\cos(C)\).

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

Step 3

Step 3 - Rearrange the formula to make the missing value the subject.

In this problem: Making \(c\) the subject gives \(c = \sqrt{a^{2} + b^{2} - 2ab\cos(C)}\), worked through below. \(c\) is a length, so only the positive square root is kept.

\(c = \sqrt{a^{2} + b^{2} - 2ab\cos(C)}\)

Step 4

Step 4 - Substitute the given values into the formula.

In this problem: Replacing \(a\), \(b\) and \(C\) with \(6\), \(9\) and \(45^{\circ}\) gives \(c = \sqrt{6^{2} + 9^{2} - 2 \times 6 \times 9 \times \cos(45^{\circ})}\).

\(c = \sqrt{6^{2} + 9^{2} - 2 \times 6 \times 9 \times \cos(45^{\circ})}\)

Step 5

Step 5 - Solve for the missing value.

In this problem: Working out the square root gives \(c \approx 6.37\).

\(c = \sqrt{6^{2} + 9^{2} - 2 \times 6 \times 9 \times \cos(45^{\circ})} \approx 6.37\)

Final Answer

\(c \approx 6.37\)
See Example 2 Hide Example 2

Problem

\(a = 5,\; b = 6,\; c = 7\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Rearrange the formula to make the missing value the subject.
  4. Substitute the given values into the formula.
  5. Solve for the missing value.

Formula

Formula: Law of Cosines for an Angle

This form gives angle C from all three sides, where c is the side opposite C.

\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)

Step 1

Step 1 - Set up the problem.

In this problem: All three sides are known: \(a = 5\), \(b = 6\) and \(c = 7\), and angle \(C\) is missing.

\(a = 5,\; b = 6,\; c = 7\)
A B C 5 6 7

Step 2

Step 2 - Write the Law of Cosines in the form that fits what is given.

In this problem: The missing value is the angle opposite side \(c\), so the form that solves for the angle is \(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\).

\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)

Step 3

Step 3 - Rearrange the formula to make the missing value the subject.

In this problem: Taking the inverse cosine of both sides makes \(C\) the subject: \(C = \cos^{-1}\left(\frac{a^{2} + b^{2} - c^{2}}{2ab}\right)\).

\(C = \cos^{-1}\left(\frac{a^{2} + b^{2} - c^{2}}{2ab}\right)\)

Step 4

Step 4 - Substitute the given values into the formula.

In this problem: Replacing \(a\), \(b\) and \(c\) with \(5\), \(6\) and \(7\) gives \(C = \cos^{-1}\left(\frac{5^{2} + 6^{2} - 7^{2}}{2 \times 5 \times 6}\right)\).

\(C = \cos^{-1}\left(\frac{5^{2} + 6^{2} - 7^{2}}{2 \times 5 \times 6}\right)\)

Step 5

Step 5 - Solve for the missing value.

In this problem: Working this out gives \(C \approx 78.46^{\circ}\).

\(C = \cos^{-1}\left(\frac{5^{2} + 6^{2} - 7^{2}}{2 \times 5 \times 6}\right) \approx 78.46^{\circ}\)

Final Answer

\(C \approx 78.46^{\circ}\)
See Example 3 Hide Example 3

Problem

\(a = 7,\; b = 10,\; C = 60^{\circ}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Rearrange the formula to make the missing value the subject.
  4. Substitute the given values into the formula.
  5. Solve for the missing value.

Formula

Formula: Law of Cosines for a Side

This form gives side c from sides a and b and the angle C between them.

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

Step 1

Step 1 - Set up the problem.

In this problem: Two sides and the angle between them are known: \(a = 7\), \(b = 10\) and \(C = 60^{\circ}\), and side \(c\) is missing.

\(a = 7,\; b = 10,\; C = 60^{\circ}\)
A B C 60° 7 10 c

Step 2

Step 2 - Write the Law of Cosines in the form that fits what is given.

In this problem: The angle sits between the two known sides, so the form that solves for the third side is \(c^{2} = a^{2} + b^{2} - 2ab\cos(C)\).

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

Step 3

Step 3 - Rearrange the formula to make the missing value the subject.

In this problem: Making \(c\) the subject gives \(c = \sqrt{a^{2} + b^{2} - 2ab\cos(C)}\), worked through below. \(c\) is a length, so only the positive square root is kept.

\(c = \sqrt{a^{2} + b^{2} - 2ab\cos(C)}\)

Step 4

Step 4 - Substitute the given values into the formula.

In this problem: Replacing \(a\), \(b\) and \(C\) with \(7\), \(10\) and \(60^{\circ}\) gives \(c = \sqrt{7^{2} + 10^{2} - 2 \times 7 \times 10 \times \cos(60^{\circ})}\).

\(c = \sqrt{7^{2} + 10^{2} - 2 \times 7 \times 10 \times \cos(60^{\circ})}\)

Step 5

Step 5 - Solve for the missing value.

In this problem: Working out the square root gives \(c \approx 8.89\).

\(c = \sqrt{7^{2} + 10^{2} - 2 \times 7 \times 10 \times \cos(60^{\circ})} \approx 8.89\)

Final Answer

\(c \approx 8.89\)
See Example 4 Hide Example 4

Problem

\(a = 8,\; b = 9,\; c = 12\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Rearrange the formula to make the missing value the subject.
  4. Substitute the given values into the formula.
  5. Solve for the missing value.

Formula

Formula: Law of Cosines for an Angle

This form gives angle C from all three sides, where c is the side opposite C.

\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)

Step 1

Step 1 - Set up the problem.

In this problem: All three sides are known: \(a = 8\), \(b = 9\) and \(c = 12\), and angle \(C\) is missing.

\(a = 8,\; b = 9,\; c = 12\)
A B C 8 9 12

Step 2

Step 2 - Write the Law of Cosines in the form that fits what is given.

In this problem: The missing value is the angle opposite side \(c\), so the form that solves for the angle is \(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\).

\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)

Step 3

Step 3 - Rearrange the formula to make the missing value the subject.

In this problem: Taking the inverse cosine of both sides makes \(C\) the subject: \(C = \cos^{-1}\left(\frac{a^{2} + b^{2} - c^{2}}{2ab}\right)\).

\(C = \cos^{-1}\left(\frac{a^{2} + b^{2} - c^{2}}{2ab}\right)\)

Step 4

Step 4 - Substitute the given values into the formula.

In this problem: Replacing \(a\), \(b\) and \(c\) with \(8\), \(9\) and \(12\) gives \(C = \cos^{-1}\left(\frac{8^{2} + 9^{2} - 12^{2}}{2 \times 8 \times 9}\right)\).

\(C = \cos^{-1}\left(\frac{8^{2} + 9^{2} - 12^{2}}{2 \times 8 \times 9}\right)\)

Step 5

Step 5 - Solve for the missing value.

In this problem: Working this out gives \(C \approx 89.6^{\circ}\).

\(C = \cos^{-1}\left(\frac{8^{2} + 9^{2} - 12^{2}}{2 \times 8 \times 9}\right) \approx 89.6^{\circ}\)

Final Answer

\(C \approx 89.6^{\circ}\)

Calculator and Practice Mode