**Law of cosines**

If all sides of a triangle are known, but no angles or two sides and the angle between them, the law of sines cannot solve the other parts of the triangle.

In the triangle above, the height h can be said in two ways using the Pythagorean theorem.

From this we will get

Also from the triangle we get

We substitute x in equation before, and get

This is the law of cosines.

**Example 1**

Find x

We use the law of cosines

Because x is length, only positive result is valid.

**Example 2**

The lengths of the two sides of the triangle are 2,0 and 3,0, and the angle opposite the shorter side is 30 Â°. Calculate the length of the third side.

We use the law of cosines

There were two solutions and both are valid. The given data form two possible triangles.

**Example 3**

The plane left the airport to the northeast and after 2,8 kilometres it turned straight east, continuing for four kilometres. How far was the plane from the airport at the time?

The flight path and the distance from the airport form the triangle below. We solve the distance using the law of cosines.

**Turn on the subtitles if needed**