describe the type of problems that require the law of cosines