Unit 1, lesson 5

Multivariable calculus and Taylor expansions

Defines partial derivatives, gradients and Hessians of a value function, derives the second-order Taylor expansion with its integral remainder, and shows why price sensitivities fail at a payoff kink.

  • Video 5
  • Calculus, linear algebra, optimization and probability

The value of a position depends on several inputs at once, such as rates, a volatility and an underlying price, and a risk report lists its slopes and curvatures. When two inputs move together, how much does the value change, and when can that estimate be trusted? This lesson defines partial derivatives, gradients and Hessians of a specified value function, derives the second-order Taylor expansion with its exact integral remainder along a segment, and shows how a payoff kink breaks the hypothesis behind the expansion.

Key terms

Partial derivative and gradient

Definition Let VV be a real-valued function on an open set U⊆RdU \subseteq \mathbb{R}^d, let x∈Ux \in U and let eie_i be the iith coordinate vector. The partial derivative of VV with respect to coordinate ii at xx is

∂iV(x)=lim⁡s→0V(x+sei)−V(x)s\begin{aligned} &\partial_i V(x) \\[0.4em] &= \lim_{s \to 0} \frac{V(x + s e_i) - V(x)}{s} \end{aligned}

when the limit exists, with all other coordinates held fixed. The function is differentiable at xx if some vector g∈Rdg \in \mathbb{R}^d satisfies

V(x+h)−V(x)−g⊤h=o(∥h∥)as h→0,\begin{aligned} &V(x + h) - V(x) - g^{\top} h \\[0.4em] &\quad = o(\lVert h \rVert) \quad \text{as } h \to 0, \end{aligned}

meaning that the left side divided by ∥h∥\lVert h \rVert tends to 00. Then all partial derivatives exist and gg is the gradient

∇V(x)=(∂1V(x),…,∂dV(x))⊤,\begin{aligned} &\nabla V(x) \\[0.4em] &= \bigl(\partial_1 V(x), \dots, \partial_d V(x)\bigr)^{\top}, \end{aligned}

and for every vector hh the directional derivative DhV(x)=lim⁡s→0(V(x+sh)−V(x))/sD_h V(x) = \lim_{s \to 0} \bigl(V(x + sh) - V(x)\bigr)/s exists and equals ∇V(x)⊤h\nabla V(x)^{\top} h. If all partial derivatives exist and are continuous on UU, then VV is differentiable at every point of UU. Partial derivatives that merely exist at a point do not guarantee differentiability there.

In plain words A partial derivative is the slope of the value when one input moves and every other input stays put. The gradient collects these slopes. When the function is differentiable, a small joint move changes the value by about the sum of each input change times its slope, with an error that is small compared with the size of the move.

Example Take the constructed value function V(x1,x2)=x12+2x1x2+3x22V(x_1, x_2) = x_1^2 + 2x_1x_2 + 3x_2^2, in currency units, of two abstract risk factors. Holding x2x_2 fixed gives ∂1V=2x1+2x2\partial_1 V = 2x_1 + 2x_2, and holding x1x_1 fixed gives ∂2V=2x1+6x2\partial_2 V = 2x_1 + 6x_2. At x=(1,2)x = (1, 2) the value is 1+4+12=171 + 4 + 12 = 17 and the gradient is (6,14)(6, 14). For the joint move h=(0.1,−0.2)h = (0.1, -0.2) the directional derivative is 0.6−2.8=−2.20.6 - 2.8 = -2.2, so the first-order estimate of the new value is 17−2.2=14.817 - 2.2 = 14.8.

Price sensitivity

Definition A price sensitivity is a derivative of a specified value function at a specified base point, in a specified direction of the inputs, with a stated rule for which other inputs are held fixed and a stated unit for the move. The sensitivity to input ii alone is ∂iV(x)\partial_i V(x), and the sensitivity to a joint move in direction uu, such as a parallel shift u=1u = \mathbf{1} of several rates, is DuV(x)=∇V(x)⊤uD_u V(x) = \nabla V(x)^{\top} u. If another input is recalibrated together with the quoted one, say x2=c(x1)x_2 = c(x_1) for a differentiable calibration map cc, and VV is differentiable, the sensitivity along the calibration is the total derivative

