The law of cosines states that if ,
,
and
are the lengths of the sides of a triangle opposite angles
,
, and
, then
|
(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 corresponding relation for a triangle in the hyperbolic plane is the hyperbolic law of cosines.
For curvature , the Euclidean law above is recovered as
, when the curvature approaches zero from below.
Equivalently, the Euclidean formula approximates the hyperbolic formula when the
side lengths are small compared with
(Anderson 1999). Thus the hyperbolic formula is the counterpart
of the Euclidean law in hyperbolic geometry.
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 two similar triangles with corresponding side lengths ,
,
and
,
,
, respectively, a generalized law of cosines is
|
(19)
|
(Lee 1997), where
is the angle opposite the sides
and
. Now consider an arbitrary tetrahedron
with triangle
faces
,
,
, and
. Let their areas be
,
,
, and
, respectively, and let
be the dihedral angle
between
and
for
,
with
.
Then
|
(20)
|
and the associated law of cosines in a tetrahedron is
|
(21)
|
(Lee 1997). For two similar tetrahedra with corresponding face areas and
and common dihedral angles
, the corresponding polarized identity is
|
(22)
|