Skip to main content

Chapter 10 — The Feynman–Kac Formula

Guiding question

Every PDE of the form ∂tu+Lu−cu=−f\partial_t u + \mathcal L u - c u = -f has a solution that can be written as a conditional expectation. What is the precise connection, and how does it make numerical pricing by Monte Carlo and PDE methods equivalent?

The Feynman–Kac formula is one of the deepest results connecting probability and analysis. It says: the solution to a certain class of backward parabolic PDEs is a conditional expectation of a functional of a diffusion. This has two directions of impact:

  • Analytical: hard expectations become tractable PDEs.
  • Probabilistic: hard PDEs become tractable Monte Carlo simulations.

In finance, it is the rigorous foundation behind "price = expectation."


10.1 Setup​

Fix a terminal time T>0T > 0 and a diffusion:

dXt=b(t,Xt) dt+σ(t,Xt) dWt.dX_t = b(t,X_t)\,dt + \sigma(t,X_t)\,dW_t.

Define the Feynman–Kac functional:

u(t,x)=E ⁣[exp⁡ ⁣(−∫tTc(s,Xs) ds)g(XT)+∫tTexp⁡ ⁣(−∫tsc(r,Xr) dr)f(s,Xs) ds ∣ Xt=x].u(t,x) = \mathbb E\!\left[\exp\!\left(-\int_t^T c(s,X_s)\,ds\right)g(X_T) + \int_t^T\exp\!\left(-\int_t^s c(r,X_r)\,dr\right)f(s,X_s)\,ds\ \Bigg|\ X_t = x\right].

Here:

  • gg: terminal payoff
  • ff: running payoff (or source term)
  • cc: discount rate (or killing rate)

10.2 The Feynman–Kac theorem​

Feynman–Kac formula

Under suitable regularity conditions, the function u(t,x)u(t,x) defined above is the unique classical solution to the backward PDE:

∂tu+b(t,x) ∂xu+12σ(t,x)2 ∂xxu−c(t,x) u+f(t,x)=0,\partial_t u + b(t,x)\,\partial_x u + \tfrac12\sigma(t,x)^2\,\partial_{xx}u - c(t,x)\,u + f(t,x) = 0,

on [0,T)×R[0,T)\times\mathbb R, with terminal condition u(T,x)=g(x)u(T,x) = g(x).

Proof via Itô's formula

Define Yt=e−∫0tc(s,Xs) dsu(t,Xt)+∫0te−∫0sc f(s,Xs) dsY_t = e^{-\int_0^t c(s,X_s)\,ds}u(t,X_t) + \int_0^t e^{-\int_0^s c}\,f(s,X_s)\,ds.

We want to show YtY_t is a martingale. By Itô's formula applied to v(t,x)=e−∫0tc dsu(t,x)v(t,x) = e^{-\int_0^t c\,ds}u(t,x):

dYt=e−∫0tc ds ⁣[(∂tu+b∂xu+12σ2∂xxu−cu+f) dt+σ∂xu dWt].dY_t = e^{-\int_0^t c\,ds}\!\left[(\partial_t u + b\partial_x u + \tfrac12\sigma^2\partial_{xx}u - cu + f)\,dt + \sigma\partial_x u\,dW_t\right].

If uu solves the PDE, the dtdt coefficient vanishes, leaving dYt=(pure stochastic integral)dY_t = (\text{pure stochastic integral}). A stochastic integral is a local martingale. Under integrability, YtY_t is a true martingale.

Terminal condition: YT=e−∫0Tc dsg(XT)+∫0Te−∫0scf(s,Xs) dsY_T = e^{-\int_0^T c\,ds}g(X_T) + \int_0^T e^{-\int_0^s c}f(s,X_s)\,ds.

At time tt: E[YT∣Ft]=Yt\mathbb E[Y_T\mid\mathcal F_t] = Y_t (martingale). Rewriting gives u(t,Xt)=E[…∣Xt]u(t,X_t) = \mathbb E[\ldots\mid X_t].

Feynman–Kac: u(0,x) = E[g(x + W_T)] solves the heat PDE
Terminal payoff g(x)u(0,x) = E[g(x+W_T)] (PDE sol.)Monte Carlo at x=0−44
PDE solution at x=00.39894
Monte Carlo E[g(W_T)]1.49777
Feynman–Kac says the PDE solution equals a conditional expectation. The blue curve is the exact PDE solution u(0,x); the grey dashed curve is the terminal payoff g(x). The red dot is the Monte Carlo estimate at x=0 — it matches the PDE solution by design. In finance, u = option price.

10.3 The pure terminal payoff case​

In the simplest case c=0c = 0, f=0f = 0, the Feynman–Kac formula reduces to:

u(t,x)=E[g(XT)∣Xt=x],u(t,x) = \mathbb E[g(X_T)\mid X_t = x],

which solves:

∂tu+b(t,x)∂xu+12σ(t,x)2∂xxu=0,u(T,x)=g(x).\partial_t u + b(t,x)\partial_x u + \tfrac12\sigma(t,x)^2\partial_{xx}u = 0,\qquad u(T,x) = g(x).

For pure Brownian motion (b=0b=0, σ=1\sigma=1), this is the heat equation ∂tu=−12∂xxu\partial_t u = -\frac12\partial_{xx}u (note the sign: running backward from TT to 00). The solution is convolution with the Gaussian kernel:

u(0,x)=12πT∫−∞∞g(y) e−(x−y)2/(2T) dy.u(0,x) = \frac{1}{\sqrt{2\pi T}}\int_{-\infty}^\infty g(y)\,e^{-(x-y)^2/(2T)}\,dy.

This is exactly the smoothing property of the heat equation — the Brownian motion "averages" the terminal payoff over Gaussian fluctuations.


10.4 Discounted terminal payoff​

With discount rate c=rc = r (constant) and f=0f=0:

u(t,x)=e−r(T−t)E[g(XT)∣Xt=x].u(t,x) = e^{-r(T-t)}\mathbb E[g(X_T)\mid X_t = x].

The PDE becomes:

∂tu+b∂xu+12σ2∂xxu−ru=0.\partial_t u + b\partial_x u + \tfrac12\sigma^2\partial_{xx}u - ru = 0.

For GBM under Q\mathbb Q (b=rxb = rx, σ=σx\sigma = \sigma x): this is precisely the Black–Scholes PDE. The Feynman–Kac formula proves that the Black–Scholes price equals the risk-neutral discounted expectation.

Feynman–Kac as a dictionary

The Feynman–Kac correspondence is a dictionary:

Probability sidePDE side
Conditional expectation E[g(XT)∣Xt=x]\mathbb E[g(X_T)\mid X_t = x]Solution u(t,x)u(t,x) of the backward PDE
SDE coefficients bb, σ\sigmaPDE operator b∂x+12σ2∂xxb\partial_x + \frac12\sigma^2\partial_{xx}
Terminal condition ggBoundary data u(T,x)=g(x)u(T,x) = g(x)
Discount rate ccKilling term −cu-cu in PDE
Running cost ffSource term in PDE

Every pricing problem can be attacked from either side: solve the PDE analytically, or simulate the SDE by Monte Carlo.


10.5 Worked examples​

Example 1: European call option​

X=SX = S follows GBM under Q\mathbb Q, g(S)=(S−K)+g(S) = (S-K)^+, c=rc = r.

Feynman–Kac: C(t,S)=e−r(T−t)EQ[(ST−K)+∣St=S]C(t,S) = e^{-r(T-t)}\mathbb E^{\mathbb Q}[(S_T-K)^+\mid S_t = S].

This expectation evaluates to the Black–Scholes formula (Chapter 7).

Example 2: Zero-coupon bond in CIR model​

rtr_t follows CIR (dr=κ(θ−r) dt+σr dWdr = \kappa(\theta-r)\,dt + \sigma\sqrt{r}\,dW). The zero-coupon bond price is:

P(t,r)=E ⁣[exp⁡ ⁣(−∫tTrs ds)∣rt=r].P(t,r) = \mathbb E\!\left[\exp\!\left(-\int_t^T r_s\,ds\right)\Bigg| r_t = r\right].

Feynman–Kac says PP solves:

∂tP+κ(θ−r)∂rP+12σ2r ∂rrP−rP=0,P(T,r)=1.\partial_t P + \kappa(\theta-r)\partial_r P + \tfrac12\sigma^2 r\,\partial_{rr}P - rP = 0, \quad P(T,r) = 1.

This is the CIR bond pricing PDE. The explicit solution is P(t,r)=A(τ)e−B(τ)rP(t,r) = A(\tau)e^{-B(\tau)r}, where τ=T−t\tau = T-t and A,BA,B are computed by solving the Riccati ODE for BB.

Example 3: Running maximum​

Let MT=max⁡0≤s≤TWsM_T = \max_{0\le s\le T}W_s. Can we find E[f(MT)]\mathbb E[f(M_T)]?

This is not directly a Feynman–Kac problem (the running maximum is not Markovian on its own). But (Wt,Mt)(W_t, M_t) jointly is Markovian, and Feynman–Kac applies in two dimensions.


10.6 The Kolmogorov backward equation as a special case​

For c=0c=0, f=0f=0, and g=1(−∞,y]g = \mathbf 1_{(-\infty,y]} (cumulative distribution), Feynman–Kac gives:

u(t,x)=P(XT≤y∣Xt=x).u(t,x) = \mathbb P(X_T \le y\mid X_t = x).

This solves the Kolmogorov backward equation ∂tu+Lxu=0\partial_t u + \mathcal L_x u = 0. Setting t=0t=0 gives the transition probability P(XT≤y∣X0=x)\mathbb P(X_T\le y\mid X_0=x) — the fundamental solution of the backward equation.


10.7 Monte Carlo versus PDE: two algorithms​

Monte Carlo (probabilistic side):

  1. Simulate NN paths of XX from xx to time TT using Euler–Maruyama.
  2. Compute g(XT(k))g(X_T^{(k)}) for each path kk.
  3. Estimate u(0,x)≈1N∑kg(XT(k))u(0,x)\approx \frac{1}{N}\sum_k g(X_T^{(k)}).