ddx1V(x1,c(x1))=∂1V+∂2V c′(x1),\begin{aligned} &\frac{d}{dx_1} V\bigl(x_1, c(x_1)\bigr) \\[0.4em] &= \partial_1 V + \partial_2 V \, c'(x_1), \end{aligned}

with both partial derivatives evaluated at (x1,c(x1))\bigl(x_1, c(x_1)\bigr), and it differs from the partial derivative whenever the second term is nonzero. A derivative with respect to a rate in decimal units is a change per unit of the rate, so the first-order change for a move of one percentage point is 0.010.01 times it and for one basis point 0.00010.0001 times it. Multiplying a sensitivity by a move gives a first-order approximation, not the exact change.

In plain words A sensitivity is a number attached to a function, a point, a direction and a unit. Change any of these and the number changes, so two reports can give different sensitivities for the same position without either being wrong, because they answer different questions.

Example A zero-coupon bond that pays 100100 currency units in τ=5\tau = 5 years, valued at a continuously compounded rate rr, is worth V(r)=100e−5rV(r) = 100e^{-5r}. At r=0.03r = 0.03 the value is about 86.07186.071 and V′(r)=−5V(r)≈−430.35V'(r) = -5V(r) \approx -430.35 currency units per unit of rr. The first-order change is about −4.3035-4.3035 for a rise of one percentage point and about −0.0430-0.0430 for a rise of one basis point, against exact changes of about −4.1977-4.1977 and −0.0430-0.0430. For the quadratic VV of the previous card, if a calibration rule keeps x2=2x1x_2 = 2x_1, the total derivative at x1=1x_1 = 1 is 6+2⋅14=346 + 2 \cdot 14 = 34, while the partial derivative is 66.

Hessian matrix

Definition Let VV be twice continuously differentiable on an open set U⊆RdU \subseteq \mathbb{R}^d. The Hessian matrix of VV at x∈Ux \in U is the d×dd \times d matrix with entries

Hij(x)=∂i∂jV(x).H_{ij}(x) = \partial_i \partial_j V(x) .

Because the second partial derivatives are continuous, the mixed partial derivatives agree (Schwarz’s theorem), so H(x)H(x) is symmetric. A diagonal entry HiiH_{ii} is the curvature of VV along coordinate ii, and an off-diagonal entry HijH_{ij} measures how the slope in coordinate ii changes when coordinate jj moves. In the quadratic form

h⊤Hh=∑iHiihi2+2∑i<jHijhihj\begin{aligned} h^{\top} H h &= \sum_{i} H_{ii} h_i^2 \\[0.4em] &\quad + 2 \sum_{i < j} H_{ij} h_i h_j \end{aligned}

each interaction appears twice, once for each order of the two coordinates. The entry HijH_{ij} carries value units divided by the units of inputs ii and jj, so every term HijhihjH_{ij} h_i h_j is in value units.

In plain words The Hessian records how the gradient itself changes. Its diagonal says whether the value bends up or down along each input, and its off-diagonal entries say how strongly two inputs interact. When they interact, the effect of moving both at once is not the sum of the effects of moving each alone.

Example For V(x1,x2)=x12+2x1x2+3x22V(x_1, x_2) = x_1^2 + 2x_1x_2 + 3x_2^2, differentiating the gradient entries again gives the constant Hessian

H=[2226].H = \begin{bmatrix} 2 & 2 \\ 2 & 6 \end{bmatrix}.

For h=(0.1,−0.2)h = (0.1, -0.2) the quadratic form is

h⊤Hh=2(0.1)2+6(−0.2)2+2⋅2(0.1)(−0.2)=0.02+0.24−0.08=0.18.\begin{aligned} h^{\top} H h &= 2(0.1)^2 + 6(-0.2)^2 \\[0.4em] &\quad + 2 \cdot 2(0.1)(-0.2) \\[0.4em] &= 0.02 + 0.24 - 0.08 \\[0.4em] &= 0.18 . \end{aligned}

