distance = speed × time

$(rt)^2 = 40^2 + 40^2(t - 1)^2$

$r^2t^2 = 1600 + 1600t^2 - 3200t + 1600$

$r^2 = \dfrac{1600(t^2 - 2t + 2}{t^2}$

$r = \dfrac{40}{t}\sqrt{t^2 - 2t + 2}$

$\dfrac{dr}{dt} = \dfrac{40}{t}\dfrac{2t - 2}{2\sqrt{t^2 - 2t + 2}} + \dfrac{-40}{t^2}\sqrt{t^2 - 2t + 2} = 0$

$\dfrac{t - 1}{\sqrt{t^2 - 2t + 2}} = \dfrac{1}{t}\sqrt{t^2 - 2t + 2}$

$t^2 - t = t^2 - 2t + 2$

$t = 2 \text{ hours}$

$r = \dfrac{40}{2}\sqrt{2^2 - 2(2) + 2}$

$r = 20 \sqrt{2} \text{ miles/hour}$

$r = 28.28 \text{ miles/hour}$ *answer*