# What is the Law of Cosines Formula? ••• Farknot_Architect/iStock/GettyImages

Mastering the concepts of sine and cosine is an integral part of trigonometry. But once you have these ideas under your belt, they become the building blocks for other useful tools in trigonometry and, later, calculus. For example, the "law of cosines" is a special formula that you can use to find the missing side of a triangle if you know the length of the other two sides plus the angle between them, or to find the angles of a triangle when you know all three sides.

### The Law of Cosines

The law of cosines comes in several versions, depending on which angles or sides of the triangle you're dealing with:

a^2 = b^2 + c^2 – 2bc × \cos(A) \\ b^2 = a^2 + c^2 – 2ac × \cos(B) \\ c^2 = a^2 + b^2 – 2ab × \cos(C)

In each case, ​a​, ​b​ and ​c​ are the sides of a triangle, and ​A​, ​B​, or ​C​ is the angle opposite the side of the same letter. So ​A​ is the angle opposite side ​a, B​ is the angle opposite side ​b​, and ​C​ is the angle opposite side ​c​. This is the form of the equation that you use if you're finding the length of one of the triangle's sides.

The law of cosines can also be rewritten in versions that make it easier to find any of the triangle's three angles, assuming you know the lengths of all three of the triangle's sides:

cos(A) = \frac{b^2 + c^2 – a^2}{2bc} \\ \,\\ cos(B) = \frac{c^2 + a^2 - b^2}{2ac} \\ \,\\ cos(C) = \frac{a^2 + b^2 - c^2}{2ab}

### Solving for a Side

In order to use the law of cosines to solve for the side of a triangle, you need three pieces of information: the lengths of the triangle's other two sides, plus the angle between them. Choose the version of the formula where the side you want to find is on the left of the equation, and the information you already have is on the right. So if you want to find the length of side ​a​, you'd use the version

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

Substitute the values of the two known sides, and the angle between them, into the formula. If your triangle has known sides ​b​ and ​c​ that measure 5 units and 6 units respectively, and the angle between them measures 60 degrees (which might also be expressed in radians as π/3), you'd have:

a^2 = 5^2 + 6^2 - (2 × 5 × 6) × \cos(60)

Use a table or your calculator to look up the value of the cosine; in this case, cos(60) = 0.5, giving you the equation:

a^2 = 5^2 + 6^2 – (2 × 5 × 6) × 0.5

Simplify the result of Step 2. This gives you:

a^2 = 25 + 36 - 30

Which in turn simplifies to:

a^2 = 31

Take the square root of both sides to finish solving for ​a​. This leaves you with:

a = \sqrt{31}

While you could use a chart or your calculator to estimate the value of √31 (it's 5.568), you'll often be allowed – and even encouraged – to leave the answer in its more precise radical form.

### Solving for an Angle

You can apply the same process to find any of the triangle's angles if you know all three of its sides. This time, you'll choose the version of the formula that puts the missing or "don't know it" angle on the left side of the equals sign. Imagine that you want to find the measure of angle C (which, remember, is defined as the angle opposite side ​c​). You'd use this version of the formula:

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

Substitute the known values – in this type of problem, that means the lengths of all three of the triangle's side – into the equation. As an example, let the sides of your triangle be ​a​ = 3 units, ​b​ = 4 units and ​c​ = 25 units. So your equation becomes:

\cos(C) = \frac{3^2 + 4^2 - 5^2}{2 × 3 × 4}

Once you simplify the resulting equation, you'll have:

\cos(C) = \frac{0}{24}

or simply cos(​C​) = 0.

Calculate the inverse cosine or arc cosine of 0, often notated as cos-1(0). Or, in other words, which angle has a cosine of 0? There are actually two angles that return this value: 90 degrees and 270 degrees. But by definition you know that every angle in a triangle must be less than 180 degrees, so that leaves only 90 degrees as an option.

So the measure of your missing angle is 90 degrees, which means you happen to be dealing with a right triangle, although this method works with non-right triangles as well.

Dont Go!

We Have More Great Sciencing Articles!