Counting the interaction only once would give 0.220.22 in place of 0.180.18.

Second-order Taylor expansion

Definition Let VV be twice continuously differentiable on an open set U⊆RdU \subseteq \mathbb{R}^d, and let x∈Ux \in U and h∈Rdh \in \mathbb{R}^d be such that the whole segment {x+th:0≤t≤1}\{x + th : 0 \le t \le 1\} lies in UU. Then

V(x+h)=V(x)+∇V(x)⊤h+12h⊤H(x)h+R2(x,h),\begin{aligned} &V(x + h) \\[0.4em] &= V(x) + \nabla V(x)^{\top} h \\[0.4em] &\quad + \tfrac{1}{2} h^{\top} H(x) h \\[0.4em] &\quad + R_2(x, h), \end{aligned}

where the remainder R2R_2 has the exact integral form of the next card and satisfies R2(x,h)/∥h∥2→0R_2(x, h)/\lVert h \rVert^2 \to 0 as h→0h \to 0. The proof reduces to one variable. The function g(t)=V(x+th)g(t) = V(x + th) on [0,1][0, 1] has g(0)=V(x)g(0) = V(x) and g(1)=V(x+h)g(1) = V(x + h), and by the chain rule

g′(t)=∇V(x+th)⊤h,g′′(t)=h⊤H(x+th) h.\begin{aligned} g'(t) &= \nabla V(x + th)^{\top} h, \\[0.4em] g''(t) &= h^{\top} H(x + th)\, h . \end{aligned}

Dropping R2R_2 gives the second-order approximation, written with ≈\approx. It is exact when VV is a quadratic polynomial, because then HH is constant and the remainder vanishes.

In plain words Along the straight path from the old inputs to the new ones, the value is a function of one variable. Its slope at the start gives the first-order term, its curvature at the start gives the second-order term, and whatever the curvature does along the rest of the path is the remainder.

Example For the quadratic at x=(1,2)x = (1, 2) with h=(0.1,−0.2)h = (0.1, -0.2), the expansion gives

17−2.2+12⋅0.18=14.89.17 - 2.2 + \tfrac12 \cdot 0.18 = 14.89 .

Direct evaluation at (1.1,1.8)(1.1, 1.8) gives 1.21+3.96+9.72=14.891.21 + 3.96 + 9.72 = 14.89, the same value, as it must be for a quadratic. The first-order estimate 14.814.8 misses by 0.090.09, the curvature and interaction term.

Integral remainder

Definition Under the hypotheses of the second-order expansion, the remainder is exactly

R2(x,h)=∫01(1−t) q(t) dt,\begin{aligned} &R_2(x, h) \\[0.4em] &= \int_0^1 (1 - t)\, q(t)\, dt, \end{aligned}

where

q(t)=h⊤[H(x+th)−H(x)]h.\begin{aligned} q(t) &= h^{\top}\bigl[H(x + th) \\[0.4em] &\qquad - H(x)\bigr] h . \end{aligned}

To derive it, write g(1)−g(0)=∫01g′(s) dsg(1) - g(0) = \int_0^1 g'(s)\,ds and g′(s)=g′(0)+∫0sg′′(t) dtg'(s) = g'(0) + \int_0^s g''(t)\,dt, and exchange the order of integration over the triangle 0≤t≤s≤10 \le t \le s \le 1, where each tt is covered by an ss-interval of length 1−t1 - t. This gives

g(1)=g(0)+g′(0)+∫01(1−t) g′′(t) dt,\begin{aligned} g(1) &= g(0) + g'(0) \\[0.4em] &\quad + \int_0^1 (1 - t)\, g''(t)\, dt, \end{aligned}

