Skip to main content

Mathematical Infrastructure

Feynman–Kac Formula

The probabilistic representation of solutions to linear parabolic PDEs as expectations over SDE trajectories. The bridge that lets you Monte Carlo a PDE, the reason high-dimensional Black-Scholes is tractable, and the foundation under every backward-SDE method including deep BSDE.

AdvancedTier 2Stable~45 min
0

Why This Matters

The Feynman–Kac formula is the precise statement that some partial differential equations can be solved by simulating a stochastic differential equation. That is a strong claim: instead of meshing a domain in Rd\mathbb{R}^d — which costs exponentially in dd — you sample SDE trajectories and average a payoff at the terminal time, which costs only polynomially. For high-dimensional parabolic PDEs (Black–Scholes under counterparty risk, Hamilton–Jacobi–Bellman equations in stochastic control, committor functions in molecular dynamics) this is the only known route to a computable answer.

The formula also flips the mental model of what a PDE solution is. The classical view treats u(t,x)u(t, x) as a function on a continuous domain satisfying differentiation rules. The Feynman–Kac view treats u(t,x)=E[payoffXt=x]u(t, x) = \mathbb{E}[\text{payoff} \mid X_t = x] as a value function over SDE trajectories starting from (t,x)(t, x). Every modern method that combines neural networks with stochastic numerics — deep BSDE, the deep splitting method, Han–Jentzen–E's full nonlinear extensions — takes the value-function view as its starting point.

A useful slogan: the Fokker–Planck equation moves densities forward in time using the generator's adjoint; Feynman–Kac moves value functions backward in time using the generator itself. They are the two halves of the PDE-SDE duality.

Mental Model

Think of u(t,x)u(t, x) as the expected payoff of a stochastic game: starting from state xx at time tt, run the SDE forward to terminal time TT, and collect a reward g(XT)g(X_T). Two complications turn the simple expectation E[g(XT)Xt=x]\mathbb{E}[g(X_T) \mid X_t = x] into the full Feynman–Kac form. First, you might discount the future at a rate r(t,x)r(t, x), multiplying by exp(tTrds)\exp(-\int_t^T r\,ds). Second, you might collect a running reward f(s,Xs)f(s, X_s) along the trajectory, adding tTfds\int_t^T f\,ds. Both are common in finance and control. The Feynman–Kac formula says these probabilistic constructions are exactly the unique solutions to a class of linear parabolic PDEs.

Formal Statement

Definition

Feynman–Kac Formula

Let XtRdX_t \in \mathbb{R}^d solve the SDE dXs=b(s,Xs)ds+σ(s,Xs)dBsdX_s = b(s, X_s)\,ds + \sigma(s, X_s)\,dB_s with infinitesimal generator Lu=bu+12Tr(σσ2u)\mathcal{L} u = b \cdot \nabla u + \tfrac{1}{2} \operatorname{Tr}(\sigma \sigma^\top \nabla^2 u). Let u:[0,T]×RdRu: [0, T] \times \mathbb{R}^d \to \mathbb{R} solve the backward Kolmogorov / Cauchy problem

tu+Lu+f(t,x)r(t,x)u=0,u(T,x)=g(x),\partial_t u + \mathcal{L} u + f(t, x) - r(t, x)\, u = 0, \qquad u(T, x) = g(x),

with sufficiently smooth b,σ,f,r,gb, \sigma, f, r, g and bounded growth. Then uu admits the probabilistic representation

u(t,x)=E ⁣[etTr(s,Xs)dsg(XT)+tTetsr(τ,Xτ)dτf(s,Xs)dsXt=x].u(t, x) = \mathbb{E}\!\left[ e^{-\int_t^T r(s, X_s)\,ds}\, g(X_T) + \int_t^T e^{-\int_t^s r(\tau, X_\tau)\,d\tau}\, f(s, X_s)\,ds \,\Big|\, X_t = x \right].

The PDE has three ingredients that map cleanly to the SDE side: L\mathcal{L} is the generator of the diffusion, rr is a state-dependent discount rate applied to terminal and running payoffs, and ff is a forcing term that becomes a running cost integrated along the path.

Classical Feynman–Kac (the clean special case)

Set f0f \equiv 0 and r0r \equiv 0. The PDE collapses to tu+Lu=0\partial_t u + \mathcal{L} u = 0, u(T,x)=g(x)u(T, x) = g(x), and the formula reduces to u(t,x)=E[g(XT)Xt=x]u(t, x) = \mathbb{E}[g(X_T) \mid X_t = x]. This is the version most often called "Feynman–Kac" without qualification.

Theorem

Feynman–Kac Representation

Statement

Under the assumptions above, the unique classical solution to tu+Lu=0\partial_t u + \mathcal{L} u = 0 with terminal condition u(T,)=gu(T, \cdot) = g admits the probabilistic representation u(t,x)=E[g(XT)Xt=x]u(t, x) = \mathbb{E}[g(X_T) \mid X_t = x], where XsX_s solves dXs=b(s,Xs)ds+σ(s,Xs)dBsdX_s = b(s, X_s)\,ds + \sigma(s, X_s)\,dB_s with Xt=xX_t = x.

