Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cant seem solve the following problem due to my bad memory of logarithms

if someone opens an account with initial balance of $B$ interest rate of $R$ and does a constant monthly deposit of $D$

how long before the account balance reaches $X$ ?

share|cite|improve this question
Do you have a formula for the amount in the account as a function of time? – Ross Millikan Apr 21 '11 at 22:33
Can you please elaborate: do the deposits begin immediately? Do you have knowledge of the formula for the accumulated/present value of an annuity? Is R the effective rate of interest per month? This seems like a rather difficult problem for those who can't recall log rules ( – Tyler Apr 21 '11 at 23:19

Update 2- Warning: I checked this solution numerically and it seems right to me, if my understanding of the question is correct. However, it differs from Robert Israel's answer.

Update: edited the text several times, solved for $n$ and included figure.

I changed the notation, instead of $D$ I denote each constant deposit by $A$ (from Annuity, the uniform amounts deposited/paid in a period, i.e. a month in the present case). Let $i$ be the effective interest rate per month, and $n$ the number of months.

I am going to consider separately the uniform sequence of deposits $A$ and the initial balance $B$.

enter image description here

Concerning the sequence of $n$ monthly constant deposits $A$, at the interest rate of $i$, its future accumulated amount $F$ after $n$ months, can be computed as follows. The first deposit earns interest during $n-1$ months. The second, $n-2$, and, in general, the $k$ deposit, $n-k$ months. The deposit in the $k$ month values after $n$ months


Adding all future values $F_k$, for $k=1,2,\dots,n$, and using the sum formula of a geometric progression with $n$ terms, ratio $c$ and first term $u_1$,


where, in the present case, $u_1=A$ and $c=1+i$, yields

$$F=\displaystyle\sum _{k=1}^{n}F_k=\displaystyle\sum _{k=1}^{n}A(1+i)^{n-k}=\displaystyle\sum _{m=1}^{n}A(1+i)^{m-1}=A\dfrac{(1+i)^n-1}{i}.$$

There are three implicit conditions when applying this formula:

  1. the deposits $A$ are uniform and equally spaced in time,
  2. they are made always at the end of each month, and
  3. the interest rate $i$ remains unchanged.

The total amount $X$ at the end of $n$ months is the sum of the future value of the initial balance $B$, which is $B\times (1+i)^n$, with the future value $F$ of all monthly deposits calculated above. And we know that this sum equals $X$, the balance at the end of $n$ months:



$$(1+i)^{n}=\frac{A+X\times i}{A+B\times i}.$$

Taking logarithms (remember that $\ln a^n=n\ln a, \ln\frac{a}{b}=\ln{a}-\ln{b}$) and solving for $n$, as Robert Israel wrote in his answer, we obtain

$$n=\frac{1}{\ln (1+i)}\ln \left( \frac{A+X\times i}{A+B\times i}\right)=\frac{1}{\ln (1+i)}(\ln (A+X\times i)-\ln (A+B\times i)).$$

Note 1. As Ross Milikan commented, "if $i\ll 1$ (as it usually is these days) you can use $(1+i)^n\approx 1+in$ and avoid the logs entirely." I got

$$(1+i)^{n}\approx 1+in=\frac{A+X\times i}{A+B\times i}\Leftrightarrow n\approx \frac{1}{i}\left(\frac{A+X\times i}{A+B\times i}-1\right).$$

Note 2. For a given $n$ if one had to solve for $i$, one could use the secant method. For an example see this post of mine, in Portuguese.

share|cite|improve this answer
Also, if $in \ll 1$ (as it usually is these days) you can use $(1+i)^n\approx 1+in$ and avoid the logs entirely. – Ross Millikan Apr 22 '11 at 12:54
@Ross Millikan: thanks for the estimate. – Américo Tavares Apr 22 '11 at 12:56
Actually the requirement is $i\ll 1,$ not $in \ll 1$. Even easier to meet. – Ross Millikan Apr 22 '11 at 16:23
@Ross: thanks once more. – Américo Tavares Apr 22 '11 at 16:24

I'll use Americo's notation. Here's a simple way to do this. Suppose at the same time as you make the inital deposit of B, your friend takes out a loan at the same interest rate, in the amount $C$. So the two of you have a net balance of $B - C$, which would generate a monthly interest of $(B - C)i$. We choose $C = B + A/i$, so this interest would eat up your monthly deposit; with your friend making no payments, your combined net balance would stay constant at $-A/i$. But of course your friend's balance owing will increase as yours decreases: after $n$ months your friend owes $C (1 + i)^n$. Your account balance will reach $X$ when your friend's debt reaches $B - C + X$. That is, $C (1 + i)^n = B - C + X$, or $(1 + i)^n = \frac{B - C + X}{C} = \frac{X - A/i}{B + A/i}$. Now take logarithms and solve for $n$.

share|cite|improve this answer
I detailed my solution, which equals yours, except that instead of a positive and a negative term in the numerator, it has two positive terms: $X+A/i$, and not $X-A/i$. Would you mind checking the sign of $A/i$? – Américo Tavares Apr 22 '11 at 16:22

There are three implicit conditions when applying this formula:

  1. the deposits $A$ are uniform and equally spaced in time,
  2. they are made always at the end of each month, and
  3. the interest rate $i$ remains unchanged. $$X=B(1+i)^n+A\dfrac{(1+i)^n-1}{i}.$$

I'd like to note that when the second implicit condition for applying the formula derived by Américo Tavares changes to:

They are made always at the beginning of each month

The formula becomes:


This formula is also used in Microsoft Excel to calculate the Future Value (FV). The user can choose whether deposits are made at the beginning or at the end of the period.

share|cite|improve this answer

I just spent a few days looking into this question and while this question is quite old it was the top result on google so it seems still relevant. I wanted to share what I found to save someone in the future time.

What the question asker is looking for is the Annuity Formula solved for n.

Source for this here. Laid out bellow in case the source site is no longer available.

Here's the Annuity Formaula. We will derive the solution from here:

$$ FV of Annuity = P \Bigg[\frac{(1+r)^n-1}{r}\Bigg] $$

P = Periodic payment

R = Rate per period (this is an effective rate)

n = Number of periods

To solve for n we will begin by multiplying both sides by r/p and add 1 to each side:

$$ 1+\frac{FV \times r}{P}=(1+r)^n $$

Now we take the natural log of both sides to pull out the exponent n:

$$ ln\bigg(1+\frac{(FV \times r)}{P}\bigg)=n\times ln(1+r) $$

Which results in:

$$ n = ln\bigg(1+\frac{(FV \times r)}{P}\bigg) \div ln(1+r) $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.