Error: O(1/N)O(1/\sqrt{N}) — statistical, independent of dimension.

PDE solver (analytical side):

  1. Discretize the PDE on a grid (ti,xj)(t_i, x_j).
  2. Apply finite differences or finite elements.
  3. March backward from TT to 00.

Error: O(Δt+Δx2)O(\Delta t + \Delta x^2) — deterministic, but grid size explodes in high dimensions (curse of dimensionality).

Feynman–Kac guarantees both methods converge to the same answer.

When to use Monte Carlo vs PDE

Use PDE when: 1D or 2D problem (e.g., European option on one stock), high accuracy needed, Greeks required analytically (differentiate PDE solution), early exercise (American options via free boundary PDE).

Use Monte Carlo when: High-dimensional problem (basket, path-dependent), flexible payoff structure, convergence guarantee regardless of dimension, embarrassingly parallelizable.

Dimension d≥4d\ge 4: Monte Carlo dominates. Dimension d≤3d\le 3: PDE methods are often faster and more precise.


10.8 Problems​

Problem 1: Heat equation

For dX=dWdX = dW (pure BM) and g(x)=x2g(x) = x^2, use Feynman–Kac to find u(0,x)=E[(x+WT)2]u(0,x) = \mathbb E[(x+W_T)^2] and verify it solves ∂tu+12∂xxu=0\partial_t u + \frac12\partial_{xx}u = 0 with u(T,x)=x2u(T,x) = x^2.

Problem 2: Discounting

For dX=0⋅dt+dWdX = 0\cdot dt + dW (pure BM) and g(x)=exg(x) = e^x, c=12c = \frac12, compute u(0,x)=E[e−T/2ex+WT]u(0,x) = \mathbb E[e^{-T/2}e^{x+W_T}]. Verify it solves the PDE with discounting.

Problem 3: Running payoff

For dX=dWdX = dW, g=0g=0, f(s,x)=1f(s,x)=1, c=0c=0: the Feynman–Kac formula gives u(t,x)=E[∫tT1 ds∣Xt=x]=T−tu(t,x) = \mathbb E[\int_t^T 1\,ds\mid X_t=x] = T-t. Verify u(t,x)=T−tu(t,x)=T-t satisfies the PDE.

Problem 4: Binary option

Using Feynman–Kac, show that the price of a binary call (pays 11 if ST>KS_T > K, else 00) under Black–Scholes is e−rTN(d2)e^{-rT}N(d_2), and identify which PDE it solves.


10.9 Selected solutions​

Solution 1

u(0,x)=E[(x+WT)2]=x2+E[2xWT]+E[WT2]=x2+0+T=x2+Tu(0,x) = \mathbb E[(x+W_T)^2] = x^2 + \mathbb E[2xW_T] + \mathbb E[W_T^2] = x^2 + 0 + T = x^2 + T.

Check PDE: u(t,x)=x2+(T−t)u(t,x) = x^2 + (T-t) (from Feynman–Kac, the time-dependent version). Then ∂tu=−1\partial_t u = -1 and 12∂xxu=12⋅2=1\frac12\partial_{xx}u = \frac12\cdot 2 = 1. So ∂tu+12∂xxu=−1+1=0\partial_t u + \frac12\partial_{xx}u = -1+1=0. ✓

Solution 2

u(0,x)=e−T/2E[ex+WT]=e−T/2⋅ex⋅eT/2=exu(0,x) = e^{-T/2}\mathbb E[e^{x+W_T}] = e^{-T/2}\cdot e^x\cdot e^{T/2} = e^x. (Using E[eWT]=eT/2\mathbb E[e^{W_T}] = e^{T/2}.)

The PDE is ∂tu+12∂xxu−12u=0\partial_t u + \frac12\partial_{xx}u - \frac12 u = 0, u(T,x)=exu(T,x) = e^x. With u=exu = e^x (constant in tt): ∂tu=0\partial_t u = 0, 12∂xxu=12ex\frac12\partial_{xx}u = \frac12 e^x, −12u=−12ex-\frac12 u = -\frac12 e^x. Sum =0= 0. ✓


10.10 What this chapter gives you​

FormulaMeaning
u(t,x)=E[e−∫c dsg(XT)+…∣Xt=x]u(t,x) = \mathbb E[e^{-\int c\,ds}g(X_T)+\ldots\mid X_t=x]Conditional expectation = PDE solution
∂tu+Lu−cu+f=0\partial_t u + \mathcal Lu - cu + f = 0The backward PDE for uu
u(T,x)=g(x)u(T,x) = g(x)Terminal/boundary condition
Black–Scholes as Feynman–KacC=e−rτEQ[(ST−K)+∣St]C = e^{-r\tau}\mathbb E^{\mathbb Q}[(S_T-K)^+\mid S_t]
Bond pricing as Feynman–KacP=E[exp⁡(−∫r ds)∣rt]P = \mathbb E[\exp(-\int r\,ds)\mid r_t]
MC vs PDETwo algorithms for the same quantity

Part IV now uses this foundation to study more advanced models: stochastic volatility, interest rate curves, and numerical implementation.