and since ∫01(1−t) dt=12\int_0^1 (1 - t)\,dt = \tfrac12, subtracting 12h⊤H(x)h\tfrac12 h^{\top} H(x) h leaves the formula for R2R_2. Let M(h)M(h) be the largest operator norm of H(x+th)−H(x)H(x + th) - H(x) over 0≤t≤10 \le t \le 1. Then ∣q(t)∣≤M(h)∥h∥2\lvert q(t) \rvert \le M(h) \lVert h \rVert^2, so

∣R2(x,h)∣≤12M(h)∥h∥2,\lvert R_2(x, h) \rvert \le \tfrac12 M(h) \lVert h \rVert^2 ,

and continuity of HH at xx gives M(h)→0M(h) \to 0 as h→0h \to 0. This is a local statement only. A continuous Hessian gives no numerical bound for a move of a given size. If VV is three times continuously differentiable on UU, one more integration by parts gives

R2(x,h)=∫0112(1−t)2 g′′′(t) dt,\begin{aligned} &R_2(x, h) \\[0.4em] &= \int_0^1 \tfrac12 (1 - t)^2 \, g'''(t)\, dt, \end{aligned}

so a bound ∣g′′′(t)∣≤C\lvert g'''(t) \rvert \le C along the segment gives ∣R2∣≤C/6\lvert R_2 \rvert \le C/6, and bounded third derivatives give an error of order ∥h∥3\lVert h \rVert^3.

In plain words The remainder is the part of the value change caused by the curvature changing along the path. It is small for small moves when the Hessian is continuous, but how small it is for a move of a given size depends on how fast the curvature changes, and continuity alone does not say.

Example For the bond value V(r)=100e−5rV(r) = 100e^{-5r} at r=0.03r = 0.03, the second derivative is V′′(r)=25V(r)≈2151.77V''(r) = 25V(r) \approx 2151.77. For a rise of one percentage point the first-order term is about −4.3035-4.3035 and the second-order term about 0.10760.1076, so the second-order approximation is about 81.874881.8748, while the exact value 100e−0.2100e^{-0.2} is about 81.873181.8731. The remainder is about −0.0018-0.0018, and the integral formula with q(t)=(V′′(0.03+0.01t)−V′′(0.03))(0.01)2q(t) = \bigl(V''(0.03 + 0.01t) - V''(0.03)\bigr)(0.01)^2 gives the same number. For a rise of ten percentage points the approximation is about 53.79453.794 against an exact value of about 52.20552.205, a remainder of about −1.590-1.590. The same expansion that is accurate for the small move is visibly off for the large one.

Payoff kink

Definition A payoff kink is a point where a continuous payoff function has different one-sided derivatives, so that it is not differentiable there. The call payoff with strike K>0K > 0,

V(s)=(s−K)+=max⁡(s−K,0),\begin{aligned} V(s) &= (s - K)^{+} \\[0.4em] &= \max(s - K, 0), \end{aligned}

has slope 00 for s<Ks < K and slope 11 for s>Ks > K. At s=Ks = K its left derivative is 00 and its right derivative is 11, so it has a kink at KK. A Taylor expansion cannot be centered at KK, since the derivatives it needs do not exist there. Centered at s0≠Ks_0 \ne K, the second-order theorem applies to a move hh exactly when the segment from s0s_0 to s0+hs_0 + h does not contain KK. The segment then lies on one side of the strike, where the payoff is linear and the expansion is exact. A segment that reaches or crosses KK is not contained in any open set on which the payoff is twice continuously differentiable.

In plain words At the strike the payoff turns a corner. Above the strike it moves one for one with the stock price, below it not at all, and no single slope describes both sides. A Taylor expansion assumes that there is no corner anywhere along the move, and a sensitivity label such as a delta does not supply the missing derivative.

Example Take K=100K = 100. The difference quotients at the strike with step 10−510^{-5} are 00 from the left and 11 from the right, the two one-sided derivatives. Centered at s0=98s_0 = 98, the expansion has value, slope and curvature all equal to 00, so it predicts a payoff of 00 for every move. That is correct for a move to 9999, but a move to 102102 crosses the strike and the true payoff is 22. Before expiry a model price may be a smooth function of the stock price even though the payoff is not, but that smoothness is a property of the model price that has to be established, not assumed.

