# Law of Cosines - Vector Formulation

Vector Formulation

The law of cosines is equivalent to the formula

in the theory of vectors, which expresses the dot product of two vectors in terms of their respective lengths and the angle they enclose.

Proof of equivalence. Referring to Figure 10, note that

and so we may calculate: begin{align} Vertvec aVert^2 & = Vertvec b - vec cVert^2 \ & = (vec b - vec c)cdot(vec b - vec c) \ & = Vertvec b Vert^2 + Vertvec c Vert^2 - 2 vec bcdotvec c. end{align}

The law of cosines formulated in this notation states: begin{align} Vertvec aVert^2 &= Vertvec b Vert^2 + Vertvec c Vert^2 - 2 Vert vec bVertVertvec cVertcostheta \ Vertvec b - vec c Vert^2 &= Vertvec b Vert^2 + Vertvec c Vert^2 - 2 Vert vec bVertVertvec c Vertcostheta \ 2 Vert vec bVertVertvec c Vertcostheta &= Vertvec b Vert^2 + Vertvec c Vert^2 - Vertvec b - vec c Vert^2 \ Vert vec bVertVertvec c Vertcostheta &= frac{Vertvec b Vert^2 + Vertvec c Vert^2 - (Vertvec b Vert^2 - 2 vec b cdot vec c + Vert vec c Vert^2)}{2} \ Vert vec bVertVertvec c Vertcostheta &= vec b cdot vec c \ end{align}

which is clearly equivalent to the above formula from the theory of vectors.