%% ================================================================
\newpage
\section{The It\=o perspective on the Feynman-Kac formula}

%% ----------------------------------------------------------------
\subsection{The It\=o formula in one dimension}

\begin{defn}
Let $b_t$ be one-dimensional Brownian motion.  Let $e(t,x)$ and $f(t,x)$ be
$\mcF_t$-measurable where $\mcF_t$ is the filtration of Brownian motion.  Then
$$
	dX_t = e(t,X_t)\,dt + f(t,X_t)\,db_t
$$
is called an \emphidx{It\=o process}.
\end{defn}

\begin{prop}
\label{prop:ito_1d}
If
\begin{align}
\label{eqn:dX_edt_fdb}
	dX_t = e(t,X_t)\,dt + f(t,X_t)\,db_t
\end{align}
is an It\=o process and
$$
	y = g(t,x)
$$
is a $C^2$ map from $[0,+\infty) \times \R$ to $\R$, then
$$
	Y_t = g(t, X_t)
$$
is again an It\=o process with
\begin{align}
\label{eqn:ito_1d_1}
	dY_t = \fracDgt(t,X_t)\,dt + \fracDgx(t,X_t)\,dX_t
		+ \frac{1}{2} \fracDgxx(t,X_t)\,dX_t^2.
\end{align}
\begin{rem*}
Recall that we use the It\=o calculus rules
$$
	db_t^2 = dt, \qquad
	dt^2 = 0, \qquad
	dt\,db_t = 0
$$
when expanding $dX_t^2$.
\end{rem*}
\begin{rem*}
If we expand $dX_t$ (equation \ref{eqn:dX_edt_fdb}) into \ref{eqn:ito_1d_1},
we obtain an alternate expression
\begin{align}
\label{eqn:ito_1d_2}
	dX_t^2 &= e^2\,dt^2 + 2ef\,dt\,db_t + f^2 db_t^2 = f^2 dt \\
	dY_t &= \fracDgt(t,X_t)\,dt + \fracDgx(t,X_t)\,(e(t,X_t)\,dt
		+ f(t,X_t)\,db_t) + \frac{f(t,X_t)^2}{2} \fracDgxx(t,X_t)\,dt \\
	&= \left(\fracDgt(t,X_t)
		+ e(t,X_t)\,\fracDgx(t,X_t)
		+ \frac{f(t,X_t)^2}{2} \fracDgxx(t,X_t)
		\right)\,dt
		+ f(t,X_t)\,\fracDgx(t,X_t)\,db_t.
\end{align}
\end{rem*}
\end{prop}

%% ----------------------------------------------------------------
\subsection{The It\=o formula in higher dimensions}

\begin{prop}
\label{prop:ito_nd}
Let
$$
	\colvecthree{dX^{(1)}_t}{\vdots}{dX^{(n)}_t}
	=
	\colvecthree{u_1\,dt}{\vdots}{u_n\,dt}
	+
	\prmatrix{
		v_{1,1} & \cdots & v_{1,m} \\
		\vdots  &        & \vdots  \\
		v_{n,1} & \cdots & v_{n,m} \\
	}
	\colvecthree{db^{(1)}_t}{\vdots}{db^{(m)}_t},
$$
i.e. in matrix notation
$$
	d\vecX_t = \vecu\,dt + \vecV \,d\vecb_t.
$$
(This is called am $n$-dimensional It\=o process.)
Let $\vecg:[0,+\infty) \times \R^n \to \R^p$ be a $C^2$ map:
$$
	\colvecthree{y_1}{\vdots}{y_p}
	= \colvecthree
		{g_1(t, \vecx)}
		{\vdots}
		{g_p(t, \vecx)}
	= \colvecthree
		{g_1(t, x_1, \ldots, x_n)}
		{\vdots}
		{g_p(t, x_1, \ldots, x_n)}.
$$
Then
$$
	\vecY_t = \vecg(t, \vecX_t)
$$
is again an It\=o process with $k$th component (for $k = 1, \ldots, p$)
$$
	dY^{(k)}_t
		= \fracDgt(t,\vecX_t)\,dt
		+ \sum_{i=1}^n \frac{\Dg_k}{\Dx_i} (t,\vecX_t)\, dX^{(i)}_t
		+ \frac{1}{2} \sum_{i,j=1}^n \frac{\D^2 g_k}{\Dx_i \Dx_j}
			(t,\vecX_t)\, dX^{(i)}_t \,dX^{(j)}_t.
$$
\begin{rem*}
Recall that we use the It\=o calculus rules
$$
	db^{(i)}_t \, db^{(j)}_t = \delta_{ij}, \qquad
	dt^2 = 0, \qquad
	dt\,db^{(i)}_t = 0
$$
when expanding $dX^{(i)}_t \, dX^{(j)}_t$.
\end{rem*}
\end{prop}

\begin{cor}
\label{prop:stochastic_product_rule}
If $X_t$ and $Y_t$ are stochastic processes then
$$
	d(X_t Y_t) = X_t\,dY_t + Y_t\,dX_t + dX_t\,dY_t.
$$
\begin{proof}
Use the proposition with $g(x,y) = xy$.
\end{proof}
\end{cor}

%% ----------------------------------------------------------------
\subsection{The Feynman-Kac formula}

The following is adapted from \cite{bib:lawler}.  See \cite{bib:oksendal}
for a uniqueness proof.

\begin{prop}
The solution to the partial differential equation
\begin{align}
\label{eqn:fk1_stop}
	\fracDphit(t,x)
		&= \frac{f(x)^2}{2} \fracDphixx(t,x)
		+ e(x) \fracDphix(t,x) + g(x) \phi(t,x)
\end{align}
with initial condition
$$
	\phi(0,x) = h(x)
