
Time to row:
$t_1= \dfrac{s}{r}$
Time to walk:
$t_2 = \dfrac{b - x}{w}$
Total time:
$t = t_1 + t_2$
$t = \dfrac{s}{r} + \dfrac{b - x}{w}$
From the figure:
$x = a \tan \theta$
$s = a \sec \theta$
$t = \dfrac{a \sec \theta}{r} + \dfrac{b - a \tan \theta}{w}$
$\dfrac{dt}{d\theta} = \dfrac{a \sec \theta \, \tan \theta}{r} - \dfrac{a \sec^2 \theta}{w} = 0$
$\dfrac{a \sec \theta \, \tan \theta}{r} - \dfrac{a \sec^2 \theta}{w} = 0$
$\dfrac{\tan \theta}{r} - \dfrac{\sec \theta}{w} = 0$
$\dfrac{\sin \theta}{r \, \cos \theta} - \dfrac{1}{w \, \cos \theta} = 0$
$\dfrac{\sin \theta}{r \, \cos \theta} = \dfrac{1}{w \, \cos \theta}$
$\sin \theta = \dfrac{r}{w}$ answer