SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 1.5.1 SequencesConcept · 25 min
      2. 1.5.2 Arithmetic and geometric seriesConcept · 20 min
      3. 1.5.3 Infinite series and when they convergeConcept · 25 min
      4. 1.5.4 Practice set: seriesPractice set · 20 min
      5. 1.5.5 Case study: annuities, perpetuities and bond pricesCase study · 35 min

Level 1, Precalculus 1.5 Sequences and series Lesson 5 of 5

Case studyLesson 1.5.5 in Level 1, Precalculus. About 35 minutes.

Case study: annuities, perpetuities and bond prices

Cash flows on a timeline

An annuity pays the same amount CC once a period for nn periods. On a desk the first question is when each payment arrives.

A loan repayment, a bond coupon or a pension payment usually comes at the end of each period. So the first one is a full period away.

Each payment is discounted back to today, as in case study 0.2.4: a payment at time tt is worth C(1+r)t\frac{C}{(1 + r)^t} now. Here rr is the rate per period, compounded once per period, and tt counts periods.

Each arrow is a payment; the number under it is its present value. Moving every payment one period earlier, from the end of the year to the start, raises the total from 993.64 to 1,073.13.

Rate and period must match. A rate quoted as 6% a year and paid monthly means r=0.06/12=0.005r = 0.06 / 12 = 0.005 per month, over n=12×30=360n = 12 \times 30 = 360 months (case study 1.4.6). Mixing a yearly rate with monthly payments is the most common error on a desk.

An annuity is a geometric series

Add the present values of the nn payments:

PV=C1+r+C(1+r)2+⋯+C(1+r)nPV = \frac{C}{1 + r} + \frac{C}{(1 + r)^2} + \cdots + \frac{C}{(1 + r)^n}

Write v=11+rv = \frac{1}{1 + r}, the value today of $1 paid in one period. Each term is the one before times vv, so this is a geometric series (lesson 1.5.2) with first term CvCv, ratio vv and nn terms.

Its sum is Cv1−vn1−vCv\frac{1 - v^n}{1 - v}. Since 1−v=r1+r1 - v = \frac{r}{1 + r}, the front part Cv1−v\frac{Cv}{1 - v} is just Cr\frac{C}{r}, and vn=(1+r)−nv^n = (1 + r)^{-n}.

Rule: Present value of an annuity

PV=C⋅1−(1+r)−nrPV = C \cdot \frac{1 - (1 + r)^{-n}}{r}

CC is the payment each period, rr the rate per period and nn the number of payments, the first one period from now. The fraction is the annuity factor: the value today of $1 a period for nn periods.

Try it

The machine from case study 0.2.4 saves $300 a year for 4 years. At 8% the four savings are worth 277.78, 257.20, 238.15 and 220.51 today, the numbers on the timeline.

Their sum and the formula agree: $993.64, apart from rounding in the last digits.

⌘/Ctrl + Enter runs the cell

When the rate is zero

At r=0r = 0 the formula reads 00\frac{0}{0}: the ratio vv is exactly 1, the case lesson 1.5.2 warned about. Nothing is discounted, so the value is simply nCnC. Twelve payments of $100 at 0% are worth $1,200.

Zero and even slightly negative rates do happen, so pricing code needs a branch for r=0r = 0. A negative rate above −100%-100\% still works in the formula: vv is then above 1, so each payment is worth more today than its amount.

Payments at the start: the annuity due

Rent, leases and insurance premiums are usually paid in advance, at the start of each period. A stream whose first payment is today is an annuity due.

Every payment arrives one period earlier than in the ordinary annuity, so each is worth 1+r1 + r times as much. The total is too.

Rule: Annuity due

PVdue=(1+r)⋅PV=(1+r) C 1−(1+r)−nr\begin{gathered} PV_{\text{due}} = (1 + r) \cdot PV \\ = (1 + r)\, C\,\frac{1 - (1 + r)^{-n}}{r} \end{gathered}

The ordinary annuity times one extra period of growth. On the timeline, the machine's savings rise from $993.64 to $1,073.13 when they arrive at the start of each year.

Try it

