Sub topic 7
Uneven cash flows, NPV and IRR
This chapter assumes you can discount a single cash flow, PV = FV / (1 + r)^t, and that you know what an annuity is. Annuity formulas break down when payments differ in size, so here you value each payment on its own and add the results. That sum is the net present value (NPV). The internal rate of return (IRR) is the discount rate that makes the NPV zero.
Valuing uneven cash flows
A cash flow stream lists the amount received or paid at each date. Outflows are negative and inflows are positive. Time 0 is today, so the cash flow at time 0 is not discounted. Each later cash flow is discounted by (1 + r)^t.
For cash flows CF0, CF1, ..., CFn and discount rate r:
NPV = CF0 + CF1/(1+r) + CF2/(1+r)^2 + ... + CFn/(1+r)^nNPV is the present value of the inflows minus the present value of the outflows. A positive NPV means the project earns more than the required return. The extra value is measured in today's currency. The discount rate is the required return or opportunity cost from earlier in the tutorial.
Take a project with cash flows of -100 now, then 10, 10 and 110 at the end of years 1, 2 and 3. At a discount rate of 8%:
| Time | Cash flow | Discount factor at 8% | Present value |
|---|---|---|---|
| 0 | -100 | 1.0000 | -100.00 |
| 1 | 10 | 0.9259 | 9.26 |
| 2 | 10 | 0.8573 | 8.57 |
| 3 | 110 | 0.7938 | 87.32 |
The present values sum to about 5.15, so the NPV is positive.
Computing NPV and IRR in code
The function below discounts each cash flow with its list position as the time index. The IRR search uses bisection. It starts with a rate where NPV is positive and one where it is negative, then repeatedly halves the interval.
def npv(rate, cash_flows):
return sum(cf / (1 + rate) ** t for t, cf in enumerate(cash_flows))
def irr(cash_flows, low=0.0, high=1.0, tolerance=1e-10):
# Bisection: assumes NPV is positive at `low` and negative at `high`.
while high - low > tolerance:
mid = (low + high) / 2
if npv(mid, cash_flows) > 0:
low = mid
else:
high = mid
return (low + high) / 2
flows = [-100, 10, 10, 110]
print(round(npv(0.08, flows), 2)) # 5.15
print(round(irr(flows), 4)) # 0.1The IRR is 10%. This stream is a 3-year, 10% coupon bond bought at par, so the result makes sense. Its yield equals its coupon rate when the price equals face value.
What IRR means
The IRR is the rate r that solves:
0 = CF0 + CF1/(1+r) + CF2/(1+r)^2 + ... + CFn/(1+r)^nYou cannot solve this algebraically for more than a few periods. On the exam you use the financial calculator's cash flow worksheet. In practice you use a spreadsheet function or a numerical search like the one above.
The decision rules for a single, stand-alone project are:
- Accept if NPV is greater than 0.
- Accept if IRR is greater than the required rate of return.
- Reject if NPV is below 0 or IRR is below the required rate.
For a conventional project, one outflow followed by inflows, the two rules give the same answer. At 8% the example has NPV of 5.15 and IRR of 10%, which is above 8%. Both rules accept it.
Where NPV and IRR disagree
The two measures can give different rankings. This happens in two situations that the exam tests.
Mutually exclusive projects of different size
Mutually exclusive projects are alternatives where you can pick only one. NPV measures value added in currency units. IRR measures a percentage return and ignores scale. Consider two one-year projects with a required return of 10%:
- Project X: pay 100 now, receive 130 in one year.
- Project Y: pay 1,000 now, receive 1,200 in one year.
def npv(rate, cash_flows):
return sum(cf / (1 + rate) ** t for t, cf in enumerate(cash_flows))
def irr(cash_flows, low=0.0, high=1.0, tolerance=1e-10):
while high - low > tolerance:
mid = (low + high) / 2
if npv(mid, cash_flows) > 0:
low = mid
else:
high = mid
return (low + high) / 2
x = [-100, 130]
y = [-1000, 1200]
print(round(npv(0.10, x), 2), round(irr(x), 4)) # 18.18 0.3
print(round(npv(0.10, y), 2), round(irr(y), 4)) # 90.91 0.2X has the higher IRR (30% against 20%). Y has the higher NPV (90.91 against 18.18). Y adds more wealth, so you choose Y. When NPV and IRR conflict for mutually exclusive projects, follow NPV.
The same conflict can come from timing. A project with large cash flows late in its life can have a lower IRR but a higher NPV at low discount rates.
Non-conventional cash flows
A non-conventional project has more than one sign change in its cash flows. An example is an outflow, then inflows, then another outflow for cleanup or restoration costs. Such a project can have several IRRs, or none.
Take the stream -100, +260, -165. Solving the quadratic gives two IRRs, 10% and 50%. The code below shows the NPV at several rates.
def npv(rate, cash_flows):
return sum(cf / (1 + rate) ** t for t, cf in enumerate(cash_flows))
flows = [-100, 260, -165]
for r in [0.0, 0.1, 0.3, 0.5, 1.0]:
print(r, round(npv(r, flows), 2) + 0)| Rate | NPV |
|---|---|
| 0.0 | -5.0 |
| 0.1 | 0.0 |
| 0.3 | 2.37 |
| 0.5 | 0.0 |
| 1.0 | -11.25 |
NPV is positive only between 10% and 50%. An IRR above or below the required return no longer tells you whether to accept. The bisection function above assumes one sign change, and it would return an arbitrary one of these roots or a wrong answer. NPV remains well-defined whenever you pick the discount rate, so use it.
Common errors
- Discounting the time-0 cash flow. It sits at
t = 0, so its factor is 1. - Wrong timing index. With
enumerate, the first list item is time 0. If your first payment is at the end of year 1, put a 0 at the start of the list. - Mixing period lengths and rates. If cash flows are semiannual, the discount rate and the IRR are per half-year. Convert an annual figure using the rules from the compounding chapters.
- Treating a periodic IRR as an annual rate. A semiannual IRR of 4% is a stated annual rate of 8%, not an effective annual rate.
- Ranking by IRR when the projects conflict. Use NPV for mutually exclusive projects.
- Forgetting the sign convention. Outflows must be negative. If every cash flow has the same sign, no IRR exists.
Exercise
A project costs 500 today and pays 200 at the end of year 1, 250 at the end of year 2 and 300 at the end of year 3. Using a 10% discount rate, is NPV positive or negative? Should you accept? Round the NPV to the nearest whole number.
Show answer
PV of inflows = 200/1.10 + 250/1.21 + 300/1.331 = 181.82 + 206.61 + 225.39 = 613.82. NPV = 613.82 - 500 = 113.82, about 114. NPV is positive, so accept. The IRR must exceed 10%.
Exercise
Project A has an IRR of 25% and an NPV of 40 at the required return. Project B has an IRR of 18% and an NPV of 75. They are mutually exclusive. Which do you choose, and why?
Show answer
Choose B. For mutually exclusive projects, NPV is the correct criterion because it measures the total value added. IRR ignores project size and timing, so it can rank projects wrongly.
Exercise
A cash flow stream has the pattern -, +, -. Why can IRR be an unreliable decision rule here?
Show answer
With more than one sign change, the NPV equation can have multiple solutions, or none. Each IRR is a valid root, so comparing one of them with the required return does not reliably show whether NPV is positive. Use NPV at the required return instead.