Exponents & Logarithms Applied to Compound Interest
Estimating how much your savings will grow with exponents, and how long it will take with logarithms.
You worked all summer for $4.25 an hour (the minimum wage) and saved $1,000. It sits in a savings account, and the bank prints each deposit in your passbook. You’ve also picked out the car you want five years from now: a brand-new economy car, like a two-door Ford Escort or Toyota Tercel. Today one costs about $10,000. New-car prices have been creeping up about 3% a year, so in five years it will cost more.
The bank pays you interest: a small fee for keeping your money. This year, an ordinary savings account pays a little over 2% a year. So here’s the question. If you never add another dollar, how long until interest alone turns $1,000 into enough for that car?
Ask your grandparents at Thanksgiving, and they may say it used to be quicker. In 1981, a certificate of deposit (a CD, money you promise to leave in the bank for a set time) paid close to 18% a year. But prices were also climbing more than 10% a year then, so much of that interest only kept up with the cost of groceries.
Two tools answer your question. An exponent tells you what your money will grow to. A logarithm tells you how long it will take. They’re the same idea, run forwards and backwards.
Interest that earns interest
Say your account pays 2.3% a year. After one year, the bank adds 2.3% of $1,000, which is $23. You now have $1,023.
In the second year, the bank pays 2.3% on $1,023, not on $1,000. That’s $23.53. The extra 53 cents is interest earned on last year’s interest. This is compound interest. It works like a snowball rolling downhill: the bigger it gets, the more snow it picks up on each turn.
Here is the precise version. Every year, your balance is multiplied by the same number, . That number is the growth factor: 1 for the money you had, plus 0.023 for the interest. Multiplying by the same number again and again is exactly what an exponent writes down.
Here’s that snowball, one year at a time.
double balance = 1'000.0;
for (int year = 1; year <= 5; ++year) {
balance *= 1.023;
std::println("Year {}: {:.2f}", year, balance);
}Year 1: 1023.00
Year 2: 1046.53
Year 3: 1070.60
Year 4: 1095.22
Year 5: 1120.41
balance = 1_000
for year in range(1, 6):
balance *= 1.023
print(f"Year {year}: {balance:,.2f}")Year 1: 1,023.00
Year 2: 1,046.53
Year 3: 1,070.60
Year 4: 1,095.22
Year 5: 1,120.41
Exponents and logarithms undo each other
An exponent is shorthand for repeated multiplication:
The 2 is the base, the number being multiplied. The 5 is the exponent, how many times you multiply it.
A logarithm asks the reverse question: how many times must you multiply the base to reach a number? Since five 2s multiply to 32, the logarithm base 2 of 32 is 5:
Picture it: Fold a sheet of paper in half, and it’s two layers thick. Fold it again, and it’s four. Every fold doubles the stack. Fold it five times, and you have 32 layers. That’s the exponent: . Now hand the folded paper to a friend and ask, “How many times did I fold this?” Your friend counts 32 layers and answers, “Five.” That’s the logarithm: . One question goes from folds to layers. The other goes from layers back to folds. Each one undoes the other.
In math, “undoes” has an exact meaning. For any base , the logarithm is defined as the exponent that gets you there:
Do one and then the other, and you’re back where you started, just as unfolding the paper gives you back one sheet:
Logarithms have one more useful habit: they turn multiplying into adding. Fold twice (4 layers), then three more times (8 times as many). That’s folds in all, and layers:
The rule that matters most for money is the power rule. It takes an exponent that’s stuck up high and brings it down to the main line, where you can solve for it:
A computer agrees with the paper, including the round trip.
std::println("2^5 = {}", std::pow(2.0, 5));
std::println("log2(32) = {}", std::log2(32.0));
std::println("log2(4 x 8) = {}", std::log2(4.0 * 8.0));
std::println("log2(4) + log2(8) = {}", std::log2(4.0) + std::log2(8.0));
std::println("2^log2(32) = {}", std::pow(2.0, std::log2(32.0)));2^5 = 32
log2(32) = 5
log2(4 x 8) = 5
log2(4) + log2(8) = 5
2^log2(32) = 32
import math
print(f"2^5 = {2 ** 5}")
print(f"log2(32) = {math.log2(32):g}")
print(f"log2(4 x 8) = {math.log2(4 * 8):g}")
print(f"log2(4) + log2(8) = {math.log2(4) + math.log2(8):g}")
print(f"2^log2(32) = {2 ** math.log2(32):g}")2^5 = 32
log2(32) = 5
log2(4 x 8) = 5
log2(4) + log2(8) = 5
2^log2(32) = 32
Exponents: what will my savings grow to?
Start with dollars at a yearly rate , written as a decimal (2.3% is ). After years, you have:
Here is the growth factor, and the exponent counts the years. Compare your savings account with a one-year CD paying about 6%, renewed at that rate every year:
After five years, the savings account has earned about $120 and the CD about $338. That’s better, but neither is close to a car.
The car’s price follows the same formula. Its growth factor is 1.03, because prices rise about 3% a year. In five years, today’s $10,000 car will cost:
So five years from now, you’d have about $1,340 at best, and the car would cost about $11,600.
The formula fits in one small function, which can grow both your savings and the car’s price.
double future_value(double principal, double rate, double years) {
return principal * std::pow(1.0 + rate, years);
}
std::println("Savings account, 5 years: {:.2f}", future_value(1'000, 0.023, 5));
std::println("CD, 5 years: {:.2f}", future_value(1'000, 0.06, 5));
std::println("Car price in 5 years: {:.2f}", future_value(10'000, 0.03, 5));Savings account, 5 years: 1120.41
CD, 5 years: 1338.23
Car price in 5 years: 11592.74
def future_value(principal, rate, years):
return principal * (1 + rate) ** years
print(f"Savings account, 5 years: {future_value(1_000, 0.023, 5):,.2f}")
print(f"CD, 5 years: {future_value(1_000, 0.06, 5):,.2f}")
print(f"Car price in 5 years: {future_value(10_000, 0.03, 5):,.2f}")Savings account, 5 years: 1,120.41
CD, 5 years: 1,338.23
Car price in 5 years: 11,592.74
Logarithms: how long until I can buy the car?
Now flip the question. You know where you want to end up, about $11,600. The unknown is , and it’s stuck up in the exponent:
Take the logarithm of both sides. The power rule brings down, and you can divide to solve for it:
The symbol is the natural logarithm, the LN key on a scientific calculator. Its base is a special number, , but the base doesn’t change the answer here. Any base works, as long as you use the same one on the top and the bottom of the fraction. In general, the time to grow from to a goal is:
So the answer is about 108 years, longer than anyone lives. The CD is faster, but still nowhere near five years:
If you’re 16 now, you’d be 58. And that assumes the car’s price stands still for 42 years. It won’t.
Here’s the honest lesson. For a goal five years away, interest is too slow to matter much. Your own saving matters far more. Put away about $2,000 a year from summer jobs and weekend shifts. In five years, that plus the $1,000 you have now is $11,000 of your own money. The savings account’s interest adds almost $600 more, which lands you within a few dollars of the car’s price.
Flipping the formula gives a second function. It answers “how long?” for both accounts, and it checks the savings plan.
double years_to_target(double principal, double rate, double target) {
return std::log(target / principal) / std::log1p(rate);
}
const double car = future_value(10'000, 0.03, 5);
std::println("Savings account: {:.2f} years", years_to_target(1'000, 0.023, car));
std::println("CD: {:.2f} years", years_to_target(1'000, 0.06, car));
double plan = 1'000.0;
for (int year = 1; year <= 5; ++year) {
plan = plan * 1.023 + 2'000;
}
std::println("Saving 2,000 a year for 5 years: {:.2f}", plan);Savings account: 107.76 years
CD: 42.05 years
Saving 2,000 a year for 5 years: 11591.12
import numpy as np
def years_to_target(principal, rate, target):
return np.log(target / principal) / np.log1p(rate)
car = future_value(10_000, 0.03, 5)
print(f"Savings account: {years_to_target(1_000, 0.023, car):.2f} years")
print(f"CD: {years_to_target(1_000, 0.06, car):.2f} years")
plan = 1_000
for year in range(5):
plan = plan * 1.023 + 2_000
print(f"Saving 2,000 a year for 5 years: {plan:,.2f}")Savings account: 107.76 years
CD: 42.05 years
Saving 2,000 a year for 5 years: 11,591.12
The same math says something very different about goals that are decades away: start early. Put $1,000 in at 6% and leave it alone. In 30 years it grows to about $5,743. In 50 years it grows to about $18,420. It’s the same $1,000. The 20 extra years more than triple the result, because .

A shortcut bankers use: the rule of 72
How long does it take to double your money? Set :
At 6%, the rule says years. The exact answer is years. The shortcut works because is close to when is small, which gives . Bankers use 72 instead of 69.3 because 72 divides evenly by 2, 3, 4, 6, 8, 9 and 12, so you can do it in your head.
The twist: buy a slice of the whole stock market
Now picture a different choice for that same $1,000. Don’t spend it, and don’t park it at the bank. Put it in an index fund, a fund that buys a small piece of every company in the S&P 500, a list of 500 of the biggest companies in America. Then leave it alone for 30 years.
Over long stretches, stocks have paid much more than banks. Counting dividends (the share of profits that companies pay to the people who own them), big American company stocks have grown about 10% a year on average since 1926. Plug that into the same formula:
Same $1,000. Same 30 years. Not one dollar added. Here’s where each choice ends up:
| Where your $1,000 sits for 30 years | Rate a year | After 30 years |
|---|---|---|
| Savings account | 2.3% | $1,978 |
| CD, renewed every year | 6% | $5,743 |
| S&P 500 index fund | about 10% | $17,449 |
A few extra percentage points a year don’t sound like much. Over 30 years, the exponent turns them into almost nine times what the savings account earns, and three times the CD.
The logarithm tells the same story from the other side. At 10% a year, your money doubles in a little over 7 years (the rule of 72 says ). It grows tenfold in:
Here are all three choices side by side, along with the doubling and tenfold times.
for (double rate : {0.023, 0.06, 0.10}) {
std::println("{:4.1f}% for 30 years: {:9.2f}", rate * 100, future_value(1'000, rate, 30));
}
std::println("Doubles in {:.2f} years", years_to_target(1, 0.10, 2));
std::println("Grows tenfold in {:.2f} years", years_to_target(1, 0.10, 10)); 2.3% for 30 years: 1978.19
6.0% for 30 years: 5743.49
10.0% for 30 years: 17449.40
Doubles in 7.27 years
Grows tenfold in 24.16 years
rates = np.array([0.023, 0.06, 0.10])
for rate, value in zip(rates, future_value(1_000, rates, 30)):
print(f"{rate:5.1%} for 30 years: {value:>10,.2f}")
print(f"Doubles in {years_to_target(1, 0.10, 2):.2f} years")
print(f"Grows tenfold in {years_to_target(1, 0.10, 10):.2f} years") 2.3% for 30 years: 1,978.19
6.0% for 30 years: 5,743.49
10.0% for 30 years: 17,449.40
Doubles in 7.27 years
Grows tenfold in 24.16 years
The catch. That 10% is an average over many decades, not a promise for any single year. Some years, stocks lose money, and sometimes a lot. That’s why stocks are for goals decades away, like retirement, and not for a car you need in five years.
The same math runs a retirement account
Your grandparents’ retirement savings follow the same formula. Only the numbers are bigger. Say a retirement account holds $250,000 and grows 15% every year for 20 years:
That’s about $4.09 million. Now flip it. At 20% a year, how long until the account reaches $10,000,000? That’s 40 times the starting amount:
Growth is credited once a year in this model, so the account is still a little short after 20 years. It passes $10 million in year 21:
| Years | Value at 20% a year |
|---|---|
| 10 | $1,547,934 |
| 15 | $3,851,755 |
| 20 | $9,584,400 |
| 21 | $11,501,280 |
Look at the last rows. More than half the final balance arrives in the last four years. That’s the snowball near the bottom of the hill. The rate matters a lot too: at 15% instead of 20%, the same $10 million goal takes about 26.4 years instead of 20.2.
The round trip makes the point one last time. Feed the logarithm’s answer back into the exponent, and you land on exactly $10 million.
std::println("15% for 20 years: {:.2f}", future_value(250'000, 0.15, 20));
for (double rate : {0.15, 0.20}) {
std::println("Years to 10 million at {:.0f}%: {:.2f}",
rate * 100, years_to_target(250'000, rate, 10'000'000));
}
const double t = years_to_target(250'000, 0.20, 10'000'000);
std::println("Round trip: {:.2f}", future_value(250'000, 0.20, t));
for (int year : {10, 15, 20, 21}) {
std::println("Year {}: {:.2f}", year, future_value(250'000, 0.20, year));
}15% for 20 years: 4091634.35
Years to 10 million at 15%: 26.39
Years to 10 million at 20%: 20.23
Round trip: 10000000.00
Year 10: 1547934.11
Year 15: 3851755.39
Year 20: 9584399.98
Year 21: 11501279.98
print(f"15% for 20 years: {future_value(250_000, 0.15, 20):,.2f}")
for rate in (0.15, 0.20):
print(f"Years to 10 million at {rate:.0%}: {years_to_target(250_000, rate, 10_000_000):.2f}")
t = years_to_target(250_000, 0.20, 10_000_000)
print(f"Round trip: {future_value(250_000, 0.20, t):,.2f}")
for year in (10, 15, 20, 21):
print(f"Year {year}: {future_value(250_000, 0.20, year):,.2f}")15% for 20 years: 4,091,634.35
Years to 10 million at 15%: 26.39
Years to 10 million at 20%: 20.23
Round trip: 10,000,000.00
Year 10: 1,547,934.11
Year 15: 3,851,755.39
Year 20: 9,584,399.98
Year 21: 11,501,279.98
A steady 15% or 20% a year is a “what if,” not a promise. Stocks have had a strong year: the Dow Jones average closed above 4,000 for the first time this February. But on October 19, 1987, the same average fell 22.6% in a single day. Real returns jump around, and fees, taxes and rising prices take their share. The formula shows what a steady rate would do. It can’t tell you what the market will do.
Key takeaways
- An exponent answers “what will I have?” A logarithm answers “how long will it take?” Each one undoes the other, like folding and counting folds.
- The time to grow from to at rate is , and the power rule is what lets you solve it.
- For a goal five years away, like a first car, interest alone is far too slow. Saving more does the heavy lifting.
- For long goals like retirement, time does the heavy lifting. $1,000 at the stock market’s long-run average of about 10% a year grows to about $17,400 in 30 years.
- The rule of 72 gives a quick doubling time: at 6%, about 12 years.
Your turn
New-car prices have been rising about 3% a year. If that keeps up, how many years until today’s $10,000 economy car costs $15,000?
Show the answer
Set up , so . Take the natural log of both sides and solve:
After 13 years, the car would cost about $14,685, still under. It passes $15,000 during year 14, at about $15,126. Prices grow by the same exponent as savings, which is one more reason to start saving now.
Next time your grandparents ask you how you’ll pay for your first car, tell them this:
“My paychecks will pay for the car. Interest needs decades, so I’m starting it now.”