Sub topic 8
Compound Interest as Exponential Growth
This chapter assumes you can write and evaluate f(x) = a·b^x, convert a percent rate to a growth factor (b = 1 + r), and use a calculator for non-integer exponents. You should also be comfortable with the laws of exponents. Here we apply that model to money that earns interest on its own interest.
Simple versus compound interest
Interest is a payment for the use of money. There are two basic ways to compute it.
- Simple interest is paid only on the original amount, called the principal. Each period adds the same dollar amount, so the balance grows linearly.
- Compound interest is paid on the principal plus all interest earned so far. Each period adds a fixed percentage of the current balance, so the balance grows exponentially.
Suppose you deposit $1000 at 5% per year.
| Year | Simple interest balance | Compound interest balance |
|---|---|---|
| 0 | 1000.00 | 1000.00 |
| 1 | 1050.00 | 1050.00 |
| 2 | 1100.00 | 1102.50 |
| 3 | 1150.00 | 1157.63 |
| 10 | 1500.00 | 1628.89 |
In year 2, the compound account earns 5% of 1050, which is 52.50, instead of 5% of 1000, which is 50. That extra 2.50 is interest on interest. It starts small, but it is also part of the balance that earns interest the next year.
The compound interest formula
Compounding once per year is the same exponential model you already know. The initial value a is the principal P, and the growth factor is b = 1 + r, where r is the annual rate as a decimal.
A(t) = P · (1 + r)^t
Here A(t) is the balance after t years. The code from the topic's first example already computed this: 1000 growing at 5% per year for 10 years gives 1628.89.
def exp_model(a, b, x):
return a * b ** x
# A population of 1000 growing 5% per year (b = 1 + 0.05)
print(round(exp_model(1000, 1.05, 10), 2)) # 1628.89
# A value of 1000 losing 5% per year (b = 1 - 0.05)
print(round(exp_model(1000, 0.95, 10), 2)) # 598.74The balance is an exponential function of time, so every property from earlier chapters carries over. The graph crosses the vertical axis at P. The factor 1.05 is above 1, so the balance grows. The balance multiplies by the same factor each year, which means the ratio A(t+1) / A(t) is always 1.05.
Compounding more than once per year
Banks often compound monthly, quarterly, or daily. If the nominal annual rate is r and interest is compounded n times per year, each period earns r/n, and there are n·t periods in t years.
A(t) = P · (1 + r/n)^(n·t)
This is still the form a·b^x. The base is b = 1 + r/n, and the exponent counts periods instead of years. You can also regroup it to show the yearly growth factor:
A(t) = P · [(1 + r/n)^n]^t
So the effective annual growth factor is (1 + r/n)^n. Subtracting 1 gives the effective annual rate (EAR), the single yearly rate that produces the same result as the compounded schedule.
Worked example
Deposit $1000 at a nominal 5% per year, compounded monthly, for 10 years.
- Identify the values: P = 1000, r = 0.05, n = 12, t = 10.
- Monthly factor: 1 + 0.05/12 = 1.0041667 (rounded).
- Number of periods: 12 · 10 = 120.
- Balance: 1000 · 1.0041667^120 ≈ 1647.01.
The effective annual rate is (1 + 0.05/12)^12 − 1 ≈ 0.05116, or about 5.116%. That is slightly higher than the nominal 5%, which is why the monthly balance (1647.01) beats the yearly balance (1628.89).
What happens as n grows
More frequent compounding helps, but with sharply diminishing returns. Using P = 1000, r = 5%, and t = 10 years:
| Compounding | n | Balance after 10 years |
|---|---|---|
| Yearly | 1 | 1628.89 |
| Quarterly | 4 | 1643.62 |
| Monthly | 12 | 1647.01 |
| Daily | 365 | 1648.66 |
| Continuous | limit | 1648.72 |
Going from yearly to monthly adds about 18 dollars. Going from monthly to daily adds less than 2 dollars. The values approach a ceiling. That ceiling is the continuous compounding result, which uses the number e.
Continuous compounding
If you let n grow without bound, (1 + r/n)^n approaches e^r, where e ≈ 2.71828 is the natural base. The formula becomes:
A(t) = P · e^(r·t)
This is also an exponential function. It is the same a·b^x form with b = e^r. For r = 5%, b = e^0.05 ≈ 1.05127. That means continuous compounding at a nominal 5% has an effective annual rate of about 5.127%.
The following program compares the two results for the running example.
import math
P, r, t = 1000, 0.05, 10
monthly = P * (1 + r / 12) ** (12 * t)
continuous = P * math.exp(r * t)
print(round(monthly, 2)) # 1647.01
print(round(continuous, 2)) # 1648.72A later chapter in this tutorial covers e in more detail. For now, treat continuous compounding as the upper limit of the discrete formula.
Comparing offers with the effective annual rate
Two accounts can quote the same nominal rate and still pay different amounts. The nominal rate alone does not tell you the growth factor. You need the compounding frequency too.
The function below computes the effective annual rate for any n, and for continuous compounding when you pass None.
import math
def effective_annual_rate(r, n=None):
"""Return the effective annual rate for nominal rate r.
n is the number of compounding periods per year.
Pass n=None for continuous compounding.
"""
if n is None:
return math.exp(r) - 1
return (1 + r / n) ** n - 1
for label, n in [("yearly", 1), ("monthly", 12), ("daily", 365), ("continuous", None)]:
print(label, round(effective_annual_rate(0.05, n) * 100, 4))Running it prints about 5.0 for yearly, 5.1162 for monthly, 5.1267 for daily, and 5.1271 for continuous. When you compare savings accounts or loans, convert each to its EAR first. A loan with a higher nominal rate but less frequent compounding can cost less than one with a lower nominal rate compounded daily.
Adding regular deposits
The formulas above assume one deposit and no further contributions. Real savings plans add money regularly. Each deposit then grows on its own exponential curve, starting at the time it is made, and the balance is the sum of those curves. The sum of a series of exponentials is no longer a single a·b^x function, so the formulas in this chapter do not cover it. It uses a geometric series, which is a separate topic. The key idea stays the same: each dollar grows by the same factor per period, and earlier dollars have more periods to grow.
Common errors
- Using r as a percent in the formula. Write 5% as 0.05. Using 5 gives a growth factor of 6, which is a 500% rate.
- Forgetting to divide the rate by n. If you compound monthly, the monthly rate is r/12, not r.
- Mismatching the exponent. In (1 + r/n)^(n·t), the exponent counts compounding periods. If you use t alone, you get the balance after t periods, not t years.
- Rounding too early. Rounding 1.0041667 to 1.004 changes the 10-year balance by several dollars. Keep full precision until the final answer.
- Treating the nominal rate as the effective rate. A "5% compounded monthly" account does not grow by exactly 5% per year.
- Mixing up e and the rate. In P·e^(rt), r is the nominal continuous rate, and the yearly growth factor is e^r, not e.
Visualizing the compounding frequency
The diagram below shows how the balance after one year depends on how often interest is added. Each step adds interest on the new, larger balance.
Solving for the missing quantity
The formula has several variables, and you can solve for any one of them if you know the others.
- Balance A: substitute and evaluate.
- Principal P: divide. P = A / (1 + r/n)^(n·t). This is the present value, the amount you would need to deposit today to reach a target.
- Rate r: take a root. From A/P = (1 + r/n)^(n·t), the base is (A/P)^(1/(n·t)), so r = n·[(A/P)^(1/(n·t)) − 1].
- Time t: the unknown is in the exponent, so you need logarithms. A later chapter covers this in detail.
Worked example: finding the rate
A deposit of $2000 grows to $2800 in 6 years with yearly compounding. Find the annual rate.
- Set up: 2800 = 2000 · (1 + r)^6.
- Divide: 1.4 = (1 + r)^6.
- Take the sixth root: 1 + r = 1.4^(1/6) ≈ 1.0577.
- Subtract 1: r ≈ 0.0577, or about 5.77%.
This is the same method used to fit a model from two data points: divide to cancel the initial value, then take a root.
P, A, t = 2000, 2800, 6
r = (A / P) ** (1 / t) - 1
print(round(r * 100, 2)) # 5.77Edge cases
- Rate of zero. With r = 0, the factor is 1 and the balance never changes. The exponential degenerates to a constant.
- Negative rate. A negative r gives a factor below 1, so the formula models decay. This applies to a fee that erodes a balance or to deflation of purchasing power.
- Fractional time. The formulas accept non-integer t, but many banks pay interest only at period ends. After 2.5 years with yearly compounding, the real balance usually equals the year-2 balance plus, perhaps, simple interest for the half year. The smooth formula is an approximation of that schedule.
- Inflation. A balance growing at 5% while prices grow at 3% has real growth factor 1.05/1.03, about 1.0194, so real growth is closer to 1.94% than 2%.
- Variable rates. If the rate changes, the single formula no longer applies. Multiply the factors for each stretch of time instead.
Exercise
You invest $5000 at a nominal 6% per year, compounded quarterly. What is the balance after 8 years, and what is the effective annual rate? Round the balance to cents and the rate to two decimal places in percent.
Show answer
Here P = 5000, r = 0.06, n = 4, t = 8. The balance is 5000 · (1 + 0.06/4)^(4·8) = 5000 · 1.015^32 ≈ 8052.00 (more precisely 8051.99 to 8052.00 depending on rounding). The effective annual rate is 1.015^4 − 1 ≈ 0.0614, or 6.14%.
Exercise
A savings account compounds continuously at 4% per year. Write the balance function for a $3000 deposit, find the yearly growth factor, and find the balance after 5 years.
Show answer
A(t) = 3000·e^(0.04t). The yearly growth factor is e^0.04 ≈ 1.0408, so the effective annual rate is about 4.08%. After 5 years, A(5) = 3000·e^0.2 ≈ 3000 · 1.2214 ≈ 3664.21.
Exercise
Account X pays 4.9% compounded daily. Account Y pays 5.0% compounded yearly. Which one has the higher effective annual rate?
Show answer
Account X has EAR = (1 + 0.049/365)^365 − 1 ≈ 0.05022, or about 5.02%. Account Y has EAR = 5.00%. Account X is better, even though its nominal rate is lower.