Intuition

The map su(s,Xs)s \mapsto u(s, X_s) should be a martingale: starting from (t,x)(t, x) and running forward, the expected future value of uu at time s>ts > t should equal u(t,x)u(t, x), since there is no information being added. Itô's lemma identifies the drift of u(s,Xs)u(s, X_s) as tu+Lu\partial_t u + \mathcal{L} u, which the PDE forces to be zero. The martingale property at the terminal time gives u(t,x)=E[u(T,XT)Xt=x]=E[g(XT)Xt=x]u(t, x) = \mathbb{E}[u(T, X_T) \mid X_t = x] = \mathbb{E}[g(X_T) \mid X_t = x].

Proof Sketch

Apply Itô's lemma to u(s,Xs)u(s, X_s) on [t,T][t, T]: du(s,Xs)=(su+Lu)(s,Xs)ds+(u)σdBs=0ds+(u)σdBsdu(s, X_s) = (\partial_s u + \mathcal{L} u)(s, X_s)\,ds + (\nabla u)^\top \sigma\,dB_s = 0\,ds + (\nabla u)^\top \sigma\,dB_s. Take expectations conditional on Xt=xX_t = x. The stochastic integral is a martingale (polynomial-growth bounds plus Burkholder–Davis–Gundy), so its expectation vanishes, giving E[u(T,XT)Xt=x]u(t,x)=0\mathbb{E}[u(T, X_T) \mid X_t = x] - u(t, x) = 0. The terminal condition u(T,x)=g(x)u(T, x) = g(x) closes the identity.

Why It Matters

This is the cleanest statement of "PDE = expectation over an SDE." Three consequences. (1) Monte Carlo solver. Sample NN trajectories of XX starting from (t,x)(t, x), average g(XT)g(X_T), get an unbiased estimator of u(t,x)u(t, x) with variance O(1/N)O(1/N) that is independent of dimension. (2) Linearity of expectation as superposition principle. If gg is a sum of payoffs, the corresponding uu is the same sum; the PDE inherits the linearity for free. (3) A pricing equation for European options. With XX a risk-neutral asset price and gg the option payoff, the expectation is the price; any PDE-side method for uu must agree with the Monte Carlo estimator up to numerical error. The result states: u(t,x)=E[g(XT)Xt=x]u(t, x) = \mathbb{E}[g(X_T) \mid X_t = x] for all (t,x)[0,T]×Rd(t, x) \in [0, T] \times \mathbb{R}^d.

Failure Mode

The polynomial-growth and regularity hypotheses can fail in two pedestrian ways. First, payoffs gg with exponential growth (e.g., g(x)=ex2g(x) = e^{\lvert x \rvert^2}) make the expectation infinite even when the PDE has a formal solution. Second, degenerate diffusions (σ\sigma rank-deficient at some points) leave parts of the state space unreachable from Xt=xX_t = x, and u(t,x)u(t, x) becomes determined by boundary data the SDE cannot probe. Hörmander-type bracket conditions or viscosity-solution machinery are then needed.

Discounted Variant: Black–Scholes

The full Feynman–Kac formula with discounting is what gives the Black–Scholes equation its probabilistic content. For an asset StS_t following geometric Brownian motion under the risk-neutral measure, dSt=rStdt+σStdBtdS_t = r S_t\,dt + \sigma S_t\,dB_t, and a European option with payoff g(ST)g(S_T) at maturity TT, the price at time tt with St=sS_t = s is

V(t,s)=E ⁣[er(Tt)g(ST)St=s].V(t, s) = \mathbb{E}\!\left[e^{-r(T-t)}\, g(S_T) \,\Big|\, S_t = s\right].

By Feynman–Kac, VV is the unique solution to the PDE tV+12σ2s2ssV+rssVrV=0\partial_t V + \tfrac{1}{2}\sigma^2 s^2 \partial_{ss} V + r s\, \partial_s V - r V = 0, with terminal condition V(T,s)=g(s)V(T, s) = g(s). This is the Black–Scholes equation in stock-price coordinates, and the equivalence "price = discounted expectation = PDE solution" is a Feynman–Kac identification, not an extra assumption.

The same machinery generalizes to multi-asset options, stochastic-volatility models (Heston), and counterparty-risk-adjusted pricing, except the PDE becomes high-dimensional (dd assets means dd spatial dimensions) and classical methods give up. Feynman–Kac says you can still Monte Carlo it.

Worked Example: Heat Equation as Brownian Expectation

