# How do you derive the law of cosines?

Nov 14, 2014

Trigonometric Law of Cosines is a generalization of Pythagorean Theorem from right triangles to any other type of triangles.

The Law of Cosines states that in any triangle the length of one side can be expressed in terms of two other sides and an angle between them.

Consider a triangle ΔABC with sides $A B = c$, $A C = b$, $B C = a$ and angle ∠BAC=γ.
Then the following equality, called the Law of Cosines, is true:
a²+b²−2·a·b·cos(γ) = c²

For right triangles with $A B$ as a hypotenuse the angle ∠BAC=γ is the right angle, so γ=π/2. Then cos(γ)=cos(π/2)=0 and the Law of Cosines is exactly the same as Pythagorean Theorem.

Proof

Drop an altitude from vertex $A$ onto opposite side $B C$. Let's assume that the base of this altitude - point $H$ - lies in between vertices $B$ and $C$. Other cases are similar.

Triangle ΔAHB is a right triangle with catheti $A H$ and $B H$ and hypotenuse $A B = c$. Using the Pythagorean Theorem we can express the hypotenuse in terms of the catheti:
AH²+BH²=AB²=c²

Triangle ΔAHC is also a right triangle with catheti $A H$ and $C H$ and hypotenuse $A C = b$. Let's express catheti in this triangle in terms of a hypotenuse and an angle ∠ACH=γ:
AH=b·sin(γ)
CH=b·cos(γ)

The final preparation is to replace the length of $A H$ with b·sin(γ), the length of $B H$ with a difference between $B C = a$ and CH=b·cos(γ) in the Pythagorean equation for triangle ΔAHB:
(b·sin(γ))²+(a−b·cos(γ))²=c².

Simplifying:
b²·sin²(γ) + a² − 2·a·b·cos(γ) + b²·cos²(γ) = c²
or
b²·[sin²(γ)+cos²(γ)] + a² − 2·a·b·cos(γ) = c²
or, since sin²(γ)+cos²(γ) = 1,
b² + a² − 2·a·b·cos(γ) = c²
which is exactly what the Law of Cosines is.

In this proof we relied on the fact that a base of an altitude $H$ lies in between vertices $B$ and $C$. Other cases and more detailed video presentation of this theorem can be found on Unizor by following the menu Trigonometry - Simple Trigonometric Identities - Law of Cosine.