Skip to content
All library documents

Solving a Quadratic-Payoff PDE with Feynman–Kac

Article Quant Q&A · Author: Rama

Summary

The document solves a pricing PDE with geometric Brownian motion dynamics and a squared terminal payoff. It uses Feynman–Kac to express the value as a discounted expectation, then expands the square so that only the first two moments of the process are needed. Itô’s formula applied to the squared process gives its drift and leads to closed-form expressions for both moments.

A second derivation transforms the PDE into the heat equation using time-to-maturity, log price, and discounting, then evaluates the convolution through exponential moments of the heat kernel. Both routes produce the same formula. The example illustrates how a polynomial payoff can simplify the expectation calculation without integrating the full lognormal density. The setup assumes constant interest rate and volatility and follows the stated diffusion; it does not discuss calibration, numerical methods, or whether this payoff corresponds to a particular traded contract.

Key ideas

  • Feynman–Kac represents the PDE solution as a discounted expectation under the specified diffusion.
  • Expanding the squared payoff reduces valuation to the first and second moments of the terminal process.
  • Itô’s formula provides the evolution of the squared process and its expected value.
  • A log-coordinate transformation converts the pricing PDE into a heat equation.
  • The martingale and PDE derivations agree under the model assumptions.

Tags

Full text
# How to solve this PDE using Feynman-Kac?


# How to solve this PDE using Feynman-Kac?












I have the following problem right now: solve $$F_t(t,x) + rxF_x(t,x) + \frac{\sigma^2}{2}F_{xx}(t,x) = rF(t,x), \\ F(T,x) = (x - K)^2.$$

How do I solve this?

There exists a theorem to solve this, which represents $F(t,x)$ as the discounted expected value of $(X - k)^2$ where $dX = rXds + \sigma X dW$ and with $X_t = x$.

However, my issues are mainly centered around how messy my calculations get. If I try to solve the above by first calculating $X_s$ since it satisfies a GBM, and then calculating its expectation after first squaring it in the way I need to $(X - k)^2$, the calculations get incredibly messy, and all I get is a whole lot of $\exp$'s to a bunch of powers that vaguely resemble one another but it still doesn't simplify easily.

Have I made a mistake, or is the answer really that messy?

## Answer by LocalVolatility (score 5)

https://quant.stackexchange.com/a/32034

### Martingale Approach

As you noted, you need to solve

\begin{eqnarray} F(0) & = & e^{-r T} \mathbb{E} \left[ \left( X_T - K \right)^2 \right]\\ & = & e^{-r T} \left( \mathbb{E} \left[ X_T^2 \right] - 2 K \mathbb{E} \left[ X_T \right] + K^2 \right) \end{eqnarray}

Let $Y_t = X_t^2$. Then, by applying the Itō formula, we get

\begin{eqnarray} \mathrm{d}Y_t & = & 2 X_t \mathrm{d}X_t + \mathrm{d} \langle X \rangle_t\\ & = & \left( 2 r + \sigma^2 \right) Y_t \mathrm{d}t + 2 \sigma Y_t \mathrm{d}W_t. \end{eqnarray}

It follows that

\begin{eqnarray} \mathbb{E} \left[ X_T \right] & = & X_0 e^{r T},\\ \mathbb{E} \left[ X_T^2 \right] & = & X_0^2 e^{\left( 2 r + \sigma^2 \right) T}. \end{eqnarray}

Consequently,

\begin{equation} F(0) = e^{-r T} \left( X_0^2 e^{\left( 2 r + \sigma^2 \right) T} - 2 K X_0 e^{r T} + K^2 \right). \end{equation}

### PDE Approach

Alternatively, you can apply a change of variables to the PDE. Define

\begin{equation} \tau = (T - t), \quad \xi = r - \frac{1}{2} \sigma^2, \quad y = \ln(x) + \xi \tau, \quad F(t, x) = e^{-r \tau} G(\tau, y). \end{equation}

After carefully applying the chain rule, we obtain the PDE

\begin{equation} \frac{\partial G}{\partial \tau} = \frac{1}{2} \sigma^2 \frac{\partial^2 G}{\partial y^2} \end{equation}

with initial condition

\begin{equation} G(0, y) = \left( e^y - K \right)^2. \end{equation}

The fundamental solution is the heat kernel given by

\begin{equation} \phi(\tau, y) = \frac{1}{\sqrt{2 \pi \sigma^2 \tau}} \exp \left\{ -\frac{y^2}{2 \sigma^2 \tau} \right\}. \end{equation}

We obtain $G(\tau, y)$ through the convolution

\begin{eqnarray} G(\tau, y) & = & \int_{-\infty}^\infty G(0, z) \phi(\tau, y - z) \mathrm{d}z\\ & = & \int_{-\infty}^\infty \left( e^{2 z} - 2 K e^z + K^2 \right) \phi(\tau, y - z) \mathrm{d}z. \end{eqnarray}

Next note that for some $\alpha \in \mathbb{R}$,

\begin{eqnarray} \int_{-\infty}^\infty e^{\alpha z} \phi(\tau, y - z) \mathrm{d}z & = & e^{\alpha y + \alpha^2 \sigma^2 \tau / 2} \end{eqnarray}

Thus

\begin{equation} G(\tau, y) = e^{2 y + 2 \sigma^2 \tau} - 2 K e^{y + \sigma^2 \tau / 2} + K^2 \end{equation}

and substituting back yields

\begin{equation} F(0, x) = e^{-r T} \left( x^2 e^{\left( 2 r + \sigma^2 \right) T} - 2 K x e^{r T} + K^2 \right) \end{equation}

as before.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.