$$
is
\begin{align}
\label{eqn:fk1_start}
	\phi(t,x) &= \bbE_0^x\left[
		h(X_t) \exp\left\{ \int_0^t g(X_u) \,du \right\}
	\right],
\end{align}
where $X_t$ satisfies
$$
	dX_t = e(X_t)\,dt + f(X_t)\,db_t.
$$
(We assume that this expectation exists for all $t,x$.)

\begin{rem*}
We call $X_t$ a \emphidx{time homogeneous diffusion}, or simply a
\emphidx{diffusion}, since $e$ and $f$ depend on $X_t$ but not on $t$ directly.
Note that $X_t$ is Markovian.

\end{rem*}
\begin{proof}
Let $\phi(t,x)$ be given by equation \ref{eqn:fk1_start}.  We will show that
it satisfies \ref{eqn:fk1_stop}.
For brevity, write
$$
	J_t = \exp\left\{\int_0^t g(X_u)\,du \right\}.
$$
Note that for $s<t$,
\begin{align*}
	J_t &= \exp\left\{\int_0^t g(X_u)\,du \right\}
	= \exp\left\{\int_0^s g(X_u)\,du \right\}
		\exp\left\{\int_s^t g(X_u)\,du \right\}
	= J_s
		\exp\left\{\int_s^t g(X_u)\,du \right\}.
\end{align*}
If $s<t$ then, since $J_s$ is $\mcF$-measurable,
\begin{align*}
	\bbE[h(X_t)J_t\mid \mcF_s]
	&= J_s \bbE\left[
		h(X_t) \exp\left\{ \int_s^t g(X_u) \,du \right\}
		\mid \mcF_s
		\right] \\
	%
	&= J_s \phi(t-s,X_s).
\end{align*}
Call this quantity $M_s$.  We claim that it is a martingale for $0 \le s < t$.
To see this, suppose $r<s$.  Then
\begin{align*}
	\bbE\Bigg[\bbE\bigg[h(X_t) J_t \mid \mcF_s\bigg] \mid \mcF_r\Bigg]
		&= \bbE[h(X_t) J_t \mid \mcF_r].
\end{align*}

Using the stochastic product rule (proposition
\ref{prop:stochastic_product_rule}), we have
\begin{align*}
	dM_s &=
		J_s\, d\phi(t-s,X_s)
		+ dJ_s\, \phi(t-s,X_s)
		+ dJ_s\, d\phi(t-s,X_s).
\end{align*}
For the first differential, using the chain rule and the second fundamental
theorem of calculus,
\begin{align*}
	dJ_s &= \fracDs\left(\exp\left\{\int_0^s g(X_u)\,du \right\}\right)\,ds
	= \exp\left\{\int_0^s g(X_u)\,du \right\} g(X_s) \,ds
	= J_s \,g(X_s)\,ds.
\end{align*}
For the second differential, applying the It\=o formula (assuming sufficient
differentiability) in the form of equation \ref{eqn:ito_1d_2} to $Y_s =
\phi(t-s, X_s)$, we obtain
\begin{align*}
	d\phi(t-s,X_s)
	&= \left(\fracDphis(t-s,X_s)
		+ e(X_s)\,\fracDphix(t-s,X_s)
		+ \frac{f(X_s)^2}{2} \fracDphixx(t-s,X_s)
		\right)\,ds \\
	&+ f(X_s)\,\fracDphix(t-s,X_s)\,db_s.
\end{align*}
The third product term $dJ_s\,d\phi(t-s,X_s)$ is zero since its differentials
are of the form $ds^2$ and $ds\,db_s$.  Then
\begin{align*}
	dM_s &=
		J_s\,
		\left(\fracDphis(t-s,X_s)
			+ e(X_s)\,\fracDphix(t-s,X_s)
			+ \frac{f(X_s)^2}{2} \fracDphixx(t-s,X_s)
			\right)\,ds \\
	& + J_s \,f(X_s)\,\fracDphix(t-s,X_s)\,db_s
	+ J_s \,g(X_s) \, \phi(t-s,X_s) \,ds.
\end{align*}
Since $M_s$ is a martingale, the $ds$ terms must sum to zero.  There is a
common factor of $J_s$, but the exponential function is everywhere non-zero so
the following four terms must be zero:
\begin{align*}
	0 &=
	\fracDphis(t-s,X_s)
	+ e(X_s) \fracDphix(t-s, X_s)
	+ \frac{f(X_s)^2}{2} \fracDphixx(t-s, X_s)
	+ g(X_s) \phi(t-s,X_s) \\
	%
	-\fracDphis(t-s,X_s)
	&=
	\frac{f(X_s)^2}{2} \fracDphixx(t-s, X_s)
	+ e(X_s) \fracDphis(t-s, X_s)
	+ g(X_s) \phi(t-s,X_s).
\end{align*}
Putting $s=0$ and recalling $X_0=x$, we are done:
\begin{align*}
	\fracDphit(t,x)
	&=
	\frac{f(x)^2}{2} \fracDphixx(t, x)
	+ e(x) \fracDphix(t, x)
	+ g(x) \phi(t,x).
\end{align*}
\end{proof}
\end{prop}

\begin{rem}
In the context of the diffusion equation, where
$$
	\frac{\D\psi(t,\vecx)}{\Dt} = c\nabla^2 \psi(t,\vecx)
		+ U(\vecx)\psi(t,\vecx),
$$
this is
$$
	\psi(t,\vecx) = \bbE_0^\vecx\left[
		\psi(0, \vecw_{c,t})
			\exp\left\{\int_0^t U(\vecw_{c,s})\,ds\right\}
		\right].
$$
This matches proposition \ref{prop:diffusion_FK}.
\end{rem}