Take Xt=x+BtX_t = x + B_t (standard Brownian motion shifted to start at xx), f0f \equiv 0, r0r \equiv 0, and gg smooth. The generator is L=12Δ\mathcal{L} = \tfrac{1}{2} \Delta and the PDE becomes tu+12Δu=0\partial_t u + \tfrac{1}{2} \Delta u = 0, u(T,x)=g(x)u(T, x) = g(x). Feynman–Kac gives

u(t,x)=E[g(x+BTt)]=Rdg(y)1(2π(Tt))d/2eyx2/(2(Tt))dy.u(t, x) = \mathbb{E}[g(x + B_{T-t})] = \int_{\mathbb{R}^d} g(y)\, \frac{1}{(2 \pi (T-t))^{d/2}}\,e^{-\lvert y - x \rvert^2 / (2(T-t))}\,dy.

The right-hand side is the heat kernel convolution. So the Feynman–Kac formula reproduces the heat-kernel representation of the backward heat equation, and by extension the forward heat equation, by swapping the time direction. This is the cleanest illustration of the formula: the stochastic representation and the PDE Green's function are the same object viewed from two sides.

Connection to Backward SDEs

The classical Feynman–Kac formula handles linear parabolic PDEs. For semilinear parabolic PDEs of the form tu+Lu+f(t,x,u,σu)=0\partial_t u + \mathcal{L} u + f(t, x, u, \sigma^\top \nabla u) = 0 with ff depending on uu and u\nabla u themselves, the linear formula no longer applies. The expectation is no longer well-defined because the "running payoff" ff depends on the unknown solution.

The right generalization is the backward stochastic differential equation (BSDE) of Pardoux and Peng (1990): a process (Yt,Zt)(Y_t, Z_t) satisfying dYt=f(t,Xt,Yt,Zt)dt+ZtdBtdY_t = -f(t, X_t, Y_t, Z_t)\,dt + Z_t^\top dB_t with terminal condition YT=g(XT)Y_T = g(X_T). The pair (Y,Z)(Y, Z) encodes both uu and its gradient along the path: Yt=u(t,Xt)Y_t = u(t, X_t) and Zt=σu(t,Xt)Z_t = \sigma^\top \nabla u(t, X_t). This is the nonlinear Feynman–Kac formula, and it is the mathematical object that the deep BSDE method numerically approximates.

Common Confusions

Watch Out

Forward vs backward Kolmogorov is a sign convention, not a different equation

The forward Kolmogorov (Fokker–Planck) equation tp=Lp\partial_t p = \mathcal{L}^* p evolves the density of XtX_t forward in time using the generator's adjoint. The backward Kolmogorov equation tu+Lu=0\partial_t u + \mathcal{L} u = 0 evolves a value function backward in time using the generator itself. They are not different equations; they are dual halves of the same operator, and Feynman–Kac is the explicit dictionary between them.

Watch Out

The discount factor is exp(-∫ r ds), not exp(-r(T-t))

For state-dependent or time-dependent rates r(t,x)r(t, x), the discount factor inside the expectation is the path-integrated exp(tTr(s,Xs)ds)\exp(-\int_t^T r(s, X_s)\,ds), not the simpler exp(r(Tt))\exp(-r(T-t)). The latter is correct only when rr is a constant. This becomes important in stochastic interest-rate models (Vasicek, CIR) where rr itself is an SDE; the discount factor then depends on the entire trajectory of rr, not just its starting value.

Watch Out

Feynman–Kac is for linear PDEs in u; nonlinear-in-u PDEs need BSDEs

The classical formula handles PDE coefficients that depend on (t,x)(t, x) but not on uu itself. Adding a nonlinear-in-uu term to the PDE breaks the clean expectation representation: the running cost f(t,Xs,u(t,Xs),u(t,Xs))f(t, X_s, u(t, X_s), \nabla u(t, X_s)) depends on the unknown solution and cannot be computed along a trajectory without knowing uu first. The fix is the BSDE formulation, which is implicit rather than explicit and requires solving a fixed-point problem at every step.

Exercises

ExerciseCore

Problem

Use Feynman–Kac to solve the backward heat equation tu+12xxu=0\partial_t u + \tfrac{1}{2} \partial_{xx} u = 0, u(T,x)=x2u(T, x) = x^2, on [0,T]×R[0, T] \times \mathbb{R}. Verify your answer by direct PDE substitution.

ExerciseAdvanced

Problem

Derive the Black–Scholes PDE from the discounted Feynman–Kac formula, going in the opposite direction from the worked example: start from V(t,s)=E[er(Tt)g(ST)St=s]V(t, s) = \mathbb{E}[e^{-r(T-t)} g(S_T) \mid S_t = s] for geometric Brownian motion dS=rSdt+σSdBdS = r S\,dt + \sigma S\,dB, apply Itô to ersV(s,Ss)e^{-r s} V(s, S_s), and read off the PDE.

References

No canonical references provided.

Next Topics

Last reviewed: April 18, 2026

Prerequisites

Foundations this topic depends on.

Builds on This

Next Topics