Law of Cosines Calculator

Published on: February 9, 2025
Final Answer: Free • Full Steps: Plus

This Law of Cosines Calculator finds a missing side or a missing angle in a triangle that has no right angle, and shows the working 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.

Step-by-step method

  1. Set up the problem.
  2. Write the Law of Cosines in the form that fits what is given.
  3. Substitute the given values into the formula.
  4. Work out each part of the right-hand side.
  5. Combine the parts into a single value.
  6. Solve for the missing value.

Formulas:

\(c^{2} = a^{2} + b^{2} - 2ab\cos(C)\)
\(\cos(C) = \frac{a^{2} + b^{2} - c^{2}}{2ab}\)
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. Substitute the given values into the formula.
  4. Work out each part of the right-hand side.
  5. Combine the parts into a single value.
  6. Solve for the missing value.

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}\)

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 - Substitute the given values into the formula.

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

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

Step 4

Step 4 - Work out each part of the right-hand side.

In this problem: Squaring each side gives \(36\) and \(81\), the coefficient \(2ab\) becomes \(108\), and the cosine becomes \(0.71\).

\(c^{2} = 36 + 81 - 108 \times 0.71\)

Step 5

Step 5 - Combine the parts into a single value.

In this problem: Multiplying \(108\) by \(0.71\) and subtracting it from the sum leaves \(40.63\).

\(c^{2} = 40.63\)

Step 6

Step 6 - Solve for the missing value.

In this problem: Taking the square root of \(40.63\) gives \(6.37\).

\(c = \sqrt{40.63} \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. Substitute the given values into the formula.
  4. Work out each part of the right-hand side.
  5. Combine the parts into a single value.
  6. Solve for the missing value.

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\)

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 - Substitute the given values into the formula.

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

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

Step 4

Step 4 - Work out each part of the right-hand side.

In this problem: Squaring each side gives \(25\), \(36\) and \(49\), and the bottom \(2ab\) becomes \(60\).

\(\cos(C) = \frac{25 + 36 - 49}{60}\)

Step 5

Step 5 - Combine the parts into a single value.

In this problem: Adding and subtracting on the top leaves \(12\), and dividing by \(60\) gives \(0.2\).

\(\cos(C) = \frac{12}{60} = 0.2\)

Step 6

Step 6 - Solve for the missing value.

In this problem: Taking the arccosine of \(0.2\) gives \(78.463^{\circ}\).

\(C = \cos^{-1}\left(0.2\right) \approx 78.463^{\circ}\)

Final Answer

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

Example Problems

Click one to load it into the box and solve it.