Sub topic 8
Working out how much to save each month
This chapter turns a goal into a monthly number. It assumes you can write a goal with a target and a deadline, and that you know your monthly surplus from your budget. It also assumes you are comfortable with percentages and exponents, and can read short Python functions. Interest is covered only as far as this calculation needs.
The calculation in one view
Every monthly savings figure comes from four inputs:
- Target: the amount you need on the deadline.
- Months: the number of deposits between now and the deadline.
- Rate: the annual interest rate the money earns.
- Starting balance: what you have already set aside.
The target should be the inflated cost if the goal is far away. Then you ask whether the result fits inside your monthly surplus. If it does not, you change the target, the deadline, or the rate you can realistically earn.
Baseline: no interest
Start with the simplest case. Divide the target by the number of months.
def monthly_saving_no_interest(target, months):
return target / months
print(round(monthly_saving_no_interest(6000, 24), 2)) # 250.0This is the right model when money sits in a cash box or an account that pays almost nothing. It is also a useful upper bound. Interest can only lower the amount you must deposit, so the no-interest figure is the most you will need.
Adding interest
If your money earns interest, each deposit grows from the day it is made. Deposits made early grow the longest. The standard future-value formula for equal deposits at the end of each month is:
FV = P × ((1 + r)^n − 1) / r
- P is the monthly deposit.
- r is the monthly rate, which is the annual rate divided by 12.
- n is the number of months.
Solving for P gives P = FV × r / ((1 + r)^n − 1). That is what the function below computes.
def monthly_contribution(target, annual_rate, months):
"""Monthly deposit (made at month end) needed to reach target."""
r = annual_rate / 12
if r == 0:
return target / months
return target * r / ((1 + r) ** months - 1)
print(round(monthly_contribution(12000, 0.04, 36), 2)) # 314.29Saving $12,000 in 36 months at 4% needs about $314.29 a month. With no interest it would need $333.33. Interest saves about $19 a month here.
The r == 0 branch matters. At a zero rate the formula divides by zero, so the code falls back to the simple division.
How much the rate matters
For the same $12,000 target over 36 months, the monthly deposit changes with the rate like this:
| Annual rate | Monthly deposit |
|---|---|
| 0% | 333.33 |
| 2% | 323.71 |
| 4% | 314.29 |
| 6% | 305.06 |
Going from 0% to 6% cuts the deposit by about $28 a month. Over a short horizon, how much you save matters far more than what you earn on it. Interest has more effect as the horizon lengthens, because the exponent n grows.
Correcting for inflation first
If the goal is years away, its price will probably rise. Use the inflated cost as the target, not today's price:
def inflated_cost(cost_today, annual_inflation, years):
return cost_today * (1 + annual_inflation) ** years
print(round(inflated_cost(20000, 0.03, 10), 2)) # 26878.33A $20,000 goal in ten years at 3% inflation becomes about $26,878. Feed that number into the contribution function. With 4% interest over 120 months, the deposit is about $182.5 a month. Without interest it would be about $224.
Skipping this step is one of the most common errors. A plan built on today's price reaches its target on schedule and still falls short of the real cost.
Accounting for money you already have
You may already hold part of the amount. That balance also grows, so you subtract its future value from the target and save only the remainder. This function combines every step so far:
def monthly_plan(cost_today, annual_inflation, annual_rate,
months, starting_balance=0.0):
"""Monthly deposit (month end) after inflation and an existing balance."""
years = months / 12
target = cost_today * (1 + annual_inflation) ** years
r = annual_rate / 12
grown_balance = starting_balance * (1 + r) ** months
remaining = max(target - grown_balance, 0)
if r == 0:
return remaining / months
return remaining * r / ((1 + r) ** months - 1)
# $12,000 goal in 36 months, 4% interest, no inflation, $2,000 saved already
print(round(monthly_plan(12000, 0.0, 0.04, 36, 2000), 2)) # 255.24The $2,000 grows to about $2,255 over three years. The deposits only need to cover the remaining $9,745. The max(..., 0) guard handles the case where the existing balance already covers the goal. Without it the function would return a negative deposit.
The emergency fund as a special target
The emergency fund is sized differently from other goals. Its target is essential monthly expenses times the months of cover you choose, commonly three to six:
def emergency_fund_target(essential_monthly_expenses, months_of_cover):
return essential_monthly_expenses * months_of_cover
print(emergency_fund_target(2400, 6)) # 14400Use essential expenses only, such as housing, food, utilities, insurance, and minimum debt payments. Do not use your full spending. Do not inflate this target over a long horizon, because you should re-measure your expenses each year. Once you have the target, run it through the same contribution functions to get a monthly figure and a deadline.
Gotchas and edge cases
- Timing of deposits. The formula assumes deposits at the end of each month. If you deposit at the start, each one earns an extra month of interest, and the required amount falls by a factor of (1 + r). In the 4% example it drops from $314.29 to about $313.25. The difference is small, so use the end-of-month figure as a slightly conservative estimate.
- Rate realism. Use a rate you can actually obtain after fees and taxes. For short-term goals held in savings accounts, rates change over time, so treat the result as an estimate and recompute when the rate moves.
- Market-linked accounts. The formula assumes a fixed rate. Investments with variable returns do not guarantee it. For goals near their deadline, use a low rate or zero so a bad year does not leave you short. The next chapters cover matching risk to horizon.
- Rounding. Round deposits up to the next whole currency unit. Rounding down leaves you slightly short at the deadline.
- Months, not years. Count months exactly. A deadline of "end of next year" may be 13 or 20 months away, depending on today's date.
- Surplus check. If the deposit exceeds your monthly surplus, the result is a signal, not an error. Lengthen the deadline, reduce the target, or rank the goal against others. Prioritization is covered later.
Putting it together
A worked sequence for a $15,000 home deposit in five years:
- Adjust for inflation if the goal's price will rise, for example a purchase tied to a market price.
- Subtract the future value of any current balance.
- Solve for the monthly deposit at a conservative rate.
- Compare it with your monthly surplus.
- Round up, then record the deposit, the assumed rate, and the date you will recheck them.
Recording the assumptions lets you review the plan later. When income, costs, or the deadline change, you update an input and run the calculation again instead of starting over.
Exercise
You want a $15,000 car in 5 years (60 months). Prices are expected to rise 2% a year, and your savings earn nothing. How much must you save each month, to the cent?
Show answer
First inflate the cost: 15000 × 1.02^5 = 15000 × 1.1040808 ≈ 16,561.21. With no interest, divide by the months: 16,561.21 / 60 ≈ 276.02 per month. In code: round(inflated_cost(15000, 0.02, 5) / 60, 2).
Exercise
Using monthly_contribution, why does the deposit for a $12,000 goal in 36 months fall from 333.33 at 0% to 305.06 at 6%, and what happens to the formula at exactly 0%?
Show answer
Interest on earlier deposits supplies part of the target, so you need to deposit less yourself. At 6% the deposits plus interest add up to 12,000 with a total deposited of about 10,982. At 0% the formula divides by zero, because (1 + r)^n − 1 equals 0. The function therefore returns target / months instead.