📚 Math in Society
⇩ Download ▾

9.3 Compound Interest

With simple interest, we were assuming that we pocketed the interest when we received it. In a standard bank account, any interest we earn is automatically added to our balance, and we earn interest on that interest in future years. This reinvestment of interest is called compounding.

# Ch 9.3 - compound interest: PN = P0 (1 + r/k)^(Nk)
def compound(P0, r, k, N):
    return P0 * (1 + r / k) ** (N * k)

P0, APR, K = 1000, 0.03, 12       # the book's $1000 at 3% compounded monthly
# TRY IT: K = 1 (yearly), 4 (quarterly), 365 (daily). How much does k matter?
i = APR / K
print(f"${P0:,} at {100 * APR:g}% APR, compounded {K}x a year -> {100 * i:.4g}% per period\n")
print("period   starting balance   interest earned   ending balance")
balance = P0
for m in range(1, K + 1):
    earned = round(balance * i, 2)          # a bank rounds to the penny each month
    print(f"{m:>6}   {balance:>16,.2f}   {earned:>15,.2f}   {balance + earned:>14,.2f}")
    balance += earned
print(f"the formula gets there in one step: {P0} x (1 + {i:.4g})^{K} = "
      f"${compound(P0, APR, K, 1):,.2f}")
print("Each row's interest is BIGGER than the last, because you are now earning")
print("interest on last period's interest. That is the whole idea.\n")

# The book's CD: $3000 at 6% compounded monthly, versus simple interest.
CD, CD_APR, CD_K = 3000, 0.06, 12
print(f"${CD:,} in a CD at {100 * CD_APR:g}%, compounded vs simple:")
print("years    simple interest    compounded    difference")
for N in (5, 10, 15, 20, 25, 30, 35):
    s = CD * (1 + CD_APR * N)
    c = compound(CD, CD_APR, CD_K, N)
    print(f"{N:>5}    {s:>15,.2f}    {c:>10,.2f}    {c - s:>10,.2f}")
print(f"\nafter 20 years the CD holds ${compound(CD, CD_APR, CD_K, 20):,.2f}")

# Running the formula backwards: how much must you deposit TODAY?
GOAL, G_APR, G_K, G_N = 40000, 0.04, 4, 18
need = GOAL / (1 + G_APR / G_K) ** (G_N * G_K)
print(f"\nto have ${GOAL:,} in {G_N} years at {100 * G_APR:g}% compounded {G_K}x a year,")
print(f"deposit ${need:,.2f} now.  Check: {need:,.2f} grows to "
      f"${compound(need, G_APR, G_K, G_N):,.2f}")
print("\nWhy the book nags about rounding. $1000 at 5% monthly for 30 years,")
print("where r/k = 0.05/12 = 0.0041666... is rounded to different places:")
exact = 0.05 / 12
for rk in (0.004, 0.0042, 0.00417, 0.004167, 0.0041667, exact):
    label = "no rounding" if rk == exact else f"r/k = {rk}"
    value = 1000 * (1 + rk) ** 360
    error = value - 1000 * (1 + exact) ** 360
    print(f"   {label:<18} -> ${value:>9,.2f}" + (f"   off by ${error:,.2f}" if error else ""))

Suppose that we deposit $1000 in a bank account offering 3% interest, compounded monthly. How will our money grow?

The 3% interest is an annual percentage rate (APR) – the total interest to be paid during the year. Since interest is being paid monthly, each month, we will earn 3%12=0.25% per month.

In the first month,

P 0 = $ 1000

r = 0.0025 ( 0.25 % )

I = $ 1000 ( 0.0025 ) = $ 2.50

A = $ 1000 + $ 2.50 = $ 1002.50

In the first month, we will earn $2.50 in interest, raising our account balance to $1002.50.

In the second month,

P 0 = $ 1002.50

I=$1002.50(0.0025)=$2.51 (rounded)

A = $ 1000 + $ 2.50 = $ 1002.50

Notice that in the second month we earned more interest than we did in the first month. This is because we earned interest not only on the original $1000 we deposited, but we also earned interest on the $2.50 of interest we earned the first month. This is the key advantage that compounding of interest gives us.

Calculating out a few more months:

MonthStarting balanceInterest earnedEnding Balance
11000.002.501002.50
21002.502.511005.01
31005.012.511007.52
41007.522.521010.04
51010.042.531012.57
61012.572.531015.10
71015.102.541017.64
81017.642.541020.18
91020.182.551022.73
101022.732.561025.29
111025.292.561027.85
121027.852.571030.42

To find an equation to represent this, if Pm represents the amount of money after m months, then we could write the recursive equation:

P 0 = $ 1000

P m = ( 1 + 0.0025 ) P m 1

You probably recognize this as the recursive form of exponential growth. If not, we could go through the steps to build an explicit equation for the growth:

P 0 = $ 1000

P 1 = 1.0025 P 0 = 1.0025 ( 1000 )

P 2 = 1.0025 P 1 = 1.0025 ( 1.0025 ( 1000 ) ) = 1.0025 2 ( 1000 )

P 3 = 1.0025 P 2 = 1.0025 ( 1.0025 2 ( 1000 ) ) = 1.0025 3 ( 1000 )

P 4 = 1.0025 P 3 = 1.0025 ( 1.0025 3 ( 1000 ) ) = 1.0025 4 ( 1000 )

Observing a pattern, we could conclude

P m = ( 1.0025 ) m ( $ 1000 )

Notice that the $1000 in the equation was P0, the starting amount. We found 1.0025 by adding one to the growth rate divided by 12, since we were compounding 12 times per year.

Generalizing our result, we could write

P m = P 0 ( 1 + r k ) m

In this formula:

m is the number of compounding periods (months in our example)

r is the annual interest rate

k is the number of compounds per year.

While this formula works fine, it is more common to use a formula that involves the number of years, rather than the number of compounding periods. If N is the number of years, then m=Nk. Making this change gives us the standard formula for compound interest.

If the compounding is done annually (once a year), k=1.

If the compounding is done quarterly, k=4.

If the compounding is done monthly, k=12.

If the compounding is done daily, k=365.

The most important thing to remember about using this formula is that it assumes that we put money in the account once and let it sit there earning interest.

Let us compare the amount of money earned from compounding against the amount you would earn from simple interest

Years Simple Interest  ($15 per month) 6% compounded  monthly =0.5% each month. 
5$3900$4046.55
10$4800$5458.19
15$5700$7362.28
20$6600$9930.61
25$7500$13394.91
30$8400$18067.73
35$9300$24370.65

Line graph with the horizontal axis Years marked 0 to 35 and the vertical axis Account Balance in dollars marked 0 to 25000. Two series both begin at 3000 dollars. The navy diamonds, simple interest of 15 dollars a month, follow a straight line up to 9300 dollars at year 35. The magenta squares, 6 percent compounded monthly, sit almost on top of that line for the first ten years and then curve away above it, passing about 9931 dollars at year 20 and reaching about 24371 dollars at year 35.

As you can see, over a long period of time, compounding makes a large difference in the account balance. You may recognize this as the difference between linear growth and exponential growth.

Adapted from Math in Society by David Lippman, hosted on LibreTexts (math.libretexts.org) and licensed under CC BY-SA 3.0. Changes were made. License: CC-BY-SA-3.0.

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or ADA Title II. Every page is built against an automated accessibility gate, and the published editions will meet ADA Title II requirements when they release in late September 2026. If something is unusable, please tell us.