Why Differentiate the NPV Function?
A yield change affects the present value of every dated cash flow, but not every cash flow is affected equally. A payment farther in the future generally has greater sensitivity to the discount rate than an otherwise comparable payment arriving sooner. Modified duration summarizes the local percentage sensitivity of value to a yield change. It comes directly from differentiating the NPV function, so its meaning and assumptions can be seen in the calculation rather than memorized as a separate rule.
This tutorial considers fixed cash flows: their amounts and payment dates do not change when yields move. The yield shift is parallel, meaning that the same absolute change is applied to each relevant annual effective spot rate. This is not a calculation for a nonparallel curve movement, nor does it model cash flows that change in response to rates.
A cash flow at time 0, if present, is included as a constant term \(C_0\). It is not discounted and has zero derivative with respect to the yield shift. Cash flows may be positive or negative, as in a project NPV. However, the percentage-sensitivity ratio below requires \(P(0)\ne 0\); it is most naturally interpreted as price duration when value is positive and the discounted cash flows are positive.
Deriving Modified Duration
For each maturity, differentiate its present value with respect to the common shift. The derivative of \((1+z_j+\varepsilon)^{-t_j}\) is \(-t_j(1+z_j+\varepsilon)^{-t_j-1}\). Summing the derivatives gives the slope of the full NPV function.
At the current curve, set \(\varepsilon=0\). The negative sign reflects the usual direction for an asset with positive future cash flows: increasing yields reduces present value. Modified duration is defined as the negative derivative divided by current value.
The approximation is local: the derivative gives the slope at the starting curve. It does not claim that the NPV function is a straight line over a large yield change. The rate change must be entered in decimal form. For example, a 25-basis-point increase is \(0.0025\), not \(0.25\) or \(25\).
The Flat-Yield Case
When every maturity is discounted at the same annual effective yield \(y\), the NPV is \(P(y)=\sum_j C_j(1+y)^{-t_j}\). Differentiating with respect to \(y\) gives the standard flat-yield modified duration formula. If all future cash flows are positive, Macaulay duration is the present-value-weighted average payment time.
The division by \(1+y\) follows because each derivative term has one additional factor of \((1+y)^{-1}\) compared with the corresponding present-value term. Under a nonflat spot curve, each maturity has its own \(z_j\), so there is generally no single \(1+y\) by which to divide a single Macaulay duration. Use the general derivative formula instead.
Worked Example: Flat-Yield Duration and Exact Repricing
A hypothetical bond pays $110 at the end of year 1 and $242 at the end of year 2. Its annual effective yield is 10%. Calculate its value and modified duration, estimate the price effect of a one-percentage-point yield increase, and check that estimate by exact repricing. Use annual compounding and fixed payments.
Method. Calculate the present value of each payment, differentiate the flat-yield NPV, and then compare the derivative estimate with the exact value at 11%. This avoids treating a local sensitivity estimate as an exact price change.
At \(y=0.10\), the year-1 payment has present value \(110/1.10=100\). The year-2 payment has present value \(242/(1.10)^2=242/1.21=200\). Therefore,
The derivative is the negative sum of each present value multiplied by its payment time and divided by \(1+y\):
Thus \(D_{\mathrm{mod}}=-P'(0.10)/P(0.10)=454.545455/300=1.5151515\) years. Equivalently, \(D_{\mathrm{Mac}}=(1(100)+2(200))/300=500/300=1.6666667\), and \(D_{\mathrm{Mac}}/(1.10)=1.5151515\).
For a yield increase of \(\Delta y=0.01\), the local estimate is
For the exact check, discount both payments at 11%. The first present value is \(110/1.11\approx99.0991\). Since \((1.11)^2=1.2321\), the second is \(242/1.2321\approx196.4126\). Therefore \(P(0.11)\approx99.0991+196.4126=295.5117\), and the exact change is approximately \(295.5117-300=-4.4883\). Rounded to the nearest cent, the new value is $295.51 and the change is \(-$4.49\). The exact change differs from the local estimate because the NPV slope changes as the yield moves. The calculations confirm that value falls when yield rises, while the derivative estimate is an approximation rather than exact repricing.
Applying the Derivative to a Nonflat Spot Curve
For a nonflat curve, the NPV is discounted at the spot rate matching each payment’s maturity. A parallel shift adds the same \(\varepsilon\) to every spot rate; it does not replace the curve with one flat rate. The derivative weights each payment using its own current discount factor and spot rate. This is a single parallel-shift sensitivity, not a decomposition of sensitivity by maturity.
Worked Example: Sensitivity Under Two Spot Rates
A hypothetical liability pays $104 at the end of year 1 and $220.50 at the end of year 2. The annual effective one-year spot rate is 4%, and the two-year spot rate is 5%. Calculate current value and modified sensitivity to a parallel increase of one percentage point, then check by exact repricing.
Method. First find each payment’s present value under its maturity-specific spot rate. Differentiate both terms with respect to the same parallel shift. The key trap is to use the two-year spot rate for the year-1 payment, or to apply the shift to only one maturity.
At the current curve, the present values are \(104/1.04=100\) and \(220.50/(1.05)^2=220.50/1.1025=200\). The current value is \(P(0)=300\). The derivative at zero shift is
Therefore, \(D_{\mathrm{mod}}=477.106227/300=1.5903541\). A parallel increase of \(0.01\) gives the local estimate \(\Delta P\approx-(300)(1.5903541)(0.01)=-4.771062\).
For exact repricing, the shifted rates are 5% for year 1 and 6% for year 2. Thus,
The exact change is \(295.291834-300=-4.708166\). This is close to, but not identical to, the derivative estimate of \(-4.771062\). Both calculations show a decrease in value. The method respects the original nonflat curve and shifts each maturity rate by the same absolute one percentage point.
NPV Sensitivity Is Not Always Asset-Price Duration
For a project, the NPV may include an initial outlay and later receipts. The initial outlay is a time-0 cash flow, so its derivative with respect to the yield is zero. If the NPV is small relative to the present value of the later cash flows, dividing its derivative by NPV can produce a large percentage-sensitivity ratio. That ratio is mathematically defined when NPV is nonzero, but it should not be mistaken for the duration of a positive-valued bond or asset.
Worked Example: Separating the Initial Outlay from Rate Sensitivity
A hypothetical project costs $450 immediately and pays $220 at the end of year 1 and $363 at the end of year 2. Use a flat annual effective yield of 10%. Find the project NPV and its derivative, then estimate and check the NPV change if the yield rises to 11%.
Method. Keep the time-0 outlay in the NPV, but differentiate only the discounted future receipts. This avoids incorrectly assigning yield sensitivity to the initial payment.
At 10%, the receipts have present values \(220/1.10=200\) and \(363/(1.10)^2=363/1.21=300\). Hence \(P(0.10)=-450+200+300=50\). The derivative is
The signed percentage sensitivity is \(-P'(0.10)/P(0.10)=727.272727/50=14.5454545\). The NPV estimate for a \(0.01\) yield increase is \(\Delta P\approx(-727.272727)(0.01)=-7.272727\), so estimated NPV is \(50-7.272727=42.727273\).
At 11%, exact NPV is
The exact NPV change is \(42.817141-50=-7.182859\), which differs from the derivative estimate, as expected for a finite shift. The ratio is large because the starting NPV is only $50, while the discounted receipts total $500. If the starting NPV were zero, this percentage-sensitivity ratio would be undefined, although the derivative of NPV could still be calculated.
Common Errors and a Reliable Calculation Sequence
The most common errors are sign errors, inconsistent rate units, and using a duration ratio outside the conditions that give it a useful percentage interpretation. A direct NPV derivative is a good check: for positive future payments, the derivative should be negative.
- Dropping the negative sign. For positive future payments, \(dP/dy<0\). Modified duration is defined as \(-P'(y)/P(y)\), so it is positive when price is positive.
- Using a percentage-point number as a decimal rate. A 1% increase is \(0.01\). Multiplying by \(1\) instead estimates the effect of a 100-percentage-point change.
- Using one flat rate on a nonflat curve. Under maturity-specific spot rates, discount each payment at its own rate and differentiate with respect to the common shift.
- Counting a time-0 cash flow as rate-sensitive. Its present value is constant with respect to yield, so its derivative is zero.
- Calling every NPV ratio an asset duration. If cash flows have mixed signs, or NPV is zero or negative, the usual positive-asset interpretation may fail. Inspect the cash-flow signs and denominator.
- Treating the estimate as exact. The derivative gives local sensitivity. For a finite rate change, exact repricing uses the shifted rates in the original NPV formula.
List each fixed payment, its time, and the spot rate used to discount it. Include any time-0 cash flow without discounting.
For a parallel shift, add the same decimal amount to each maturity-specific annual effective spot rate.
Differentiate each discounted term, then evaluate at zero shift to obtain the current NPV slope.
Divide the negative slope by current value only when the denominator is nonzero. Estimate a small change with duration, and use exact repricing to check a finite shift.
Check Your Understanding
For each problem, use fixed cash flows and annual effective rates. Treat any stated curve shift as parallel and report duration to four decimal places where requested.
- A payment of $108 at year 1 and $233.28 at year 2 is discounted at a flat annual effective yield of 8%. Find the current price, modified duration, and the local dollar change for a 0.01 increase in yield. (Answer: Price $300; modified duration 1.5432; estimated change \(-$4.63\).)
- A hypothetical note pays $132.30 at year 2, and its flat annual effective yield is 5%. Find its price and modified duration, then estimate the percentage price change for a 0.0025 increase in yield. (Answer: Price $120; modified duration 1.9048; estimated percentage change \(-0.4762\%\).)
- A liability pays $103 at year 1 and $178.6524 at year 3. Its annual effective spot rates are 3% at year 1 and 6% at year 3. Find its current value and modified sensitivity to a parallel 0.01 shift. (Answer: Value $250; modified sensitivity 2.0865; estimated value change \(-$5.22\).)
- A project has an immediate cost of $600 and receipts of $330 at year 1 and $399.30 at year 2. At a flat annual effective yield of 10%, find the NPV, its derivative with respect to yield, and the local NPV change for a 0.01 increase. (Answer: NPV $30; derivative \(-$872.73\) per unit yield; estimated change \(-$8.73\).)
- An asset has current price $840 and modified duration 4.25 under a flat annual effective yield. Estimate the dollar price change for a yield decrease of 0.0025. (Answer: Estimated increase of $8.93.)