annuity handles both timings and the zero rate. The middle line is the machine both ways.

The last line is a year of rent, $2,000 a month at 0.5% a month. Paid at the end of each month it is worth $23,237.86; paid in advance, $23,354.05.

⌘/Ctrl + Enter runs the cell

In code, the two timings differ only in where the sum starts. The end of each period is range(1, n + 1); the start is range(0, n). An off-by-one there is a real pricing error, not a rounding one.

Perpetuities: the annuity that never stops

A perpetuity pays CC every period for ever. Its value is the limit of the annuity as nn grows. When r>0r > 0, the ratio vv is below 1, so vn=(1+r)−n→0v^n = (1 + r)^{-n} \to 0 (lesson 1.5.1) and the infinite geometric series of lesson 1.5.3 converges.

Rule: Perpetuity

PV=Cr(r>0)PV = \frac{C}{r} \qquad (r > 0)

The annuity formula with (1+r)−n(1 + r)^{-n} gone. $5 a year for ever at 4% is worth 50.04=125\frac{5}{0.04} = 125 today: far-off payments are worth almost nothing, so an endless stream has a finite price.

years of payments nn1030100500for ever
value of $5 a year at 4%40.5586.46122.52125.00125

How many years does it take to get within 1% of the perpetuity? The annuity is Cr\frac{C}{r} times 1−(1.04)−n1 - (1.04)^{-n}, so it falls short by the fraction (1.04)−n(1.04)^{-n}. Solve (1.04)−n<0.01(1.04)^{-n} < 0.01 as in lesson 1.5.3: n>ln⁡100ln⁡1.04≈117.4n > \frac{\ln 100}{\ln 1.04} \approx 117.4, so 118 years.

Turning this round explains the annuity formula. An nn-period annuity is a perpetuity starting now minus one whose first payment is in period n+1n + 1.

The second is worth Cr\frac{C}{r} at time nn, so Cr(1+r)−n\frac{C}{r}(1 + r)^{-n} today. For $5 at 4% over 10 years, 125−125×1.04−10=40.55125 - 125 \times 1.04^{-10} = 40.55.

A growing perpetuity, and when it breaks

If the payment grows by a fraction gg each period, the terms are C1+r,C(1+g)(1+r)2,…\frac{C}{1 + r}, \frac{C(1 + g)}{(1 + r)^2}, \ldots: a geometric series with ratio 1+g1+r\frac{1 + g}{1 + r}. It converges only when that ratio is below 1, that is when g<rg < r.

Rule: Growing perpetuity

PV=Cr−g(g<r)PV = \frac{C}{r - g} \qquad (g < r)

CC is the first payment, one period from now. $5 growing 2% a year at 6% is worth 50.06−0.02=125\frac{5}{0.06 - 0.02} = 125.

When g≥rg \ge r the series diverges, exactly as lesson 1.5.3 found for a ratio of 1 or more. The formula does not warn you: with g=7%g = 7\% it returns 5−0.01=−500\frac{5}{-0.01} = -500, a negative price for positive payments.

Analysts using this formula to value shares check g<rg < r first. For the same reason, a level perpetuity has no finite value at a zero or negative rate.

Try it

The first loop rebuilds the table. The next lines give the 117.4 years and the annuity as the difference of two perpetuities.

The last line prints the growing-perpetuity formula and a direct sum over 5,000 years, both 125, then the formula with g=7%g = 7\%.

⌘/Ctrl + Enter runs the cell
Check yourself
Which is worth more today at 5% a year: $100 a year for ever, or $150 a year for 20 years?

Bond prices

A bond pays a coupon cc (in dollars, once a year) and repays its face value FF after TT years. So it is an annuity of coupons plus one final payment. Case study 1.3.5 added the payments one by one; the annuity factor does the coupons in one step.

Discount both at the bond's yield yy:

P(y)=∑t=1Tc(1+y)t+F(1+y)T=c 1−(1+y)−Ty+F(1+y)T\begin{aligned} P(y) &= \sum_{t=1}^{T} \frac{c}{(1 + y)^t} + \frac{F}{(1 + y)^T} \\ &= c\,\frac{1 - (1 + y)^{-T}}{y} + \frac{F}{(1 + y)^T} \end{aligned}

