Animated Mathematics
deriving the cosine rule formula

The Cosine Rule

The sin, cos, and tan functions can only be used for right angled triangle, here we will derive the cosine which can be used for any triangle.

All triangle can be divided into two right angled triangles by selecting a corner and then drawing a perpendicular line to the opposite side as shown below. This is the starting point for the derivation of the consine rule.

      Related Posts

The Sine Rule

Can be used for all triangles, not just right angled triangles. The sine rule formula is derived by dividing a scalene triangle into two right angled triangles.

Introduction to the Unit Circle

The unit circle which is a circle with radius 1 is the fundamental concept behind trigonometry.

Derivation of the cosine rule.

The cosine rule formulas

The perpendicular line could have been drawn from B or C to derive these equations: $$ cosB=\frac{c^{2}+a^{2}-b^{2}}{2ac} $$ $$ cosC=\frac{b^{2}+c^{2}-a^{2}}{2bc} $$ The equations are same except the variables have been exchanged which is not mathematically important.

Derivation of the cosine rule

The angles are labelled with capital letters and the length of the sides are labelled with lowercase letter.

The perpendicular from C to the line AB, divides the triangle ABC into two right angled triangles.

The length AD=x and DB=c-x. The triangle has a height h.

Applying Pythagorus theorem to triangle ADC we get: $$ b^{2}=x^{2}+h^{2} $$

Applying Pythagorus theorem to triangle CDB we get: $$ a^{2}=(c-x)^{2}+h^{2} $$ expanding and simplifying we get: $$ a^{2}=c^{2}+x^{2}+h^{2}-2cx $$ from the first equation we can substitute to get the expression: $$ a^{2}=b^{2}+c^{2}-2cx $$

We are nearly there all, all we have to do is eliminate x, and this is done using cos(A): $$ cosA= \frac{x}{b} $$ We substitute \(x=bcosA \) to obtain: $$ a^{2}=b^{2}+c^{2}-2bccosA $$ adding \(2bccosA \) to both sides and then subtracting \( a^{2}\) from both sides, we get: $$ 2bccosA=b^{2}+c^{2}-a^{2} $$ Finally dividing both sides by \( 2bc\) we get the cosine rule: $$ cosA=\frac{b^{2}+c^{2}-a^{2}}{2ab} $$

Exercise: Calculate an Angle

Solve the question on paper before seeing the solution.

The Solution

We will use this "version" of the cosine rule:

Substituting in the values:

we are nearly there:


The cosine rule can be used to find the angles of any triangle for which you know the length of all of the sides. The sine rule can be used to find a missing angle so long as you are given the length of two sides. The are questions were only one angle is specified, and two lengths are given, the other length is unknown; in some cases there can be two possible triangles, this is often known as the "ambiguous case of the sine rule", where the cosine rule can also be used to calculate the possible length of the unknown sides.