Probability & Statistics

The Feynman-Kac Formula: PDEs Solved by Random Paths

The Feynman-Kac formula lets you solve a second-order parabolic PDE by averaging over random walkers: instead of discretizing a grid, you release Brownian particles from a point, let them wander, weight each path by the accumulated potential it feels, and take the expectation. The value of the solution at (t, x) is literally the mean over all paths starting there.

Precisely: if u solves ∂u/∂t + ½σ²Δu + b·∇u − Vu = 0 with terminal data u(T, ·) = f, then u(t, x) = 𝔼[ f(X_T) · exp(−∫ₜᵀ V(X_s) ds) | X_t = x ], where X is the diffusion with drift b and diffusion coefficient σ. The parabolic PDE and the stochastic average are the same object viewed two ways.

  • FieldProbability theory / PDE theory
  • Named forRichard Feynman (1948) & Mark Kac (1949)
  • Statementu(t,x) = 𝔼[f(X_T)·exp(−∫ₜᵀV(X_s)ds) | X_t=x]
  • Key hypothesisV bounded below; f of polynomial growth; drift/diffusion Lipschitz
  • Proof techniqueItô's formula → the weighted process is a martingale
  • GeneralizesKolmogorov backward equation (V ≡ 0)

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

1. The precise statement

Fix a diffusion X on ℝⁿ solving the SDE dX_s = b(X_s) ds + σ(X_s) dW_s, where W is standard Brownian motion, and assume b, σ are Lipschitz with linear growth (so a unique strong solution exists and does not explode). Let L = ½ ∑ᵢⱼ aᵢⱼ ∂ᵢ∂ⱼ + ∑ᵢ bᵢ ∂ᵢ be its generator, with a = σσᵀ. Let V (the potential) be continuous and bounded below, and f continuous of at most polynomial growth.

Suppose u ∈ C¹,²([0,T]×ℝⁿ) solves the terminal-value problem

∂u/∂t + Lu − V·u = 0, u(T, x) = f(x),

with u of polynomial growth. Then u admits the stochastic representation

u(t, x) = 𝔼[ f(X_T) · exp(−∫ₜᵀ V(X_s) ds) | X_t = x ].

The conditioning X_t = x means we start the diffusion at x at time t. This is a uniqueness statement: any classical solution of the given growth must equal this expectation, so there is at most one.

2. The picture: random walkers carrying a discount

Imagine dropping a cloud of particles at x at time t, each executing the diffusion X. By time T they have spread out; a particle lands wherever its random path took it, and there we read off the payoff f(X_T). The solution at (t, x) is the average payoff over the cloud — this is already the Kolmogorov backward equation when V ≡ 0.

The potential V adds bookkeeping. Along each path we accumulate ∫ₜᵀ V(X_s) ds and weight the payoff by exp(−that). If you interpret V as a killing rate, a particle in a region of high V is more likely to be annihilated; exp(−∫V) is exactly the survival probability of a particle killed at rate V(X_s). So Feynman-Kac says: propagate, but let paths through high-potential regions decay. Positive V discounts; negative V amplifies. This is why the same formula prices options (V = interest rate) and computes quantum-mechanical ground states in imaginary time (V = the physical potential).

3. Key idea of the proof: build a martingale

The engine is Itô's formula plus the observation that a cleverly weighted process is a martingale. Define the discount factor D_s = exp(−∫ₜˢ V(X_r) dr) and consider

M_s = D_s · u(s, X_s), t ≤ s ≤ T.

Apply Itô to u(s, X_s) and the product rule with D_s (which has finite variation, dD_s = −V(X_s)D_s ds). The drift terms collect into

D_s (∂u/∂t + Lu − V·u)(s, X_s) ds = 0,

which vanishes precisely because u solves the PDE. What remains is the stochastic integral D_s (σᵀ∇u)(s,X_s)·dW_s, a local martingale. The polynomial-growth / boundedness hypotheses promote it to a true martingale (uniformly integrable on [t,T]). Then 𝔼[M_T | X_t=x] = M_t, i.e. u(t,x) = 𝔼[D_T f(X_T)], since M_t = u(t,x) and M_T = D_T u(T,X_T) = D_T f(X_T). The PDE's job is to kill the drift; the martingale property does the rest.

4. Canonical example: the heat equation and Black-Scholes

Heat equation. Take n = 1, b = 0, σ = 1, V = 0, so X_s = x + (W_s − W_t) is Brownian motion. The PDE ∂u/∂t + ½∂²u/∂x² = 0 with u(T,·)=f gives u(t,x) = 𝔼[f(x + W_{T−t})] = ∫ f(y) (2π(T−t))^{−1/2} exp(−(y−x)²/(2(T−t))) dy — the Gaussian heat kernel drops out of the expectation automatically.

Black-Scholes. Under the risk-neutral measure a stock follows dS = rS dt + σS dW. A European claim with payoff f(S_T) has price satisfying ∂V/∂t + ½σ²S²∂²V/∂S² + rS ∂V/∂S − rV = 0. Here the potential is the constant r, so Feynman-Kac gives the famous discounted-expectation formula

V(t, S) = e^{−r(T−t)} 𝔼[ f(S_T) | S_t = S ].

Plugging f = (S_T − K)⁺ and the lognormal law of S_T recovers the closed-form Black-Scholes price. The 'discount factor' e^{−r(T−t)} is exactly exp(−∫ₜᵀ r ds).

5. Why the hypotheses matter

V bounded below. If V can dive to −∞, the weight exp(−∫V) can blow up and the expectation diverge; the representation fails or gives +∞. Bounded-below V keeps exp(−∫ₜᵀV ds) ≤ e^{−(T−t)inf V} < ∞, so integrability survives.

