Sources: Wikipedia (CC BY-SA 4.0) ยท Adam Smith, Wealth of Nations (1776, public domain)
A dollar today is worth more than a dollar tomorrow. Compound interest turns this intuition into arithmetic: future value grows exponentially, present value shrinks by discounting. Every investment decision reduces to comparing present values.
Compound interest
If you invest principal P at annual rate r, compounded once per year, after t years you have FV = P(1 + r)t. Compounding more frequently (n times per year) gives FV = P(1 + r/n)nt. As n approaches infinity, you get continuous compounding: FV = Pert.
Scheme
; Compound interest: FV = P * (1 + r)^t; P = principal, r = annual rate, t = years
(define (future-value P r t)
(* P (expt (+ 1 r) t)))
; $1000 at 7% for 10, 20, 30 years
(display "10 years: $")
(display (round (future-value 10000.0710))) (newline)
(display "20 years: $")
(display (round (future-value 10000.0720))) (newline)
(display "30 years: $")
(display (round (future-value 10000.0730))) (newline)
; Rule of 72: doubling time ~ 72/r
(display "Rule of 72 doubling time at 7%: ")
(display (/ 727))
(display " years")
Python
# Compound interestdef future_value(P, r, t):
return P * (1 + r) ** t
for t in [10, 20, 30]:
fv = future_value(1000, 0.07, t)
print(str(t) + " years: $" + str(round(fv)))
# Rule of 72print("Rule of 72 doubling time at 7%: " + str(round(72/7, 1)) + " years")
Present value and discounting
Present value reverses the direction: PV = FV / (1 + r)t. The discount rate r encodes your opportunity cost. A dollar arriving in 10 years at 7% discount is worth only $0.51 today. This is the foundation of all valuation.
Scheme
; Present value: PV = FV / (1 + r)^t
(define (present-value FV r t)
(/ FV (expt (+ 1 r) t)))
; What is $1000 received in 10 years worth today?
(display "PV of $1000 in 10 years at 7%: $")
(display (round (present-value 10000.0710))) (newline)
(display "PV of $1000 in 20 years at 7%: $")
(display (round (present-value 10000.0720))) (newline)
; Higher discount rate = lower present value
(display "PV of $1000 in 10 years at 12%: $")
(display (round (present-value 10000.1210)))
Net present value
NPV sums the present values of all future cash flows, minus the initial investment. If NPV is greater than zero, the project creates value. NPV is additive: two independent projects can be evaluated separately.
# Net present valuedef npv(rate, initial_cost, cash_flows):
pv_sum = sum(cf / (1 + rate)**t for t, cf in cash_flows)
return pv_sum - initial_cost
# Project: $5000 upfront, $2000/year for 3 years
flows = [(1, 2000), (2, 2000), (3, 2000)]
print("NPV at 5%: $" + str(round(npv(0.05, 5000, flows), 2)))
print("NPV at 15%: $" + str(round(npv(0.15, 5000, flows), 2)))
Annuities
An annuity is a fixed payment C repeated for n periods. The present value of an annuity has a closed form: PV = C * (1 - (1+r)-n) / r. Mortgages, bonds, and pensions are all annuities in disguise. The connection to integrals: a continuous annuity is the integral of Ce-rt from 0 to T.
Scheme
; Annuity PV = C * (1 - (1+r)^(-n)) / r; C = payment per period, r = rate, n = periods
(define (annuity-pv C r n)
(* C (/ (- 1 (expt (+ 1 r) (- n))) r)))
; $500/month for 30 years at 6% annual (0.5% monthly)
(define monthly-pv (annuity-pv 5000.005360))
(display "PV of $500/month for 30 years: $")
(display (round monthly-pv)) (newline)
; Mortgage: what monthly payment for $300,000 loan?; C = PV * r / (1 - (1+r)^(-n))
(define (mortgage-payment PV r n)
(* PV (/ r (- 1 (expt (+ 1 r) (- n))))))
(define pmt (mortgage-payment 3000000.005360))
(display "Monthly payment on $300k mortgage: $")
(display (round pmt))
Neighbors
Cross-references
Calculus Ch.7 โ integrals: continuous discounting as integration