The Feynman–Kac formula, named after Richard Feynman and Mark Kac, establishes a link between parabolic partial differential equations and stochastic processes. In 1947, when Kac and Feynman were both faculty members at Cornell University, Kac attended a presentation of Feynman's and remarked that the two of them were working on the same thing from different directions. The Feynman–Kac formula resulted, which proves rigorously a real-valued analogy to Feynman's path integrals. The complex case, needed in quantum mechanics, is still an open question.
The formula offers a method of solving certain partial differential equations by simulating random paths of a stochastic process. Conversely, it can be used to compute an important class of expectations of random processes by deterministic means.
Theorem
Consider the partial differential equation<math display="block">
\frac{\partial}{\partial t}u(x,t) + \mu(x,t) \frac{\partial}{\partial x}u(x,t) + \tfrac{1}{2} \sigma^2(x,t) \frac{\partial^2}{\partial x^2}u(x,t) -V(x,t) u(x,t) + f(x,t) = 0,
</math>defined for all <math>x \in \mathbb{R}</math> and <math>t \in [0, T]</math>, subject to the terminal condition<math display="block"> u(x,T) = \psi(x), </math>where <math>\mu,\sigma,\psi,V,f</math> are known functions, <math>T</math> is a parameter, and <math>u:\mathbb{R} \times [0,T] \to \mathbb{R}</math> is the unknown function. Then the Feynman–Kac formula expresses <math>u(x,t)</math> as a conditional expectation of a certain random variable:
where <math>X_t</math> is an Itô process satisfying the stochastic differential equation<math display="block"> dX_t = \mu(X_t,t) \, dt + \sigma(X_t,t) \, dW_t, </math>and <math>W_t</math> is the Wiener process (also called Brownian motion).
Intuitive interpretation
Suppose that <math>X_t</math> describes the position at time <math>t</math> of a particle that evolves according to the diffusion process
<math display="block"> dX_t = \mu(X_t,t) \, dt + \sigma(X_t,t) \, dW_t. </math>Let the particle incur "cost" at a rate of <math>f(X_s, s)</math> at location <math>X_s</math> at time <math>s</math>. Let it incur a final cost at time <math>T</math> of <math>\psi(X_T)</math>.
Also, allow the particle to decay. If the particle is at location <math>X_s</math> at time <math>s</math>, then it decays with rate <math>V(X_s, s)</math>. After the particle has decayed away, all future cost is zero.
Then <math>u(x, t)</math> is the expected cost-to-go, if the particle starts at <math>(t, X_t = x).</math>
Partial proof
A proof that the above expected-value formula is a solution of the differential equation is long, difficult and not presented here. It is however reasonably straightforward to show that, if a solution exists, it must have the above form. The proof of that lesser result is as follows:
Derivation
Assume that <math>u(x,t)</math> satisfies the PDE:
:<math>
\frac{\partial u}{\partial t} + \mu \frac{\partial u}{\partial x} + \frac{1}{2} \sigma^2 \frac{\partial^2 u}{\partial x^2} - V u + f = 0
</math>
with terminal condition<math display="block"> u(x,T) = \psi(x). </math>Further let <math>X_t</math> be a stochastic process as defined above.
Let <math>g(t,s) = e^{-\int_t^s V(X_r, r) dr}</math>. Its differential satisfies:
:<math>
dg(t,s) = -V(X_s, s) g(t,s) \, ds.
</math>
Define the stochastic process:
:<math>
Y_s = g(t,s) u(X_s, s) + \int_t^s g(t,\tau) f(X_\tau, \tau) \, d\tau
</math>
for <math>s\in [t,T]</math>. At boundary times:
:<math>
Y_t = u(X_t, t), \quad Y_T = g(t,T) \psi(X_T) + \int_t^T g(t,\tau) f(X_\tau, \tau) \, d\tau.
</math>
If <math>Y_s</math> is a martingale, then we have
:<math>
u(x,t) = \mathbb{E}[Y_{T} \mid Y_{t}=u(x,t)] = \mathbb{E}[Y_{T} \mid X_{t}=x]
</math>
which is what we want to show. So we just need to prove <math>Y_s</math> is a martingale.
We assume <math>X_s</math> follows the SDE
:<math>
dX_s = \mu(X_s, s) \, ds + \sigma(X_s, s) \, dW_s.
</math>
By Itô's lemma:
:<math>
du(X_s, s) = \left( \frac{\partial u}{\partial s} + \mu \frac{\partial u}{\partial x} + \frac{1}{2} \sigma^2 \frac{\partial^2 u}{\partial x^2} \right) ds + \sigma \frac{\partial u}{\partial x} dW_s.
</math>
Differentiate <math>Y_s</math>:
:<math>
dY_s = d\left[g(t,s) u(X_s, s)\right] + g(t,s) f(X_s, s) \, ds.
</math>
Expand <math>d[g u]</math>:
:<math>
d[g u] = g \, du + u \, dg + \underbrace{d[g, u]}_{=0}.
</math>
Substitute <math>dg = -V g \, ds</math> and <math>du</math>:
:<math>
d[g u] = g \left( \frac{\partial u}{\partial s} + \mu \frac{\partial u}{\partial x} + \frac{1}{2} \sigma^2 \frac{\partial^2 u}{\partial x^2} \right) ds
</math>
:<math>
\qquad\quad +\; g \sigma \frac{\partial u}{\partial x} \, dW_s \;-\; V g u \, ds.
</math>
Add the integral term:
:<math>
dY_s = \left[ g \left( \frac{\partial u}{\partial s} + \mu \frac{\partial u}{\partial x} + \frac{1}{2} \sigma^2 \frac{\partial^2 u}{\partial x^2} \right) - V g u + g f \right] ds + g \sigma \frac{\partial u}{\partial x} dW_s.
</math>
For <math>Y_s</math> to be a martingale, the drift term must vanish:
:<math>
\frac{\partial u}{\partial s} + \mu \frac{\partial u}{\partial x} + \frac{1}{2} \sigma^2 \frac{\partial^2 u}{\partial x^2} - V u + f = 0.
</math>
Remarks
- The proof above that a solution must have the given form is essentially that of with modifications to account for <math>f(x,t)</math>.
- The expectation formula above is also valid for N-dimensional Itô diffusions. The corresponding partial differential equation for <math> u:\mathbb{R}^N\times [0,T] \to\mathbb{R}</math> becomes: <math display="block">\frac{\partial u}{\partial t} + \sum_{i=1}^N \mu_i(x,t)\frac{\partial u}{\partial x_i} + \frac{1}{2} \sum_{i=1}^N \sum_{j=1}^N\gamma_{ij}(x,t) \frac{\partial^2 u}{\partial x_i \partial x_j} -r(x,t)\,u = f(x,t), </math> where, <math display="block"> \gamma_{ij}(x,t) = \sum_{k=1}^N \sigma_{ik}(x,t)\sigma_{jk}(x,t),</math> i.e. <math>\gamma = \sigma \sigma^{\mathrm{T</math>, where <math>\sigma^{\mathrm{T</math> denotes the transpose of <math>\sigma</math>.
- More succinctly, letting <math>A</math> be the infinitesimal generator of the diffusion process,<math display="block">\frac{\partial u}{\partial t} + A u -r(x,t)\,u = f(x,t). </math>
- This expectation can then be approximated using Monte Carlo or quasi-Monte Carlo methods.
Original formulation about Wiener functionals
When originally published by Kac in 1949, the formula was presented as a means for determining the distribution of certain Wiener functionals. Suppose we wish to find the expected value of the function
<math display="block">
\exp\left(-\int_0^t V(x(\tau))\, d\tau\right)
</math>in the case where x(t) is some realization of a diffusion process starting at . The Feynman–Kac formula says that this expectation is equivalent to the integral of a solution to a corresponding diffusion equation. Specifically, under the conditions that <math>V(x) \geq 0</math>,
<math display="block">
\mathbb{E}\left[\exp\left(- \int_0^t V(x(\tau))\, d\tau\right) \right] = \int_{-\infty}^{\infty} w(x,t)\, dx </math> where is the solution to the parabolic partial differential equation <math display="block">\frac{\partial w}{\partial t} = \frac{1}{2} \frac{\partial^2 w}{\partial x^2} - V(x) w
</math>with initial condition .
The Feynman–Kac formula can also be used to evaluate functional integrals of a certain form. If, for example,<math display="block">
I = \int f(x(0)) \exp\left(-\int_0^t V(x(\tau))\, d\tau\right) g(x(t))\, Dx </math>where the notation <math>Dx</math> refers to integration taken over all random walks <math>x : [0,t]\to\R</math>, then <math display="block"> I = \int_{-\infty}^{\infty} w(x,t) g(x)\, dx </math> where is the solution to <math display="block"> \frac{\partial w}{\partial t} = \frac{1}{2} \frac{\partial^2 w}{\partial x^2} - V(x) w </math> with initial condition .
Example
In practical applications, the Feynman–Kac formula can be used with numerical methods like Euler-Maruyama to numerically approximate solutions to partial differential equations. For instance, it can be applied to the convection–diffusion partial differential equation (PDE):
:<math>\frac{\partial}{\partial t} u(x, t) + b \frac{\partial}{\partial x} u(x, t) = -\sigma^2 \frac{\partial^2}{\partial x^2} u(x, t)</math>
Consider the convection–diffusion PDE with parameters <math>b = 1</math>, <math>\sigma = 1</math> and terminal condition <math>u(x,T) = e^{-x^2}</math> with <math>T = 1</math>. Then the PDE can be solved analytically:
:<math>u(x, t) = \frac{1}{\sqrt{5 - 4t \exp \left(-\frac{(1 - t + x)^2}{5 - 4t} \right)</math>
Applying the Feynman-Kac formula, the solution can also be written as the conditional expectation:
:<math>u(x, t) = \mathbb{E}\left[e^{-X_{T}^2}\, \bigl| \, X_t = x\right]</math>
where <math>X</math> is an Itô process governed by the SDE <math>dX_t = dt + \sqrt{2} dW_t</math> and <math>W_t</math> is a Wiener process. Then using the Euler-Maruyama method, the SDE can be numerically integrated forwards in time from the initial condition <math>(x_0, t_0)</math> till the terminal time <math>T,</math> yielding simulated values of <math>X_T</math>. To approximate the expectation in the Feynman-Kac method, the simulation is repeated <math>N</math> times. These are often called realizations. The solution is then estimated by the Monte Carlo average
:<math>u(x_0, t_0) \approx \frac{1}{N} \sum_{i=1}^{N} \exp\left( - \left( X_T^{(i)} \right)^2 \right)</math>
The figure below compares the analytical solution with the numerical approximation obtained using the Euler–Maruyama method with <math>N = 1000</math>. The left-hand plots show vertical slices of the gradient plot on the right, with each vertical line on the surface corresponding to a colored curve on the left. While the numerical solution exhibits some noise, it closely follows the shape of the exact solution. Increasing the number of simulations <math>N</math> or decreasing the Euler–Maruyama time step improves the accuracy and reduces the variance of the approximation.
thumb|Exact solution (below) and Euler-Maruyama (top) approximation to the convection-diffusion PDE. Time slices of the gradient plot are plotted on the left.|center|400x400px
This example illustrates how stochastic simulation, enabled by the Feynman–Kac formula and numerical methods like Euler–Maruyama, can approximate PDE solutions. In practice, such stochastic approaches are especially valuable when dealing with high-dimensional systems or complex geometries where traditional PDE solvers become computationally prohibitive. One key advantage of the SDE-based method is its natural parallelism—each simulation, or realization, can be computed independently—making it well-suited for high-performance computing environments. While stochastic simulations introduce variance, this can be mitigated by increasing the number of realizations or refining the time discretization. Thus, stochastic differential equations provide a flexible and scalable alternative to deterministic PDE solvers, particularly in contexts where uncertainty is intrinsic or dimensionality poses a computational barrier. In contrast to traditional PDE solvers, which typically require solving for the entire solution over a grid, this method enables direct computation at specific points in space and time. This targeted approach allows computational resources to be focused on regions of interest, potentially resulting in substantial efficiency gains.
Applications
Finance
In quantitative finance, the Feynman–Kac formula is used to efficiently calculate solutions to the Black–Scholes equation to price options on stocks and zero-coupon bond prices in affine term structure models.
For example, consider a stock price <math>S_t</math> undergoing geometric Brownian motion
<math display="block">dS_t = \left(r_t dt + \sigma_t dW_t\right) S_t
</math>
where <math>r_t</math> is the risk-free interest rate and <math>\sigma_t</math> is the volatility. Equivalently, by Itô's lemma,
<math display="block">
d\ln S_t = \left(r_t - \tfrac 1 2 \sigma_t^2\right)dt + \sigma_t \, dW_t.
</math>
Now consider a European call option on an <math>S_t</math> expiring at time <math>T</math> with strike <math>K</math>. At expiry, it is worth <math>(X_T - K)^+.</math> Then, the risk-neutral price of the option, at time <math>t</math> and stock price <math>x</math>, is
<math display="block">
u(x, t) = \operatorname{E}\left[e^{-\int_t^T r_s ds} (S_T - K)^+ | \ln S_t = \ln x \right].
</math>
Plugging into the Feynman–Kac formula, we obtain the Black–Scholes equation:
<math display="block">\begin{cases}
\partial_t u + Au - r_t u = 0 \\
u(x, T) = (x-K)^+
\end{cases}</math>
where
<math display="inline">
A = (r_t -\sigma_t^2/2)\partial_{\ln x} + \frac 12 \sigma_t^2 \partial_{\ln x}^2 = r_t x\partial_x + \frac 1 2 \sigma_t^2 x^2 \partial_{x}^2.
</math>
More generally, consider an option expiring at time <math>T</math> with payoff <math>g(S_T)</math>. The same calculation shows that its price <math>u(x,t)</math> satisfies
<math display="block">\begin{cases}
\partial_t u + Au - r_t u = 0 \\
u(x, T) = g(x).
\end{cases}</math>
Some other options like the American option do not have a fixed expiry. Some options have value at expiry determined by the past stock prices. For example, an average option has a payoff that is not determined by the underlying price at expiry but by the average underlying price over some predetermined period of time. For these, the Feynman–Kac formula does not directly apply.
Quantum mechanics
In quantum chemistry, it is used to solve the Schrödinger equation with the pure diffusion Monte Carlo method.
See also
- Itô's lemma
- Kunita–Watanabe inequality
- Girsanov theorem
- Kolmogorov backward equation
- Kolmogorov forward equation (also known as Fokker–Planck equation)
- Stochastic mechanics