Growth control on u and f. Without it, M_s is only a local martingale, and 𝔼[M_T] ≠ M_t can fail — the classic gap between local and true martingales. Polynomial growth plus the SDE's moment bounds (𝔼[sup|X_s|^p] < ∞) upgrades it. Drop this and you can have two distinct solutions, so the representation no longer pins down u.

Non-explosion / Lipschitz coefficients. Needed so X exists globally on [t,T]; superlinear drift can send X to ∞ in finite time, invalidating both Itô and the expectation.

Connections. Feynman-Kac is the parabolic cousin of the Kolmogorov backward equation, the Dirichlet-problem representation u(x)=𝔼[f(X_τ)] for harmonic functions (V=0, elliptic), and — via Wick rotation t↦it — Feynman's original path integral for the Schrödinger equation.

6. Applications and significance

Feynman-Kac is the bridge that made Monte Carlo methods for PDEs possible: to estimate u(t,x), simulate many paths of X, average f(X_T)exp(−∫V). In n dozens of dimensions this beats grid methods, which suffer the curse of dimensionality — the reason quantitative finance prices high-dimensional basket options by simulation.

In mathematical finance it underlies the entire risk-neutral pricing framework: every derivative price is a discounted expectation, and the pricing PDE and the expectation are Feynman-Kac duals. In quantum physics and statistical mechanics, imaginary-time Feynman-Kac represents e^{−tH} (with H = −½Δ + V) as a path integral, powering diffusion Monte Carlo and rigorous spectral bounds; Kac used it to study Wiener-sausage and ground-state energies. It also gives probabilistic proofs of PDE facts — maximum principles, Harnack inequalities, spectral gap estimates — and, run in reverse, lets PDE regularity theory certify smoothness of expectations. The formula is a cornerstone of modern stochastic analysis precisely because it converts an analytic problem into a sampling problem and back.

The PDE-probability dictionary: each analytic object corresponds to a probabilistic one.
PDE sideProbabilistic sideRole
Generator ½σ²Δ + b·∇Diffusion X_t (SDE dX = b dt + σ dW)Second-order operator ↔ Markov process
Potential term −V·uWeight exp(−∫V(X_s)ds)Zeroth-order coefficient ↔ path killing rate
Terminal data u(T,·)=fPayoff f(X_T)Boundary condition ↔ final observable
Source term +gAdditive ∫ₜᵀ g(X_s)e^{−∫V} dsInhomogeneity ↔ running cost
Elliptic −Lu + Vu = h𝔼[∫₀^τ h(X_s)e^{−∫V}ds]Stationary problem ↔ stopped expectation

Frequently asked questions

Why must the potential V be bounded below rather than bounded?

Bounded below is what guarantees the weight exp(−∫ₜᵀ V(X_s) ds) stays finite: since V ≥ inf V, the integral is ≥ (T−t)·inf V, so the exponential is ≤ e^{−(T−t) inf V} < ∞. If V could go to −∞ the exponential could blow up and the expectation diverge. An upper bound is not needed for finiteness — large positive V just makes the weight small (strong killing), which is harmless.

What is the difference between Feynman's and Kac's contributions?

Feynman (1948) introduced the path-integral heuristic for the Schrödinger equation, an oscillatory 'sum over histories' e^{iS/ℏ} that is not a genuine measure. Kac (1949), hearing Feynman lecture, realized that in imaginary time (the heat/diffusion equation) the oscillatory integral becomes a bona fide Wiener-measure expectation, which he could make fully rigorous. Kac's version is the theorem; Feynman's is the physicist's inspiration.

Does the formula require u to be a classical (C¹,²) solution?

The clean statement does, because the proof applies Itô's formula to u(s, X_s), which needs u to be C¹ in time and C² in space. However, one can run the logic the other direction: define u by the expectation and, under Hörmander-type hypoellipticity or uniform ellipticity of a, prove it is smooth and solves the PDE. There are also viscosity-solution versions that handle nonsmooth data, at the cost of a weaker notion of solution.

How does Feynman-Kac relate to the Kolmogorov backward equation?

The Kolmogorov backward equation is exactly the V ≡ 0 case: ∂u/∂t + Lu = 0 with u(T,·)=f gives u(t,x)=𝔼[f(X_T)|X_t=x], the plain expectation of the payoff. Feynman-Kac generalizes it by adding the zeroth-order term −Vu, whose probabilistic effect is to insert the discount/killing weight exp(−∫V). So Feynman-Kac = Kolmogorov backward + a Feynman potential.

Why is it a terminal-value problem (data at time T) instead of an initial-value problem?

Because the diffusion runs forward from t to T while the PDE runs backward. The operator ∂u/∂t + Lu is the backward Kolmogorov operator; fixing data at T and solving toward smaller t matches the martingale M_s = D_s u(s,X_s) run over t ≤ s ≤ T. You can convert to a standard forward heat equation by the time reversal τ = T − t, which flips the sign and turns the terminal condition into an initial one.

Can Feynman-Kac handle source terms and boundaries?

Yes. A source term +g in the PDE (∂u/∂t + Lu − Vu + g = 0) adds a running integral: u(t,x)=𝔼[f(X_T)e^{−∫ₜᵀV} + ∫ₜᵀ g(X_s) e^{−∫ₜˢ V} ds]. For a spatial domain with boundary data, you stop the diffusion at the exit time τ of the domain and evaluate the boundary condition at X_τ — this is the elliptic Dirichlet-problem version, u(x)=𝔼ₓ[f(X_τ)e^{−∫₀^τ V}] plus the source integral to τ.