Trigonometry: from Right Triangles to the Unit Circle

the law of cosines

The Pythagorean theorem a^2 + b^2 = c^2 works only for right triangles. The law of cosines is its grown-up version: it holds for every triangle and tells you exactly how much to correct the formula when the angle between two sides is not a right angle.

With sides a, b, c opposite angles A, B, C, the law of cosines reads c^2 = a^2 + b^2 - 2ab x cos C, with matching versions for the other two sides. Read the structure: it is Pythagoras plus a correction term -2ab x cos C that depends on the included angle. When C = 90 degrees, cos C = 0, the correction vanishes, and you recover a^2 + b^2 = c^2 exactly; when C is acute, cos C is positive and the third side is shorter than Pythagoras would give; when C is obtuse, cos C is negative and the side is longer. It is the right tool for the two situations the law of sines cannot start from: three sides given (SSS), and two sides with the angle between them (SAS).

Rearranged as cos C = (a^2 + b^2 - c^2) / (2ab), it also recovers an angle from three known sides, which is how you check whether a triangle is acute, right, or obtuse without drawing it. Together with the law of sines it solves any triangle whatsoever. A common slip is signs: the formula subtracts 2ab cos C, so an obtuse angle (negative cosine) makes that whole term add — keep the minus sign in the formula and let the cosine carry its own sign.

A triangle has sides a = 7 and b = 9 with the included angle C = 60 degrees. Then c^2 = 7^2 + 9^2 - 2 x 7 x 9 x cos 60 degrees = 49 + 81 - 126 x 0.5 = 130 - 63 = 67, so c = sqrt(67) ≈ 8.19.

Pythagoras plus the correction -2ab cos C handles the SAS case the sine rule cannot start.

It really is just the Pythagorean theorem with an extra term; do not be tempted to drop the minus sign, and remember that an obtuse included angle has a negative cosine, which lengthens the opposite side.

Also called
cosine rulegeneralized Pythagorean theorem餘弦律餘弦定律