## On Compound Interest – Closed-Form Solutions II

### Annual Compounding

In part one a formula for compound interest based on monthly deposits was discussed. The equations are based on monthly compounding which, as already stated in the previous post, is rather uncommon for the area I live in (at least as far as standard saving accounts are concerned).

To overcome this shortcoming we will develop a closed-form solution based on annual compounding. Here’s the question: given an initial balance, $K_0$, a monthly deposit, $M$, an annual interest rate, $i$, what is the compound future value in $N$ months from now if interest is paid once a year?

Note that the same assumptions and symbols as in part one apply. One notable exception is the change of semantics for the symbol $N$ which now represents the number of years (was number of months before).

As in part one, we start our journey by observing the resulting balance after the first year , $K_1$, is given by

$K_1 = K_0*(1 + i) + Y$

where the first term describes the initial balance plus interest and $Y$ represents the monthly deposits plus interest. Since the formula is essentially equal to the formula for $K_1$ in the first post (except that periods are now years and we use the annual interest rate), we can use all the results from the previous part once we determine the value for $Y$.

When interest is paid at the end of the interest period the bank usually differentiates between deposits made during the course of the interest period and such balances that already existed at the beginning of the last interest period.

Those amounts that existed for the entire interest period, for example $K_0$ in the calculation of $K_1$, are paid full interest. The remaining contributions are paid interest proportional to the number of days it contributed to the interest period (consult your terms of service for details).

$Y$ isto the sum of monthly deposits plus partial interest which is calculated by

$Y = M * (1 + i * \frac{12}{12}) + M * (1 + i * \frac{11}{12}) + \ldots + M * (1 + i * \frac{1}{12})$

which simplifies to

$Y = 12 * M + \frac{Mi}{12} * \sum_{k=1}^{12}k$

for which the summation can be written as (using properties of an arithmetic sequence)

$Y = 12 * M + \frac{Mi}{12} * \frac{12*(12 + 1)}{2}$

or

$Y = 12 * M + 6.5 * Mi$

Now that we’ve arrived at a closed-form equation for the value of $Y$ we can use the results of part one to arrive at

$K_N = K_0*(1 + i)^N + Y*\frac{(1 + i)^N - 1}{(1 + i) - 1}$

as the solution to our problem. In Ruby

# input
$k0 = 2000.0 # initial balance$m = 500.0         # monthly deposit
$i = 0.05 # interest rate$n = 36             # number of periods (months)

# yearly compounded, closed-form
years = ($n / 12).floor y = 12 *$m + 6.5 * $m *$i
fv = $k0 * (1 +$i)**years + y * (((1 + $i)**years - 1)/((1 +$i) - 1))
puts "Future value equals #{fv}" #=> 21742.53