Bob purchases a house and takes a loan of $\$ A$ from a bank. The sum of money owed to the bank $t$ months after taking the loan is denoted by \$x. Both $x$ and $t$ are taken to be continuous variables. The sum of money owed to the bank increases, due to interest, at a rate proportional to the sum owed and decreases at a constant rate $r$ as Bob repays the bank.

When $x=a$, interest and repayment balance. Write down a differential equation relating $x$ and $t$, and solve it to give $x$ in terms of $t, r, a$ and $A$.

[8]

State the condition under which the sum of money owed to the bank is repaid in a finite time $T$ months, justifying your answer. Show that $T=\frac{a}{r} \ln \left(\frac{a}{a-A}\right)$.

[4]

$x=B \mathrm{e}^{\frac{r t}{a}}+a$

$x=(A-a) \mathrm{e}^{\frac{r t}{a}}+a$