To solve this problem, let us first assign some reference points. Let us say that initial position of the ship is called point A while the final position is called point B. While the position of the light house is called point L. Together they form a triangle.
The angles are:
angle LAB = 14°
angle ABL = (180 – 31)° = 149°
The lighthouse is at L.
The ship sails 7.2 miles to B.
We see that angle angle ALB = 180 – angle LAB – angle ABL
Therefore
angle ALB = 180 – 14 – 149 = 17°
Now in the triangle ABL, we use the Law of Sines:
AL / sin 149 = 7.2 / sin 17
AL = 12.68 miles
BL / sin 14 = 7.2 / sin 17