The 5-year 4% bond pays $4 a year on $100 of face value. At a 5% yield its coupons are worth 17.32 and its face value 78.35, so its price is 95.67, as in case study 1.3.5. Prices are quoted per 100 of face value.

At, above and below par

The coupon rate is cF\frac{c}{F}, here 4%. When the yield equals the coupon rate, c=yFc = yF, so the coupon part is F(1−(1+y)−T)F\big(1 - (1 + y)^{-T}\big). Adding the face part F(1+y)−TF(1 + y)^{-T} leaves exactly FF: the bond is priced at par, whatever its maturity.

Rule: Par, premium and discount

y<cF: P>F (premium)y=cF: P=F (par)y>cF: P<F (discount)\begin{gathered} y < \tfrac{c}{F}: \ P > F \ \text{(premium)} \\ y = \tfrac{c}{F}: \ P = F \ \text{(par)} \\ y > \tfrac{c}{F}: \ P < F \ \text{(discount)} \end{gathered}

A bond paying more than the market's yield is worth more than its face value, and the reverse. The yield that prices a bond at par is its par yield; case study 1.6.4 builds a curve from them.

yield yy0%2%3%4%5%6%
5-year 4% bond120.00109.43104.58100.0095.6791.58

At a 0% yield nothing is discounted, so the price is the plain total of the payments, 5×4+100=1205 \times 4 + 100 = 120. That is the zero-rate branch again.

Every 4% bond is at par when the yield is 4%. Below that yield it trades at a premium, above it at a discount, and the longer bond swings further both ways.

The curve falls as the yield rises, and it bends upwards. Case study 2.2.4 measures how fast it falls, the bond's duration, using this formula.

Two desk conventions

Pull to par. As a bond nears maturity its price moves towards face value. At a 5% yield the 4% bond is worth 92.28 with 10 years left, 95.67 with 5, 98.14 with 2 and 99.05 with 1. At maturity it repays exactly 100, with its last coupon.

Semi-annual coupons. Many government and corporate bonds pay half the coupon every six months. Then the coupon is c2\frac{c}{2}, the rate per period is y2\frac{y}{2} and there are 2T2T periods. The 5-year 4% bond at a 5% yield, priced this way, is worth 95.62 instead of 95.67.

Try it

bond_price is the annuity of coupons plus the discounted face value, with the zero-yield branch. The first loop rebuilds the table, rounded to cents.

Then come the payment-by-payment sum at 5%, the pull to par, and the semi-annual price: coupon 2, rate 2.5% and 10 periods.

⌘/Ctrl + Enter runs the cell
Check yourself
A 5-year bond pays a 3% coupon, and similar bonds yield 4%. How is it priced?

Solving for the payment

A loan is an annuity seen from the lender's side: the amount lent is the present value of the payments. Rearrange the annuity formula for CC (lesson 0.3.2).

Rule: Loan payment

C=PV⋅r1−(1+r)−nC = PV \cdot \frac{r}{1 - (1 + r)^{-n}}

For the mortgage, PV=300,000PV = 300{,}000, the monthly rate is r=0.005r = 0.005 and there are n=360n = 360 payments. At r=0r = 0 the payment is just PVn\frac{PV}{n}: $12,000 over 24 months is $500 a month.

Each payment first covers the month's interest on what is still owed; the rest repays the loan. The balance at any time is the present value of the payments still to come. After 10 years, 240 payments remain, worth $251,057.17: about 84% of the loan is still owed after a third of the term.

Try it

The payment is $1,798.65 a month. Times 360 that is $647,514.57, of which $347,514.57 is interest.

The first payment is $1,500.00 of interest and only $298.65 of repayment. The last line is the balance after 10 years and its share of the loan.

⌘/Ctrl + Enter runs the cell
Exercise

Annuities, loans and bonds

Write three functions. Rates are per period, as decimals.

  1. annuity_pv(payment, rate, periods, due=False) returns the present value of periods equal payments. With due=True the first payment is today. Handle rate == 0.
  2. loan_payment(principal, rate, periods) returns the payment that repays principal, also at a zero rate.
  3. bond_price(coupon, face, years, y) returns the price of a bond with yearly coupons at yield y, using the annuity formula.

