The following is the problem that I am working on.
A bank offers an annual interest of 5% per year with continuous interest for 20 yrs. Every year, a person withdraws 12,000 from the account. If the balance equals exactly 0 at the end of the 20th year, what is the principal of the account?
To set up the differential equation is the part that I am not confident.
Intuitively speaking, I know the continuous interest formula would be
$$A=Pe^{.05t}$$
and every year the person uses $12,000 from the account so the total usage is
$$C=-12,000t$$
after t years.
So I am thinking that the differential equation should have a solution that looks something like
$$B=Pe^{.05t}-12,000t$$
and to set this equation as a differential equation, I let
$$\frac{dB}{dt}=\frac{dA}{dt}+\frac{dC}{dt}$$
$$B'=A'-C'$$
$$B'=(1.05)A-12,000$$
But I am not confident if my setup is correct. Can someone lend a hand?
Suppose the initial principal is $A$, and $12,000$ is withdrawn at the end of each year.
At the end of the first year (immediately after the withdrawal), $A(1.05)^1-12,000$ remains.
This grows for another year, and then the second withdrawal is made. At the end of the second year, $A(1.05)^2-12,000(1.05) - 12,000$ remains.
Continuing, one sees that at the end of twenty years, since the balance is zero, we have $$0 = A(1.05)^{20} - 12,000\left(1 + (1.05)^1+(1.05)^2+\cdots + (1.05)^{19}\right)$$
The geometric sum can be simplified as $\frac{1-1.05^{20}}{1-1.05} = \frac{1.05^{20} - 1}{0.05}$, so that $$A = 12,000\left(\dfrac{1.05^{20}-1}{0.05}\right)(1.05^{20}) = \boxed{12,000\left(\dfrac{1 - 1.05^{-20}}{0.05}\right) \approx 149,546.52}$$
More generally, if an amount $K$ is withdrawn at the end of each of $N$ years, and the annual interest rate is $r$, the initial principal must be
$$K\left(\dfrac{1 - (1+r)^{-N}}{r}\right)$$
Note: I'm assuming you mean for the effective annual rate to be $5$%? If not, you can convert the continuous compounding rate to an effective annual rate using $1+r = e^{0.05}$ and correct the answer accordingly. I am using effective rate in the general formula.