applying the law of cosines solve the following problems