# How to solve for $i$ and $n$ in compound interest formula?

Given that $$F = A{ (1+i)^n - 1 \over i}$$

How can you solve for $i$ or $n$?

• There is no "closed form" expression for $i$ in terms of the other parameters. So one uses a numerical procedure, like Newton-Raphson. This works quite efficiently, since we can usually give a good starting point $i_0$, so Newton-Raphson converges rapidly. In addition, there are many special purpose approximation formulas developed before the computer age. – André Nicolas Oct 5 '12 at 17:52
• and for n, just solve for $(1+i)^n$ and use the logarithm with base $1+i$, which you can then convert to natural logarithms if you prefer them. – Alex Oct 5 '12 at 17:54

## 2 Answers

As far as $i$, numerically. The formula you give is the future value of an annuity that pays $A$ at the end of every time period for $n$ periods. There isn't really a good way to solve for it. But, there is guaranteed to be one unique value for $i$, so you can use a financial calculator to solve for it or use numerical methods like Newton's method.

Solving for $i$ is equivalent to solving for $i$ in the $n$th degree polynomial:

$$A(1+i)^n - Fi - A = 0$$

Solving for $n$ is possible.

\begin{align*} &\frac{Fi}{A} = (1+i)^n - 1 \\ \Rightarrow &(1+i)^n = 1 + \frac{Fi}{A} \\ \Rightarrow &n \ln (1+i) = \ln(1 + \frac{Fi}{A}) \\ \Rightarrow &n = \frac{\ln(1 + \frac{Fi}{A})}{\ln(1+i)} \end{align*}

• Note that if $n$ is the number of terms, then $n$ has to be an integer. In practise, this means that you will have to round the answer above to the nearest integer, and that you cannot get the future value to be exactly $F$ by choosing $n$ suitably. – Per Manne Oct 5 '12 at 18:12
• @PerManne Sure, good point. So, if you want to achieve some future value $F$ and you end up with a value of $n$ that is not an integer, you would round up to figure out how many payments of $A$ are needed. But, at the same time, another way to think about it would be to have the final payment be at time $n$, even if $n$ is not an integer. In that case, the overall future value would be very close to $F$ at that time $n$. – Graphth Oct 5 '12 at 18:22

You can solve for $n$ if you know $i$ with $$F = A{ (1+i)^n - 1 \over i}$$ $$\frac{iF}{A} +1 = (1+i)^n$$ $$n= \frac{\log\left(\frac{iF}{A} +1\right)}{\log (1+i)}= \frac{\log\left(iF +A\right) - \log(A)}{\log (1+i)}.$$

Solving for $i$ if you know $n$ requires numerical methods except for some special cases for $n$.