Precalculus

Trigonometry

Trigonometry Logo

Law of Cosines

The Law of Cosines (also known as the Cosine Rule) allows to find the length of the third side of a triangle knowing two other sides and the angle between them.

Theorem (Law of Cosines)

Consider a triangle with the sides a, b, c and angles α, β, γ.

An arbitrary triangle in the Cosine Rule
Figure 1.

The Law of Cosines states that

\[c^2 = a^2 + b^2 - 2ab\cos\gamma\]

where \(\gamma\) denotes the angle between the sides \(a\) and \(b.\)

The sides \(a\) and \(b\) can also be expressed in terms of two other sides and angle between them:

\[a^2 = b^2 + c^2 - 2bc\cos\alpha\]
\[b^2 = a^2 + c^2 - 2ac\cos\beta\]

When the angle \(\gamma\) between the sides \(a\) and \(b\) is a right angle, the Law of Cosines reduces to the Pythagorean Identity:

\[{c^2} = {a^2} + {b^2}.\]

So the law of cosines is a generalization of the Pythagorean Theorem for an arbitrary triangle.

Proof

We consider separately the cases of acute and obtuse triangles.

In the first case, assume that the angle \(\gamma\) is an acute angle.

Proving the Law of Cosines for an acute triangle
Figure 2.

Draw the altitude \(BD\) from the vertex \(B\) to the side \(AC = b.\) Its height \(h\) can be found from the trigonometric identity for the right triangle \(BDC:\)

\[h = BD = a\sin \gamma .\]

The line segment \(CD\) (the projection of side \(a\) onto the side \(b\)) has the length

\[CD = a\cos \gamma .\]

In the right traingle \(ADB,\) the side \(AD\) is given by

\[AD = b - CD = b - a\cos \gamma .\]

Using the Pythagorean Identity for \(\triangle ADB\), we get:

\[A{B^2} = A{D^2} + B{D^2}, \;\Rightarrow {c^2} = {\left( {b - a\cos \gamma } \right)^2} + {h^2}, \;\Rightarrow {c^2} = {\left( {b - a\cos \gamma } \right)^2} + {\left( {a\sin \gamma } \right)^2}, \;\Rightarrow {c^2} = {b^2} - 2ab\cos \gamma + {a^2}{\cos ^2}\gamma + {a^2}{\sin ^2}\gamma .\]

Notice that

\[{a^2}{\cos ^2}\gamma + {a^2}{\sin ^2}\gamma = {a^2}\left( {\underbrace {{{\cos }^2}\gamma + {{\sin }^2}\gamma }_1} \right) = {a^2}.\]

Therefore

\[{c^2} = {a^2} + {b^2} - 2ab\cos \gamma .\]

Let now the angle \(\gamma\) be obtuse.

Proving the Law of Cosines for an obtuse triangle
Figure 3.

In this case, the altitude \(BD = h\) is given by

\[h = BD = a\sin \left( {180^\circ - \gamma } \right).\]

By the reduction identity, \(\sin \left( {180^\circ - \gamma } \right) = \sin \gamma .\) Hence, the height \(h\) is expressed by the same formula:

\[h = BD = a\sin \left( {180^\circ - \gamma } \right) = a\sin \gamma .\]

Again, by the reduction identity, the length of the line segment \(CD\) is given by

\[CD = a\cos \left( {180^\circ - \gamma } \right) = - a\cos \gamma .\]

From the right triangle \(ADB,\) we have

\[A{B^2} = A{D^2} + B{D^2}, \;\Rightarrow {c^2} = {\left[ {b + \left( { - a\cos \gamma } \right)} \right]^2} + {h^2}, \;\Rightarrow {c^2} = {\left( {b - a\cos \gamma } \right)^2} + {\left( {a\sin \gamma } \right)^2}, \;\Rightarrow {c^2} = {b^2} - 2ab\cos \gamma + {a^2}{\cos ^2}\gamma + {a^2}{\sin ^2}\gamma , \;\Rightarrow {c^2} = {a^2} + {b^2} - 2ab\cos \gamma .\]

Similarly, the Law of Cosines can be proved for two other sides of the triangle.

See solved problems on Page 2.

Page 1 Page 2