What is the law of cosines?
Cosider the triangle:
(Picture source: Wikipedia)
you can relate the sides of this triangle in a kind of "extended" form of Pitagora's Theorem giving:
As you can see you use this law when your triangle is not a right-angled one.
Consider the above triangle in which: