Quant / Finance and numerics

Itô calculus

· Latest

Itô rules and the master formula, zero-drift functions, changes of variable, two correlated factors, and the GBM log return.

Definition / formulaKey factsSteps

13. How do I apply Itô’s lemma to a function of Brownian motion?

Itô’s lemma Lecture 1 notes, “Taylor series … and Itô”

Taylor-expand and use the rule of thumb dX2=dtdX^2=dt, dropping dt3/2dt^{3/2}, dt2dt^2, dt dXdt\,dX:

dF=dFdX dX+12d2FdX2 dt.dF=\frac{dF}{dX}\,dX+\frac12\frac{d^2F}{dX^2}\,dt.

The multiplication table, and its two-factor extension:

×dXdXdtdt
dXdXdtdt00
dtdt0000
dX(1) dX(2)=ρ dt,(dX(1))2=(dX(2))2=dt.dX^{(1)}\,dX^{(2)}=\rho\,dt,\qquad \big(dX^{(1)}\big)^2=\big(dX^{(2)}\big)^2=dt.

Master formula: if dG=A(t,G) dt+B(t,G) dXdG=A(t,G)\,dt+B(t,G)\,dX, then for F=F(t,G)F=F(t,G)

dF=(∂F∂t+A∂F∂G+12B2∂2F∂G2)dt+B∂F∂G dX.dF=\Big(\frac{\partial F}{\partial t}+A\frac{\partial F}{\partial G}+\tfrac12B^2\frac{\partial^2F}{\partial G^2}\Big)dt+B\frac{\partial F}{\partial G}\,dX.

Read it as: drift of FF = time change + AA × slope + ½B2B^2 × curvature; diffusion of FF = BB × slope.

Key facts · the five TSEs are special cases
TSEFunctionUnderlyingWhat changes from the master formula
1F(X)F(X)Brownian motionA=0A=0, B=1B=1, no tt term
—F(t,X)F(t,X)Brownian motionA=0A=0, B=1B=1, keep ∂tF\partial_tF
2V(S)V(S)GBMA=μSA=\mu S, B=σSB=\sigma S, no tt term
3V(S,t)V(S,t), “2D TSE”any SDEgeneral AA, BB, keep ∂tV\partial_tV
4V(t,S1,S2)V(t,S_1,S_2), “3D TSE”two correlated SDEssecond variable and a cross term (section 16)
5F(t,Gt)F(t,G_t)general dG=A dt+B dXdG=A\,dt+B\,dXthe master formula itself
  • dXdX is of size dt\sqrt{dt}, so dX2dX^2 is of size dtdt and survives; dX dtdX\,dt and dt2dt^2 vanish.
  • Squaring dS=A dt+B dXdS=A\,dt+B\,dX always gives dS2=B2 dtdS^2=B^2\,dt: only the diffusion survives.
Key facts · standard results
F(X)F(X)SDE
XnX^nnXn−1dX+12n(n−1)Xn−2dtnX^{n-1}dX+\tfrac12n(n-1)X^{n-2}dt
eXe^XeX dX+12eX dte^X\,dX+\tfrac12e^X\,dt, i.e. dy/y=12dt+dXdy/y=\tfrac12dt+dX
log⁡X\log X1X dX−12X2 dt\tfrac1X\,dX-\tfrac1{2X^2}\,dt
sin⁡X+cos⁡X\sin X+\cos X(cos⁡X−sin⁡X) dX−12(sin⁡X+cos⁡X) dt(\cos X-\sin X)\,dX-\tfrac12(\sin X+\cos X)\,dt
aXa^X, a>1a>1(log⁡a)aX dX+12(log⁡a)2aX dt(\log a)a^X\,dX+\tfrac12(\log a)^2a^X\,dt
  • For aXa^X write aX=eXlog⁡aa^X=e^{X\log a}, so F′=(log⁡a)FF'=(\log a)F, F′′=(log⁡a)2FF''=(\log a)^2F.
Steps
  1. Read off AA (the dtdt coefficient) and BB (the dXdX coefficient) from the SDE you are given.
  2. Write the new variable as an ordinary function, e.g. f(z)=ezf(z)=e^z.
  3. Compute ∂tf\partial_tf, f′f' and f′′f''. ∂tf=0\partial_tf=0 when tt does not appear explicitly, even though the process moves over time.
  4. Put them into the master formula: diffusion = Bf′Bf', drift = ∂tf+Af′+12B2f′′\partial_tf+Af'+\tfrac12B^2f''.
  5. Substitute back so the answer is in the variable asked for (e.g. dy/ydy/y).
Key facts · traps
  • Forgetting the ½B2B^2 curvature term. This is the whole difference between Itô and ordinary calculus.
  • Writing ∂tf≠0\partial_tf\ne0 when tt is not explicit, or dropping it when tt is explicit.
  • Forgetting to substitute back into the original variable at the end.
  • Taking a square root to get a cross term instead of multiplying the SDEs.
  • Letter clashes: an SDE may be written dS=A dX+B dtdS=A\,dX+B\,dt, with AA as the diffusion, the opposite of the master formula. η\eta can mean vol-of-vol in a stochastic volatility model but the drift constant in Vasicek.
  • Notation: yy, yty_t and YY all mean the same process. Differentiate the plain function f(z)f(z), then evaluate at z=Ztz=Z_t.

14. When does a function of the share price have zero drift?

Itô for g(S)g(S) Lecture 1 notes, “Itô in higher dimensions”

For dS=A(S,t) dX+B(S,t) dtdS=A(S,t)\,dX+B(S,t)\,dt (note: AA is the diffusion here):

dg=(BdgdS+12A2d2gdS2)dt+AdgdS dX.dg=\Big(B\frac{dg}{dS}+\tfrac12A^2\frac{d^2g}{dS^2}\Big)dt+A\frac{dg}{dS}\,dX.
Key facts
  • Zero drift: dgdS+12A2Bd2gdS2=0\dfrac{dg}{dS}+\dfrac12\dfrac{A^2}{B}\dfrac{d^2g}{dS^2}=0 (assume B≠0B\ne0).
  • Since gg has no tt, this needs A2/BA^2/B independent of time.
  • Then g′(S)=cexp⁡(−∫2B/A2 dS)g'(S)=c\exp\big(-\int2B/A^2\,dS\big); non-zero diffusion needs A≠0A\ne0, c≠0c\ne0.
Steps
  1. Apply Itô to g(S)g(S) (no ∂t\partial_t term).
  2. Set the dtdt coefficient to zero; divide by BB.
  3. State the condition: A2/BA^2/B a function of SS only; solve the first-order ODE for g′g'.

15. How do I change variable in an SDE, or verify a solution?

Itô for Y=f(Z)Y=f(Z) Lecture 1 notes

If dZ=a dt+b dXdZ=a\,dt+b\,dX then

dY=(adYdZ+12b2d2YdZ2)dt+bdYdZ dX.dY=\Big(a\frac{dY}{dZ}+\tfrac12b^2\frac{d^2Y}{dZ^2}\Big)dt+b\frac{dY}{dZ}\,dX.

With time as well: dG=(Gt+12GXX)dt+GX dXdG=\big(G_t+\tfrac12G_{XX}\big)dt+G_X\,dX for G(t,Xt)G(t,X_t).

Key facts · two examples
  • From log to level: d(log⁡y)=(α−βlog⁡y) dt+δ dXd(\log y)=(\alpha-\beta\log y)\,dt+\delta\,dX. With Z=log⁡yZ=\log y, Y=eZY=e^Z, so Y′=Y′′=yY'=Y''=y and dyy=(α−βlog⁡y+12δ2)dt+δ dX.\frac{dy}{y}=\big(\alpha-\beta\log y+\tfrac12\delta^2\big)dt+\delta\,dX. The +12δ2+\tfrac12\delta^2 is the Itô term (the reverse of GBM’s −12σ2-\tfrac12\sigma^2).
  • Verifying Gt=et+aeXtG_t=e^{t+ae^{X_t}}: Gt=GG_t=G, GX=aeXGG_X=ae^XG, GXX=aeXG+a2e2XGG_{XX}=ae^XG+a^2e^{2X}G (product rule); then replace aeX=log⁡G−tae^X=\log G-t to get dG=G(1+12(log⁡G−t)+12(log⁡G−t)2)dt+G(log⁡G−t) dX.dG=G\big(1+\tfrac12(\log G-t)+\tfrac12(\log G-t)^2\big)dt+G(\log G-t)\,dX.
Steps
  1. Identify the old variable’s aa and bb, and the new function.
  2. Differentiate; apply Itô.
  3. Rewrite every coefficient in the new variable (e.g. aeX=log⁡G−tae^{X}=\log G-t) and compare with the target.

16. How do I apply Itô with two correlated factors?

Two-factor Itô Lecture 1 notes, V(S1,S2,t)V(S_1,S_2,t)

With dSi=ai dt+bi dX(i)dS_i=a_i\,dt+b_i\,dX^{(i)} and dX(1)dX(2)=ρ dtdX^{(1)}dX^{(2)}=\rho\,dt:

dV=Vt dt+VS1dS1+VS2dS2+(12b12VS1S1+ρ b1b2VS1S2+12b22VS2S2)dt.dV=V_t\,dt+V_{S_1}dS_1+V_{S_2}dS_2+\Big(\tfrac12b_1^2V_{S_1S_1}+\rho\,b_1b_2V_{S_1S_2}+\tfrac12b_2^2V_{S_2S_2}\Big)dt.
Key facts · Heston-type example

dS=μS dt+v S dX(1)dS=\mu S\,dt+\sqrt{v}\,S\,dX^{(1)}, dv=−λ(v−vˉ) dt+ηv dX(2)dv=-\lambda(v-\bar v)\,dt+\eta\sqrt v\,dX^{(2)}:

  • dS2=vS2 dtdS^2=vS^2\,dt, dv2=η2v dtdv^2=\eta^2v\,dt, dS dv=ρηvS dtdS\,dv=\rho\eta vS\,dt.
  • dF=(Ft+μSFS−λ(v−vˉ)Fv+12vS2FSS+12η2vFvv+ρηvSFSv)dt+vSFS dX(1)+ηvFv dX(2)dF=\big(F_t+\mu SF_S-\lambda(v-\bar v)F_v+\tfrac12vS^2F_{SS}+\tfrac12\eta^2vF_{vv}+\rho\eta vSF_{Sv}\big)dt+\sqrt vSF_S\,dX^{(1)}+\eta\sqrt vF_v\,dX^{(2)}.
  • Trap: the cross term is ρb1b2VS1S2\rho b_1b_2V_{S_1S_2}, i.e. ½ × 2 × the mixed partial. Do not drop the 2.
  • The same expansion drives the stochastic-volatility PDE (Stochastic volatility and interest-rate models).
Steps
  1. Read off b1=vSb_1=\sqrt vS and b2=ηvb_2=\eta\sqrt v.
  2. Compute dS2dS^2, dv2dv^2, dS dvdS\,dv with dXi2=dtdX_i^2=dt, dX1dX2=ρ dtdX_1dX_2=\rho\,dt.
  3. Substitute into the 3D Taylor expansion; collect the dtdt, dX(1)dX^{(1)}, dX(2)dX^{(2)} terms.

17. What are the mean and variance of the log return under GBM?

Result Lecture 1 notes, “Taylor series … and Itô”, V=log⁡SV=\log S

For V(S)V(S) under GBM, dV=(μSV′+12σ2S2V′′)dt+σSV′ dXdV=\big(\mu SV'+\tfrac12\sigma^2S^2V''\big)dt+\sigma SV'\,dX. With V=log⁡SV=\log S:

d(log⁡S)=(μ−12σ2)dt+σ dX ⇒ log⁡StS0∼N((μ−12σ2)t, σ2t),d(\log S)=\big(\mu-\tfrac12\sigma^2\big)dt+\sigma\,dX\ \Rightarrow\ \log\frac{S_t}{S_0}\sim N\Big(\big(\mu-\tfrac12\sigma^2\big)t,\ \sigma^2t\Big),

so St=S0exp⁡((μ−12σ2)t+σXt)S_t=S_0\exp\big((\mu-\tfrac12\sigma^2)t+\sigma X_t\big).

Key facts
  • The −12σ2-\tfrac12\sigma^2 comes from Itô’s 12b2V′′\tfrac12b^2V'' term with V′′=−1/S2V''=-1/S^2. Ordinary calculus would miss it.
  • Some texts write dWdW; the course writes dXdX. Same thing.
Steps
  1. V=log⁡SV=\log S: V′=1/SV'=1/S, V′′=−1/S2V''=-1/S^2.
  2. Itô with dS2=σ2S2dtdS^2=\sigma^2S^2dt: drift μ−12σ2\mu-\tfrac12\sigma^2, diffusion σ\sigma.
  3. Constant coefficients: mean = drift × tt, variance = σ2t\sigma^2t.

Appendix: calculus toolkit

Notation
MeaningEquivalent ways of writing it
First derivative of f(x)f(x)f′(x)=dfdx=Df(x)f'(x)=\dfrac{df}{dx}=Df(x)
Second derivativef′′(x)=d2fdx2f''(x)=\dfrac{d^2f}{dx^2}
Time derivative of deterministic f(t)f(t)f˙=df/dt\dot f=df/dt
Partials of V(S,t)V(S,t)∂V/∂S=VS\partial V/\partial S=V_S, ∂V/∂t=Vt\partial V/\partial t=V_t, ∂2V/∂S2=VSS\partial^2V/\partial S^2=V_{SS}
Mixed partialVSt=VtSV_{St}=V_{tS} for smooth VV

Use dd when the function has one variable and ∂\partial when it has several; for a partial derivative, hold every other variable fixed.

Derivatives and integrals
f(x)f(x)f′(x)f'(x)∫f dx\int f\,dx
xnx^nnxn−1nx^{n-1}xn+1/(n+1)x^{n+1}/(n+1), n≠−1n\ne-1
eaxe^{ax}aeaxae^{ax}eax/ae^{ax}/a
axa^xaxlog⁡aa^x\log aax/log⁡aa^x/\log a
log⁡x\log x1/x1/x—
1/x1/x−1/x2-1/x^2log⁡∣x∣\log|x|
sin⁡ax\sin axacos⁡axa\cos ax−cos⁡(ax)/a-\cos(ax)/a
cos⁡ax\cos ax−asin⁡ax-a\sin axsin⁡(ax)/a\sin(ax)/a
x\sqrt x1/(2x)1/(2\sqrt x)23x3/2\tfrac23x^{3/2}
  • Product (fg)′=f′g+fg′(fg)'=f'g+fg'; quotient (f/g)′=(f′g−fg′)/g2(f/g)'=(f'g-fg')/g^2; chain ddxf(g(x))=f′(g(x))g′(x)\tfrac{d}{dx}f(g(x))=f'(g(x))g'(x).
  • ddxeu(x)=u′eu\tfrac{d}{dx}e^{u(x)}=u'e^{u}, ddxlog⁡u(x)=u′/u\tfrac{d}{dx}\log u(x)=u'/u; so ∫u′/u dx=log⁡∣u∣\int u'/u\,dx=\log|u| and ∫u′eu dx=eu\int u'e^u\,dx=e^u.
  • Substitution: with u=g(x)u=g(x), ∫f(g(x))g′(x) dx=∫f(u) du\int f(g(x))g'(x)\,dx=\int f(u)\,du (change the limits too).
  • By parts: ∫u dv=uv−∫v du\int u\,dv=uv-\int v\,du. Gaussian: ∫−∞∞e−x2/2 dx=2π\int_{-\infty}^{\infty}e^{-x^2/2}\,dx=\sqrt{2\pi}.
Stochastic versions
  • ∫0tdXs=Xt\int_0^tdX_s=X_t and ∫0tds=t\int_0^tds=t.
  • Mean of an Itô integral: E[∫0tf(s) dXs]=0\mathbb E\big[\int_0^tf(s)\,dX_s\big]=0.
  • Itô isometry: E[(∫0tf(s) dXs)2]=∫0tf(s)2 ds\mathbb E\Big[\big(\int_0^tf(s)\,dX_s\big)^2\Big]=\int_0^tf(s)^2\,ds.
  • Itô product rule: d(XY)=X dY+Y dX+dX dYd(XY)=X\,dY+Y\,dX+dX\,dY.
  • Integrating factor for linear SDEs such as Vasicek: d(eγtrt)=eγt(drt+γrt dt)d\big(e^{\gamma t}r_t\big)=e^{\gamma t}\big(dr_t+\gamma r_t\,dt\big).
Jasmine Nguyen