Answer
The bearing of ship B relative to ship A is $~~1.5^{\circ}~~$ west of south.
Work Step by Step
We can find the components of ship A's velocity relative to the port:
$v_{Ax} = (24~knots)~cos~45^{\circ} = 17.0~knots$ (west)
$v_{Ay} = (24~knots)~sin~45^{\circ} = 17.0~knots$ (north)
We can find the components of ship B's velocity relative to the port:
$v_{Bx} = (28~knots)~sin~40^{\circ} = 18.0~knots$ (west)
$v_{By} = (28~knots)~cos~40^{\circ} = 21.4~knots$ (south)
We can find the components of the velocity of ship B relative to ship A:
$v_x = 18.0~knots - 17.0~knots = 1.0~knot~ (west)$
$v_y = 17.0~knots+21.4~knots = 38.4~knots~(south)$
We can find the direction of ship B relative to ship A as an angle $\theta$ that is west of south:
$tan~\theta = \frac{1.0}{38.4}$
$\theta = tan^{-1}~\frac{1.0}{38.4}$
$\theta = 1.5^{\circ}$
At any time $t$, the bearing of ship B relative to ship A is $~~1.5^{\circ}~~$ west of south.