# Law of cosines

In trigonometry, the **law of cosines** (also known as the cosine formula) is a statement about arbitrary triangles which generalizes the Pythagorean theorem by correcting it with a term proportional to the cosine of the opposing angle. Let *a*, *b*, and *c* be the lengths of the sides of the triangle and let *A*, *B*, and *C* the respective angles opposite those sides. Then,

This formula is useful for computing the third side of a triangle when two sides and their enclosed angle are known, and in computing the angles of a triangle if all three sides are known.

The law of cosines also shows that

The statement cos *C* = 0 implies that *C* is a right angle, since *a* and *b* are positive. In other words, this is the Pythagorean theorem and its converse. Although the law of cosines is a broader statement of the Pythagorean theorem, it isn't a proof of the Pythagorean theorem, because the law of cosines derivation given below depends on the Pythagorean theorem.

## Contents

## Proof

Using vectors and vector dot products, we can easily prove the law of cosines. If we have a triangle with vertices *A*, *B*, and *C* whose sides are the vectors **a**, **b**, and **c**, we know that:

and

Using the dot product, we simplify the above into

## Alternative proof (for acute angles)

Let *a*, *b*, and *c* be the sides of the triangle and *A*, *B*, and *C* the angles opposite those sides. Draw a line from angle *B* that makes a right angle with the opposite side *b*. If the length of that line is *x*, then sin *C* = *x*/*a*, which implies *x* = *a* sin *C*.

That is, the length of this line is *a* sin *C*. Similarly, the length of the part of *b* that connects the foot point of the new line and angle *C* is *a* cos *C*. The remaining length of *b* is *b* − *a* cos *C*. This makes two right triangles, one with legs *a* sin *C* and *b* − *a* cos *C* and hypotenuse *c*. Therefore, according to the Pythagorean theorem:

because

## Finding the angles when the sides are known

By transposing the identity

we can find the angle *C* when the three sides *a*, *b*, and *c* are known:

## Isosceles case

When , i.e., when the triangle is isosceles with the two sides incident to the angle *C* equal, the law of cosines simplies significantly. Namely, because , the law of cosines becomes

## See also

## External link

da:Cosinusrelation de:Kosinussatz es:Teorema del coseno fr:Théorème d'Al-Kashi ko:코사인 법칙 it:Legge del coseno he:משפט הקוסינוסים nl:Cosinusregel ja:余弦定理 pl:Twierdzenie cosinusów ru:Теорема косинусов sl:Kosinusni izrek uk:Теорема косинусів zh:余弦定理 Template:Link FA