Law of Cosines or the Generalized Pythagorean Theorem. Formula and Proof

Law of Cosines or the Generalized Pythagorean Theorem in a Scalene Triangle. Formula and Proof

The Law of Cosines. Formula and its proof



The Law of Cosines, or the generalized Pythagorean theorem

The Law of Cosines, or the generalized Pythagorean theorem states that in any triangle △ABC we have these three relationships between the lengths of the sides a, b and c and the cosine of the angles ∠A, ∠B and ∠C:


  • a2 = b2 + c2 - 2 × b × c × cos(∠A)
  • b2 = a2 + c2 - 2 × a × c × cos(∠B)
  • c2 = a2 + b2 - 2 × a × b × cos(∠C)
  • Where:
  • a = the side of the triangle opposite angle ∠A
  • b = the side of the triangle opposite angle ∠B
  • c = the side of the triangle opposite angle ∠C

It is also called the generalized Pythagorean theorem because it works for all triangles. When the angle ∠A, ∠B, or ∠C is a right angle, cos(90°) = 0, making the extra part disappear and leaving the classic Pythagorean theorem:


  • a2 = b2 + c2
  • b2 = a2 + c2
  • c2 = a2 + b2


  • Proof of the Law of Cosines

  • In any triangle △ABC, which is not right-angled, with side lengths BC = a, AC = b and AB = c, draw from the vertex A the perpendicular to the side BC, which intersects BC in point D. The lengths of the sides: AD = ha, BD = a1 and CD = a2, where a1 + a2 = a.
  • Proof of the Law of Cosines

    Proof of the Law of Cosines


In the right triangle △ABD we have the following trigonometric relations:


  • sin(∠B) = ha/c => ha = c × sin(∠B)
  • cos(∠B) = a1/c => a1 = c × cos(∠B)

In the right triangle △ADC apply the Pythagorean Theorem:


  • b2 = ha2 + a22
  • b2 = ha2 + (a - a1)2

Substitute for ha and a1 in the formula above:


  • b2 = c2 × sin2(∠B) + (a - c × cos(∠B))2
  • b2 = c2 × sin2(∠B) + a2 - 2 × a × c × cos(∠B) + c2 × cos2(∠B)
  • b2 = c2 × (sin2(∠B) + cos2(∠B)) + a2 - 2 × a × c × cos(∠B)
  • b2 = c2 × (ha2/c2 + a12/c2) + a2 - 2 × a × c × cos(∠B)
  • b2 = c2 × (ha2 + a12)/c2 + a2 - 2 × a × c × cos(∠B)

In the right triangle △ABD apply Pythagora's Theorem:


  • ha2 + a12 = c2
  • (ha2 + a12)/c2 = 1

Substitute for (ha2 + a12)/c2 in the last formula of b2:


b2 = c2 + a2 - 2 × a × c × cos(∠B)


By drawing the perpendiculars hb and hc to the other two sides of the triangle we could also proof, in the same way, the other two relationships of the Law of Cosines.


  • When to use this law

  • The Law of Cosines could be used to:
  • 1. Find the unknown length of a side in a triangle if we know the other two sides' lengths and the measure of the opposite angle (Side - Angle - Side, SAS).
  • 2. Find the unknown measure of an angle in a triangle when we know all its three side lengths (Side - Side - Side, SSS).
  • In order to do that, rewrite the Law of Cosines to highlight the cosine of the angle, then apply the function arccos for both sides of the equality.
  • Since cos and arccos are inverse functions, arccos(cos(∡B)) = ∡B:

  • cos(∠B) = (a2 + c2 - b2) / (2 × a × c)
  • arccos(cos(∠B)) = arccos((a2 + c2 - b2) / (2 × a × c))
  • m(∡B) = arccos((a2 + c2 - b2) / (2 × a × c))

The same process could be used to demonstrate the formulas for the measures of the other two angles, ∠A and ∠C.


  • Calculations examples

  • The example 1: Calculating a side length when the opposite angle and the other two sides are known (SAS)
  • In a triangle where two sides' lengths are given, a = 5, c = 7, and the measure of the angle between them is ∡B = 54°, calculate the length of side b:
  • Feed the given data into one of the three equations of the Law of Cosines.
  • Use a calculator to calculate the function cos(54°).
  • b2 = 52 + 72 - 2 × 5 × 7 × cos(54°) = 74 - 70 × 0.5877852522925 = 74 - 41.144967660475 = 32.855032339525
  • The square root of b2 = 32.855032339525 => b = 5.7319309433667 ≈ 5.73
  • The example 2: Calculating the measure of an angle when all three side lengths are given (SSS)
  • In a triangle where the sides' lengths are a = 5, b = 5.73 and c = 7, calculate the measure of the angle ∠B:
  • Feed the given data into one of the three equations of the Law of Cosines, rearranged for angles.
  • Let's remember: a2 - b2 = (a + b) × (a - b).
  • Use a calculator to calculate the function arccos().
  • m(∡B) = arccos((52 + 72 - 5.732) / (2 × 5 × 7)) = arccos((25 + (7 + 5.73) × (7 - 5.73) / 70) = arccos((25 + 12.73 × 1.27) / 70) = arccos(41 / 70) = arccos(0.5881014285714) = 53.977604748002° ≈ 53.98°.
 

All available calculators, by category: