Quant / Finance and numerics

Finite differences

· Latest

Explicit, implicit and Crank–Nicolson schemes for Black–Scholes and the heat equation, Fourier stability, and difference formulas from operators.

Definition / formulaKey factsSteps

39. How does the explicit scheme work, and when is it stable?

Scheme later lectures · standard course scheme

Grid S=n δSS=n\,\delta S, t=T−m δtt=T-m\,\delta t. PDE: Vt+12σ2S2VSS+(r−D)SVS−rV=0V_t+\tfrac12\sigma^2S^2V_{SS}+(r-D)SV_S-rV=0. Unknown level m+1m+1 is explicit in level mm:

Vnm+1=AnVn−1m+BnVnm+CnVn+1m,V_n^{m+1}=A_nV_{n-1}^m+B_nV_n^m+C_nV_{n+1}^m,An=12(σ2n2−(r−D)n)δt,Bn=1−(σ2n2+r)δt,Cn=12(σ2n2+(r−D)n)δt,A_n=\tfrac12\big(\sigma^2n^2-(r-D)n\big)\delta t,\quad B_n=1-(\sigma^2n^2+r)\delta t,\quad C_n=\tfrac12\big(\sigma^2n^2+(r-D)n\big)\delta t,

with σ,r,D\sigma,r,D evaluated at (n,m)(n,m), so time- and asset-dependent coefficients cost nothing extra.

Key facts
  • Taylor: backward difference in time O(δt)O(\delta t); central differences in SS O(δS2)O(\delta S^2).
  • European put: Vn0=max⁡(E−nδS,0)V_n^0=\max(E-n\delta S,0); V0m=Ee−∫rV_0^m=Ee^{-\int r}; VNm=0V_N^m=0.
  • Stability (heat-equation model, λ=δt/δx2\lambda=\delta t/\delta x^2): ξ=1−4λsin⁡2(θ/2)\xi=1-4\lambda\sin^2(\theta/2), stable iff λ≤12\lambda\le\tfrac12. For BS: δt≤1/(σ2N2)\delta t\le1/(\sigma^2N^2).
  • Conditionally stable: halving δS\delta S forces δt\delta t down by four.
Steps for an essay answer
  1. State PDE, payoff, and boundary conditions.
  2. Write the Taylor approximations and their errors.
  3. Substitute and rearrange to the scheme; march back from expiry.
  4. Stability: put Vnm=ξmeinθV_n^m=\xi^me^{in\theta}; need ∣ξ∣≤1|\xi|\le1; the worst case n=Nn=N gives the δt\delta t bound.

40. How does the implicit scheme work, and why is it unconditionally stable?

Scheme later lectures · checked algebraically

With τ=T−t\tau=T-t, Vτ=12σ2S2VSS+rSVS−rVV_\tau=\tfrac12\sigma^2S^2V_{SS}+rSV_S-rV. Forward difference in τ\tau, space differences at the new level m+1m+1:

anVn−1m+1+bnVnm+1+cnVn+1m+1=Vnm,a_nV_{n-1}^{m+1}+b_nV_n^{m+1}+c_nV_{n+1}^{m+1}=V_n^m,an=12(rn−σ2n2)δτ,bn=1+(σ2n2+r)δτ,cn=−12(σ2n2+rn)δτ.a_n=\tfrac12(rn-\sigma^2n^2)\delta\tau,\quad b_n=1+(\sigma^2n^2+r)\delta\tau,\quad c_n=-\tfrac12(\sigma^2n^2+rn)\delta\tau.
Key facts
  • European call: Vn0=max⁡(nδS−E,0)V_n^0=\max(n\delta S-E,0); V0m=0V_0^m=0; VNm=NδS−Ee−rmδτV_N^m=N\delta S-Ee^{-rm\delta\tau}.
  • With r(t)r(t) and a dividend D(S,t)D(S,t): drift (r−D)S(r-D)S; far boundary Se−∫D−Ee−∫rSe^{-\int D}-Ee^{-\int r}.
  • Fourier: ξ=1/(1+rδτ+2σ2n2δτsin⁡2θ2−i rnδτsin⁡θ)\xi=1/\big(1+r\delta\tau+2\sigma^2n^2\delta\tau\sin^2\tfrac\theta2-i\,rn\delta\tau\sin\theta\big). The real part of the denominator exceeds 1, so ∣ξ∣<1|\xi|<1 for every δτ\delta\tau.
  • Each step solves a tridiagonal system: LU (direct) or Gauss–Seidel/SOR (indirect; see Numerical linear algebra).
Steps
  1. Forward difference in τ\tau; central differences in SS at level m+1m+1.
  2. Collect the unknowns on the left: tridiagonal matrix MM, MVm+1=VmMV^{m+1}=V^m (plus boundary terms).
  3. State payoff and boundaries in grid form.
  4. Substitute Vnm=ξmeinθV_n^m=\xi^me^{in\theta}, solve for ξ\xi, show ∣ξ∣≤1|\xi|\le1.
  5. For the matrix problem, pick Gauss–Seidel/SOR; diagonal dominance (bn>∣an∣+∣cn∣b_n>|a_n|+|c_n|) guarantees convergence.

41. How do I write Crank–Nicolson as AUm+1=BUmAU^{m+1}=BU^m?

Scheme

Heat equation ut=c2uxxu_t=c^2u_{xx}, u(x,0)=u0u(x,0)=u_0, u(0,t)=u(L,t)=0u(0,t)=u(L,t)=0, with r=c2δt/δx2r=c^2\delta t/\delta x^2:

−rUn−1m+1+(2+2r)Unm+1−rUn+1m+1=rUn−1m+(2−2r)Unm+rUn+1m.-rU_{n-1}^{m+1}+(2+2r)U_n^{m+1}-rU_{n+1}^{m+1}=rU_{n-1}^m+(2-2r)U_n^m+rU_{n+1}^m.

A=tridiag⁡(−r, 2+2r, −r)A=\operatorname{tridiag}(-r,\,2+2r,\,-r), B=tridiag⁡(r, 2−2r, r)B=\operatorname{tridiag}(r,\,2-2r,\,r) on the interior n=1,…,N−1n=1,\dots,N-1.

Key facts
  • Average of explicit and implicit space differences.
  • Unconditionally stable; O(δt2,δx2)O(\delta t^2,\delta x^2).
  • Index carefully: the last unknown is UN−1U_{N-1}, and the right side holds level mm, not m+1m+1.
Steps
  1. Forward time difference; space difference averaged over mm and m+1m+1.
  2. Multiply by 2δt2\delta t, use rr, collect m+1m+1 on the left.
  3. Zero boundaries mean no extra vector; write both tridiagonal matrices.

42. How do I derive a difference formula with operators?

Identities

With ΔV=V(S+h)−V(S)\Delta V=V(S+h)-V(S) and D=∂SD=\partial_S:

V(S+h)=∑k(hD)kk!V=ehDV,Δ=ehD−1,hD=log⁡(1+Δ).V(S+h)=\sum_k\frac{(hD)^k}{k!}V=e^{hD}V,\qquad \Delta=e^{hD}-\mathbf 1,\qquad hD=\log(\mathbf 1+\Delta).D=1h(Δ−Δ22+Δ33−Δ44+O(Δ5)),VS≈12h(4V(S+h)−V(S+2h)−3V(S)).D=\frac1h\Big(\Delta-\frac{\Delta^2}2+\frac{\Delta^3}3-\frac{\Delta^4}4+O(\Delta^5)\Big),\qquad V_S\approx\frac1{2h}\big(4V(S+h)-V(S+2h)-3V(S)\big).
Key facts
  • Δ2V=V(S+2h)−2V(S+h)+V(S)\Delta^2V=V(S+2h)-2V(S+h)+V(S).
  • One term of the log series gives forward Euler, O(h)O(h); two terms give the one-sided O(h2)O(h^2) formula.
Steps
  1. Taylor-expand V(S+h)V(S+h) and recognise the exponential series.
  2. Subtract V(S)V(S): Δ=ehD−1\Delta=e^{hD}-\mathbf 1. Invert with the log series.
  3. Keep two terms: DV≈1h(ΔV−12Δ2V)DV\approx\tfrac1h(\Delta V-\tfrac12\Delta^2V); expand and simplify.
Jasmine Nguyen