Sub topic 6
How interest and compounding work
This chapter explains how interest turns a balance into a larger balance over time. It covers simple and compound interest, the gap between a quoted rate and what you actually earn, and the formulas the later chapters use to find a monthly contribution. It assumes you know what a savings account is, are comfortable with percentages, and can read short Python functions.
Simple interest and compound interest
Interest is a payment for letting someone else use your money. When you deposit into a bank, the bank pays you interest. The principal is the amount you start with. The rate is the percentage paid per period, usually quoted per year.
Simple interest is paid only on the principal. If you deposit 1,000 at 5% a year, you earn 50 every year, whatever the balance has become.
Compound interest is paid on the principal plus interest already earned. Each period's interest is added to the balance, and the next period's interest is calculated on that larger amount. This is what "compounding" means: interest earns interest.
Here is the loop in code, using 10% so the numbers are easy to check by hand.
balance = 1000.0
rate = 0.10
for year in range(1, 4):
interest = balance * rate
balance += interest
print(f"Year {year}: interest {interest:.2f}, balance {balance:.2f}")The output is 100.00, 110.00 and 121.00 of interest, with balances of 1100.00, 1210.00 and 1331.00. Simple interest would pay 100 each year. The extra 10 in year 2 and 21 in year 3 is interest earned on earlier interest.
The lump-sum formula
For a single deposit left alone, the future value is:
FV = P × (1 + r/n) ^ (n × t)
Pis the principal.ris the annual rate as a decimal (5% is 0.05).nis the number of compounding periods per year.tis the number of years.
def simple_value(principal, annual_rate, years):
return principal * (1 + annual_rate * years)
def compound_value(principal, annual_rate, years, periods_per_year=12):
r = annual_rate / periods_per_year
return principal * (1 + r) ** (periods_per_year * years)
print(round(simple_value(1000, 0.05, 10), 2)) # 1500.0
print(round(compound_value(1000, 0.05, 10, 1), 2)) # 1628.89
print(round(compound_value(1000, 0.05, 10, 12), 2)) # 1647.01Over 10 years, compounding adds about 129 to 147 of extra growth compared with simple interest. The gap widens with time, because the growth is exponential rather than a straight line.
| Years | Simple interest at 5% | Compounded annually at 5% |
|---|---|---|
| 10 | 1,500.00 | 1,628.89 |
| 20 | 2,000.00 | 2,653.30 |
| 30 | 2,500.00 | 4,321.94 |
These are the values of a 1,000 deposit. After 30 years, interest earning interest accounts for most of the growth. This is why long-term goals benefit most from compounding and short-term goals benefit little.
Compounding frequency, APR and APY
Banks may compound interest annually, monthly or daily. More frequent compounding gives a slightly higher result at the same stated rate, but the effect is small. In the example above, annual compounding gave 1,628.89 and monthly gave 1,647.01. Daily compounding gives about 1,648.66.
Two labels describe rates:
- APR (annual percentage rate) is the stated yearly rate, before compounding is counted. Loans usually quote APR.
- APY (annual percentage yield, also called effective annual rate) is what you actually earn in a year after compounding. Savings products often quote APY.
The conversion is APY = (1 + APR/n) ^ n - 1.
def apy(apr, periods_per_year):
return (1 + apr / periods_per_year) ** periods_per_year - 1
print(round(apy(0.04, 12) * 100, 3)) # 4.074
print(round(apy(0.04, 365) * 100, 3)) # 4.081A 4% rate compounded monthly is a 4.074% APY. When comparing two savings accounts, compare APY with APY. Comparing one account's APR with another's APY makes the second look better than it is.
Regular deposits: the future value of an annuity
Most savers add money every month rather than depositing once. Each deposit compounds from the day it is made, so the first deposit grows longest. For equal deposits made at the end of each month, the future value is:
FV = PMT × ((1 + r)^m - 1) / r
Here PMT is the monthly deposit, r is the monthly rate (annual rate divided by 12), and m is the number of months.
def future_value_deposits(monthly_deposit, annual_rate, months):
r = annual_rate / 12
if r == 0:
return monthly_deposit * months
return monthly_deposit * ((1 + r) ** months - 1) / r
total = future_value_deposits(250, 0.04, 24)
print(round(total, 2)) # about 6235.7
print(round(total - 250 * 24, 2)) # interest earned, about 235.7Saving 250 a month for 24 months at 4% gives about 6,236, of which 6,000 is your own money and about 236 is interest. With no interest you would reach 6,000 exactly, which is the baseline the next chapters use. The next chapter on contributions rearranges this formula to solve for PMT, given a target.
The r == 0 branch matters. At a zero rate the formula divides by zero, so the code falls back to deposit times months.
Quick estimates: the rule of 72
The rule of 72 estimates how long money takes to double. Divide 72 by the annual rate as a percentage. At 6%, 72 / 6 = 12, so money doubles in about 12 years. The exact figure is 11.9 years. The rule works well for rates between about 4% and 12% and gives a quick check on any calculator result.
What reduces your effective growth
The formulas above give the nominal growth, meaning the growth in the number on your statement. Three things reduce what that growth is worth.
- Inflation. Rising prices reduce what the balance buys. The real return is
(1 + nominal) / (1 + inflation) - 1. A 4% account during 3% inflation has a real return of about 0.97%, not 1%. This links to the inflation chapter. - Fees. A fund charging 1% a year reduces the effective rate by about 1 point. Over 30 years, 1,000 growing at 7% reaches about 7,612, but at 6% after fees it reaches only about 5,743. That is roughly 25% less.
- Taxes. Interest is often taxable. Tax-advantaged accounts, where available, let the full amount compound. The rules differ by country, so check yours.
def real_return(nominal, inflation):
return (1 + nominal) / (1 + inflation) - 1
print(round(real_return(0.04, 0.03) * 100, 3)) # 0.971Common errors
- Using the percent rather than the decimal. Put
0.05into the formula, not5. - Mixing units. If the rate is annual and deposits are monthly, divide the rate by 12 and count periods in months. Do not use years in the exponent with a monthly rate.
- Assuming a fixed rate. Savings account rates change, and investment returns vary from year to year. A formula output is a projection under a constant-rate assumption, not a promise.
- Treating compounding as a reason to take risk. A higher expected return usually comes with larger swings. The risk chapter covers this.
- Ignoring early withdrawals. Taking money out resets part of the compounding. A single large withdrawal removes the balance that would have earned interest.
Exercises
Exercise
You deposit 2,000 in an account paying 6% a year, compounded annually, and leave it for 12 years. About how much will you have, and about how much is interest on interest compared with simple interest?
Show answer
Compound value is 2,000 × 1.06^12 ≈ 2,000 × 2.0122 ≈ 4,024. Simple interest would give 2,000 × (1 + 0.06 × 12) = 3,440. The difference of about 584 comes from interest earning interest.
Exercise
A savings account advertises 12% APR compounded monthly. What is its APY, and why is it higher than 12%?
Show answer
The monthly rate is 1%, so APY = 1.01^12 - 1 ≈ 0.1268, or about 12.68%. It is higher because each month's interest is added to the balance and earns interest in the following months.
Exercise
Using the deposit formula, will saving 100 a month for 12 months at a 0% rate give a different result from the formula at a small positive rate? Which function branch handles the 0% case, and why is it needed?
Show answer
At 0% the result is 100 × 12 = 1,200. A small positive rate gives slightly more than 1,200. The r == 0 branch is needed because the formula divides by r, which would cause a division by zero.