TOPICS
Search

Law of Cosines


LawofCosines

Let a, b, and c be the lengths of the legs of a triangle opposite angles A, B, and C. Then the law of cosines states

a^2=b^2+c^2-2bccosA
(1)
b^2=a^2+c^2-2accosB
(2)
c^2=a^2+b^2-2abcosC.
(3)

Solving for the cosines yields the equivalent formulas

cosA=(-a^2+b^2+c^2)/(2bc)
(4)
cosB=(a^2-b^2+c^2)/(2ac)
(5)
cosC=(a^2+b^2-c^2)/(2ab).
(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 X to Y is given by

|X-Y|^2=(X-Y)·(X-Y)
(7)
=X·X-2X·Y+Y·Y
(8)
=|X|^2+|Y|^2-2|X||Y|costheta,
(9)

where theta is the angle between X and Y.

LawOfCosinesTriangles

The formula can also be derived using a little geometry and simple algebra. From the above diagram,

c^2=(asinC)^2+(b-acosC)^2
(10)
=a^2sin^2C+b^2-2abcosC+a^2cos^2C
(11)
=a^2+b^2-2abcosC.
(12)

The law of cosines for the sides of a spherical triangle states that

cosa=cosbcosc+sinbsinccosA
(13)
cosb=cosccosa+sincsinacosB
(14)
cosc=cosacosb+sinasinbcosC
(15)

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

cosA=-cosBcosC+sinBsinCcosa
(16)
cosB=-cosCcosA+sinCsinAcosb
(17)
cosC=-cosAcosB+sinAsinBcosc
(18)

(Beyer 1987).

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

 aa^'=bb^'+cc^'-(bc^'+b^'c)cosA
(19)

(Lee 1997). Furthermore, consider an arbitrary tetrahedron A_1A_2A_3A_4 with triangles T_1=DeltaA_2A_3A_4, T_2=DeltaA_1A_3A_4, T_3=DeltaA_1A_2A_4, and T_4=A_1A_2A_3. Let the areas of these triangles be s_1, s_2, s_3, and s_4, respectively, and denote the dihedral angle with respect to T_i and T_j for i!=j=1,2,3,4 by theta_(ij). Then

 s_k=sum_(j!=k; 1<=i<=4)s_icostheta_(ki),
(20)

which gives the law of cosines in a tetrahedron,

 s_k^2=sum_(i!=k; 1<=j<=4)s_j^2-2sum_(i,j!=k; 1<=i,j<=4)s_is_jcostheta_(ij)
(21)

(Lee 1997). A corollary gives the nice identity

 s_1s_1^'=s_2s_2^'+s_3s_3^'+s_4s_4^'-(s_2s_3^'+s_2^'s_3)costheta_(23) 
 -(s_3s_4^'+s_3^'s_4)costheta_(34)-(s_2s_4^'+s_2^'s_4)costheta_(24).
(22)

See also

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

Explore with Wolfram|Alpha

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.

Referenced on Wolfram|Alpha

Law of Cosines

Cite this as:

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

Subject classifications