using the cosine rule to find angles