Let \(V_d\), \(V_u\) and \(V_s\) be the the velocity of the motorboat downstream, upstream and in still water respectively.
Let \(t, ~ t_d, ~and ~t_u\) be the total time travel, time moving downstream and time moving upstream respectively. Thus \(4 = t_u + t_d\)
\(V = \frac{distance}{time}\)>
\(V_d = V_s + 3\)
\(\frac{30}{4-t_u} = V_s + 3\)
\(V_u = V_s - 3\)
\(\frac{18}{t_u} = V_s - 3\)
\(\frac{30}{4-t_u} - \frac{18}{t_u}= V_s +3 -(V_s - 3)\)
\(\frac{30}{4-t_u} - \frac{18}{t_u}= 6\)
\(30t_u - 18 (4-t_u) = 6 (t_u)(4 - t_u)\)
\(30t_u - 72 +18t_u) = 24t_u -6t_{u}^{2})\)
\(6t_{u}^2 + 24 t_u -72 = 0 \)
\(t_u = 2\)
\(V_s = \frac{18}{2} +3 \)