# Compound interest calculator solving for time with deposits [closed]

I am attempting to solve a compound interest calculation for time given

Principal = 100
Time(years) = t
Rate(per year) = 8%
Deposit(per month) = 5
Total = 300


I can find solving for time without regular deposits. Can anyone help me out with a source or a workup of how to do this calculation with a regular monthly deposit?

http://www.mathportal.org/calculators/financial-calculators/compound-interest-calculator.php?formId=0&val1=4500&val2=7&val3=9&combo1=1&combo2=2

I'm attempting to use this calculator but it does not allow for deposits. That is essentially what i need but with deposits.

Look this is just a geometric sum:

Assume interest is paid monthly at rate $r = 0.08/12$ (you can use the exact monthly equivalent if you want) and let $x_n =$total after $n$ months (including that month's interest and deposit).

So $x_0= 100$ and $x_{n+1} = x_n(1+r) + d$, where $d = 5$ is your deposit amount (added at the end of the month).

Applying the recursion repeatedly you see $$x_n = x_0(1+r)^n + d(1+r)^{n-1} + \ldots + d = x_0(1+r)^n + d\sum_{j=0}^{n-1}(1+r)^j.$$ After applying the geometric sum formula you get $$x_n = x_0(1+r)^n + \frac{d}{r}((1+r)^n-1).$$

Thus (assuming my metaphorical back-of-envelope calculation is right): $$(1+r)^n = \frac{x_n + \gamma}{x_0 + \gamma},$$ where $\gamma = d/r$. Take log of both sides to get $$n = \log\left(\frac{x_n + \gamma}{x_0 + \gamma}\right)/\log(1+r).$$ I.e. to get the number of months to reach 300 you would take $x_n =300$ here and round $n$ upto the next integer.

It is 32 months for your example.

You could easily modify this so that your deposits increase over time, interest is paid yearly, etc.