 TOPICS # Law of Cosines Let , , and be the lengths of the legs of a triangle opposite angles , , and . Then the law of cosines states   (1)   (2)   (3)

Solving for the cosines yields the equivalent formulas   (4)   (5)   (6)

This law can be derived in a number of ways. The definition of the dot product incorporates the law of cosines, so that the length of the vector from to is given by   (7)   (8)   (9)

where is the angle between and . The formula can also be derived using a little geometry and simple algebra. From the above diagram,   (10)   (11)   (12)

The law of cosines for the sides of a spherical triangle states that   (13)   (14)   (15)

(Beyer 1987). The law of cosines for the angles of a spherical triangle states that   (16)   (17)   (18)

(Beyer 1987).

For similar triangles, a generalized law of cosines is given by (19)

(Lee 1997). Furthermore, consider an arbitrary tetrahedron with triangles , , , and . Let the areas of these triangles be , , , and , respectively, and denote the dihedral angle with respect to and for by . Then (20)

which gives the law of cosines in a tetrahedron, (21)

(Lee 1997). A corollary gives the nice identity (22)

Law of Sines, Law of Tangents Explore this topic in the MathWorld classroom

## Explore with Wolfram|Alpha More things to try:

## References

Abramowitz, M. and Stegun, I. A. (Eds.). Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing. New York: Dover, p. 79, 1972.Beyer, W. H. CRC Standard Mathematical Tables, 28th ed. Boca Raton, FL: CRC Press, pp. 148-149, 1987.Lee, J. R. "The Law of Cosines in a Tetrahedron." J. Korea Soc. Math. Ed. Ser. B: Pure Appl. Math. 4, 1-6, 1997.

Law of Cosines

## Cite this as:

Weisstein, Eric W. "Law of Cosines." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/LawofCosines.html