The tests check each one against a direct sum, at par, above and below it, and at a zero rate.

See the tests
def test_annuity_matches_sum():
    """$300 a year for 4 years at 8% matches the direct sum, about $993.64"""
    direct = sum(300 / 1.08**t for t in range(1, 5))
    expect_close(annuity_pv(300, 0.08, 4), direct, what="annuity_pv(300, 0.08, 4)")


def test_annuity_due():
    """Paid at the start of each year instead, the same $300 is worth about $1,073.13"""
    direct = sum(300 / 1.08**t for t in range(0, 4))
    expect_close(annuity_pv(300, 0.08, 4, due=True), direct, what="annuity_pv(300, 0.08, 4, due=True)")


def test_annuity_zero_rate():
    """At a 0% rate, 12 payments of $100 are worth $1,200"""
    expect_close(annuity_pv(100, 0, 12), 1200.0, what="annuity_pv(100, 0, 12)")


def test_long_annuity_near_perpetuity():
    """$5 a year for 500 years at 4% is within a cent of the perpetuity, $125"""
    expect_close(annuity_pv(5, 0.04, 500), 125.0, what="annuity_pv(5, 0.04, 500)", abs_tol=0.01, rel=0)


def test_mortgage_payment():
    """A $300,000 loan at 0.5% a month for 360 months costs about $1,798.65 a month"""
    expect_close(loan_payment(300_000, 0.005, 360), 1798.6515754582708, what="loan_payment(300000, 0.005, 360)")


def test_payment_repays_loan():
    """The payments' present value equals the amount borrowed"""
    pay = loan_payment(20_000, 0.004, 60)
    expect_close(sum(pay / 1.004**t for t in range(1, 61)), 20_000, what="present value of your payments")


def test_loan_zero_rate():
    """At a 0% rate, $12,000 over 24 months costs $500 a month"""
    expect_close(loan_payment(12_000, 0, 24), 500.0, what="loan_payment(12000, 0, 24)")


def test_bond_at_par():
    """A 4% bond at a 4% yield is priced at its face value, 100"""
    expect_close(bond_price(4, 100, 5, 0.04), 100.0, what="bond_price(4, 100, 5, 0.04)")


def test_bond_matches_sum():
    """The 5-year 4% bond at 5% matches the payment-by-payment sum, about 95.67"""
    direct = sum(4 / 1.05**t for t in range(1, 6)) + 100 / 1.05**5
    expect_close(bond_price(4, 100, 5, 0.05), direct, what="bond_price(4, 100, 5, 0.05)")


def test_bond_premium():
    """At a 3% yield the same bond trades above par, at about 104.58"""
    direct = sum(4 / 1.03**t for t in range(1, 6)) + 100 / 1.03**5
    expect_close(bond_price(4, 100, 5, 0.03), direct, what="bond_price(4, 100, 5, 0.03)")


def test_bond_zero_yield():
    """At a 0% yield the price is the plain total of the payments, 120"""
    expect_close(bond_price(4, 100, 5, 0), 120.0, what="bond_price(4, 100, 5, 0)")

Summary card

  • An annuity is a geometric series with ratio v=11+rv = \frac{1}{1 + r}: PV=C1−(1+r)−nrPV = C\frac{1 - (1 + r)^{-n}}{r}, first payment one period away, rate and count per period. At r=0r = 0, PV=nCPV = nC.
  • An annuity due (first payment today) is worth 1+r1 + r times as much.
  • A perpetuity is the limit as n→∞n \to \infty: PV=CrPV = \frac{C}{r} for r>0r > 0. Growing at gg: Cr−g\frac{C}{r - g}, only when g<rg < r.
  • A bond is an annuity of coupons plus the discounted face value. Yield below the coupon rate: premium; equal: par; above: discount.
  • A loan payment rearranges the annuity formula: C=PVr1−(1+r)−nC = PV\frac{r}{1 - (1 + r)^{-n}}. The balance is the value of the payments still to come.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.