Answer
See below.
Work Step by Step
The distance from A to D is $20-x$. Thus the time he needs to cover that distance is the distance divided by the speed, hence $r(x)=\frac{20-x}{6.4}$.
The distance from D to B is $\sqrt{12^2+x^2}=\sqrt{144+x^2}$ by the Pythagorean Theorem. Thus the time he needs to cover that distance is the distance divided by the speed, hence $r(x)=\frac{\sqrt{144+x^2}}{0.9}$.