Explanation:
the law of cosine in a triangle :
c² = a² + b² - 2ab×cos(C)
c is the side opposite of the angle C.
a and b are the other 2 sides.
our triangle here is the 21 miles east, then (after turning back west and 22° to the south) 9 miles mostly west-south-west, abd then the actual distance to the lighthouse.
an angle south of west means pointing west and then turning the many degrees to the south.
in other words, this is the internal angle of the triangle at the turning point at the end of the initial 21 miles trip to the east.
so, we have
distance² = 21² + 9² - 2×21×9×cos(22) =
= 441 + 81 - 378×cos(22) =
= 522 - 378×cos(22) =
= 171.524503...
distance = 13.09673635... miles