The law of cosines is easily derived (one of several ways) by
finding the scalar length of the difference vector
.
or (collecting terms and using rules from above):
Note that the Pythagorean Theorem is a special case of this rule with
.