This article is about the law of cosines in Euclidean geometry. For the cosine law of optics, see Lambert's Cosine Law .
In Trigonometry , the (also known as the '''cosine formula''') is a statement about a general Triangle which relates the lengths of its sides to the Cosine of one of its Angles . Using notation as in Fig. 1, the law of cosines states that
:
Note that ''c'' is the side opposite the angle ''γ'' and ''a'', ''b'' are the two sides enclosing ''γ''.
The law of cosines generalizes the Pythagorean Theorem , which holds only in Right Triangles . For, if the angle ''γ'' is a right angle, its cosine is 0, and so the the law of cosines reduces to
:
which is the Pythagorean Theorem .
The law of cosines is useful for computing the third side of a triangle when two sides and their enclosed angle are known, and in computing the angles of a triangle if all three sides are known.
For the corresponding theorem in Spherical Geometry , see Law Of Cosines (spherical) .
Already Euclid 's Elements , dating to the 3rd Century BC , contain a version of the law of cosines. The case of obtuse triangle and acute triangle (corresponding to the two cases of negative or positive cosine) are treated separately, in Propositions 12 and 13 of Book 2. Trigonometric functions and algebra (in particular negative numbers) being absent in Euclid's time, the statement has a more geometric flavor:
In obtuse-angled triangles the square on the side subtending the obtuse angle is greater than the squares on the sides containing the obtuse angle by twice the rectangle contained by one of the sides about the obtuse angle, namely that on which the perpendicular falls, and the straight line cut off outside by the perpendicular towards the obtuse angle.
Using notation as in Fig. 2, Euclid's statement can be represented by the formula
: AB&2 = CA&2 + CB&2 + 2 CA CH.
This formula may be transformed into the law of cosines by noting that CH = ''a'' cos( π–γ) = – ''a'' cos γ
Proposition 13 contains an entirely analogous statement for acute triangles.
It was not until the development of modern trigonomotry in the .
The theorem was popularised in the Occident by François Viète , who, apparently, discovered it independently. At the beginning of the 19th Century modern algebraic notation allowed the law of cosines to be written in its current form.
The theorem is used in Triangulation , for solving a triangle, i.e., to find (see Figure 3)
- the third side of a triangle if one knows an angle and its adjacent sides:
::
- the angles of a triangle if one knows the three sides:
::
These formulas produce high Round-off Errors in Floating Point calculations if the triangle is very acute, i.e., if ''c'' is small relative to ''a'' and ''b'' or γ is small compared to 1.
Drop the Perpendicular onto the side ''c'' to get (see Fig. 4)
:
(This is still true if α or β is obtuse, and so the perpendicular falls outside the triangle.) Multiply through by ''c'' to get
:
By considering the other perpendiculars obtain
:
:
Adding the latter two equations gives the law of cosines
:
This proof uses Trigonometry in that it treats the cosines of the various angles as quantities in their own right. It uses the fact that the cosine of an angle expresses the relation between the two sides enclosing that angle in ''any'' right triangle. Other proofs (below) are more geometric in that they treat an expression such as mereley as a label for the length of a certain line segment.
Many proofs deal with the case of obtuse and acute angle γ separately.
. Euclid proves this theorem by applying the Pythagorean Theorem to each of the two right triangles in Fig. 4. Using to denote the line segment CH and for the height BH, triangle AHB gives us
:
and triangle CHB gives us
:
The Binomial Theorem then implies
:
This is Euclid's Proposition 12 from Book 2 of the Elements . To transform it into the modern form of the law of cosines, note that
:
. Euclid's proof of his Proposition 13 procedes along the same lines as his proof of Proposition 12: he applies the Pythagorean theorem to both right triangles formed by dropping the perpendicular onto one of the sides enclosing the angle γ and uses the binomial theorem to simplify.
. Using a little more trigonometry, the law of cosines by applying can be deduced by using the Pythatorean theorem only ''once''. In fact, by using the right triangle on the left hand side of Fig. 5 it can be shown that:
upon using the trigonometric identity
:
. This proof needs a slight modification if |