Check yourself

  1. A report gives the derivative of a position’s value with respect to a decimal interest rate as −2500-2500 currency units per unit of the rate. Estimate the first-order change in value for a rise of 2525 basis points. What do you get if you multiply the derivative by 2525 or by 0.250.25, and why are those wrong?
Show the answer

A rise of 2525 basis points is Δr=25⋅0.0001=0.0025\Delta r = 25 \cdot 0.0001 = 0.0025 in decimal units, so the first-order change is

−2500⋅0.0025=−6.25-2500 \cdot 0.0025 = -6.25

currency units. Multiplying by 2525 treats each basis point as a whole unit of the rate and gives −62,500-62{,}500. Multiplying by 0.250.25 uses the move in percentage points with a derivative per decimal unit and gives −625-625, which is 100100 times too large. The derivative per percentage point is −2500⋅0.01=−25-2500 \cdot 0.01 = -25, and −25⋅0.25=−6.25-25 \cdot 0.25 = -6.25 agrees with the correct answer.

  1. For W(x1,x2)=x12x2W(x_1, x_2) = x_1^2 x_2 at x=(2,1)x = (2, 1) and the move h=(0.1,0.1)h = (0.1, 0.1), compute the gradient, the Hessian and the second-order estimate of W(x+h)W(x + h). Compare it with the exact value and identify the remainder.
Show the answer

The gradient is (2x1x2,x12)=(4,4)(2x_1x_2, x_1^2) = (4, 4), so the first-order term is 0.4+0.4=0.80.4 + 0.4 = 0.8. The Hessian and the quadratic form are

H=[2x22x12x10]=[2440],h⊤Hh=0.02+2⋅0.04=0.10.\begin{aligned} H &= \begin{bmatrix} 2x_2 & 2x_1 \\ 2x_1 & 0 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 2 & 4 \\ 4 & 0 \end{bmatrix}, \\[0.4em] h^{\top} H h &= 0.02 + 2 \cdot 0.04 \\[0.4em] &= 0.10 . \end{aligned}

The second-order estimate is 4+0.8+12⋅0.10=4.854 + 0.8 + \tfrac12 \cdot 0.10 = 4.85, while the exact value is 2.12⋅1.1=4.8512.1^2 \cdot 1.1 = 4.851. Expanding (x1+h1)2(x2+h2)(x_1 + h_1)^2(x_2 + h_2) shows that the remainder is exactly the cubic term h12h2=0.001h_1^2 h_2 = 0.001. The integral formula agrees, since here q(t)=6t h12h2q(t) = 6t\,h_1^2 h_2 and ∫016t(1−t) dt=1\int_0^1 6t(1 - t)\,dt = 1. Counting the mixed term only once would give 4.834.83, a worse estimate.

  1. A colleague expands the payoff (s−100)+(s - 100)^{+} to first order at s=100s = 100 using the slope 12\tfrac12, the average of the two one-sided slopes. What does this predict at s=104s = 104 and at s=96s = 96, and what are the true payoffs? For which moves hh does the second-order Taylor theorem apply when the expansion is centered at s0=95s_0 = 95 instead?
Show the answer

The averaged slope predicts 0+12⋅4=20 + \tfrac12 \cdot 4 = 2 at s=104s = 104 and 0−12⋅4=−20 - \tfrac12 \cdot 4 = -2 at s=96s = 96. The true payoffs are 44 and 00, so each prediction is off by 22, and the second one is negative although the payoff never is. No derivative exists at the strike, and averaging the one-sided slopes does not create one.

Centered at s0=95s_0 = 95, the payoff is twice continuously differentiable on the open interval below 100100, and the segment from 9595 to 95+h95 + h avoids the strike exactly when h<5h < 5. For those moves the theorem applies and its prediction 00 is exact. For h≥5h \ge 5 the segment contains the strike and the theorem does not apply. At h=5h = 5 the prediction 00 still happens to equal the payoff, but for h>5h > 5 it misses by h−5h - 5.

How this lesson connects