%% ================================================================
\newpage
\section{It\=o formulas}

The following are elaborations on \cite{bib:oksendal} See also \cite{bib:gs}
and/or \cite{bib:lawler} for more background information on Brownian motion,
martingales, and stochastic differential equations.

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

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{prop}
\label{prop:ito_1d}
If
\begin{align}
\label{eqn:dX_edt_fdb}
	dX_t = e(X_t,t)\,dt + f(X_t,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\,dt + f\,db_t)
		+ \frac{f^2}{2} \fracDgxx(t,X_t)\,dt \\
	&= \left(\fracDgt(t,X_t)
		+ e\,\fracDgx(t,X_t)
		+ \frac{f^2}{2} \fracDgxx(t,X_t)
		\right)\,dt
		+ f\,\fracDgx(t,X_t)\,db_t.
\end{align}
\end{rem*}
\end{prop}

\textbf{Derivation:}
This is not a proof (see e.g. \cite{bib:oksendal} section 4.1) --- rather, it is a
heuristic discussion intended to remind me why which terms appear where:

\begin{itemize}

\item Start with
	$$
		dX_t = e(X_t, t)\,dt + f(X_t,t)\,db_t.
	$$

\item Consider
	$$
		Y_t = g(X_t,t).
	$$

\item We need to show (using the formulation of equation \ref{eqn:ito_1d_2})
	$$
		dY_t = \left(\fracDgt(t,X_t)
		+ e\,\fracDgx(t,X_t)
		+ \frac{f^2}{2} \fracDgxx(t,X_t)
		\right)\,dt
		+ f\,\fracDgx(t,X_t)\,db_t.
	$$

\item Using the shorthand partial-derivative notation $g_t = \Dg/\Dt$ etc.,
Taylor-expand $dY$ as
	\begin{align*}
		dY &= g_t \,dt + g_x \,dX + \frac{g_{tt}}{2} \,dt^2
			+ \frac{g_{xx}}{2} \,dX^2 + g_{tx} \,dt \,dX
			+ \textrm{higher order terms} \\
		%
		&= g_t \,dt + g_x (e\,dt+f\,db_t) + \frac{g_{tt}}{2} \,dt^2
			+ \frac{g_{xx}}{2} (e\,dt+f\,db_t)^2 + g_{tx} \,dt (e\,dt+f\,db_t)
			+ \ldots.
	\end{align*}

\item Use $dt^2=0$, $dt\,db_t=0$, $db_t^2=dt$:
	\begin{align*}
		dY &= g_t \,dt + g_x (e\,dt+f\,db_t) + \frac{g_{xx}}{2} f^2 \,dt \\
		&= g_t \,dt + e\, g_x\,dt + f^2 \,\frac{g_{xx}}{2} \,dt + f\,g_x\,db_t\\
		&= \left(g_t + e\, g_x + f^2 \,\frac{g_{xx}}{2}\right) \,dt
			+ f\,g_x\,db_t.
	\end{align*}

\end{itemize}

The following two cases appear more often in the problem solutions than the
general statement of proposition \ref{prop:ito_1d}, so they are worth writing
down to relieve the brain of the task of error-prone on-the-fly relabeling.

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{prop}
\label{prop:ito_1d_b_t}
Special case with $e=0$ and $f=1$: If $x = g(t,u)$ is $C^2$ then
$$
	X_t = g(t,b_t)
$$
is an It\=o process with
\begin{align}
	dX_t &= \fracDgt(t,b_t)\,dt
		+ \fracDgu(t,b_t)\,dX_t
		+ \frac{1}{2} \fracDguu(t,b_t)\,dX_t^2 \\
	&= \left(\fracDgt(t,b_t)
		+ \frac{1}{2} \fracDguu(t,b_t)\right)\,dt
		+ \fracDgu(t,b_t)\,db_t.
\end{align}
\end{prop}

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{prop}
\label{prop:ito_1d_b_no_t}
Special case with $e=0$ and $f=1$ and no explicit time dependence:
If
$$
	X_t = g(b_t)
$$
then
\begin{align}
	dX_t &= \frac{1}{2} \fracDguu(b_t)\,dt + \fracDgu(b_t)\,db_t.
\end{align}
\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}

Again, there is a special case when the input It\=o process is simply
$n$-dimensional Brownian motion; again, it is worth writing down as such since
this case arises often.

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{prop}
\label{prop:ito_ndb}

Let $\vecg:\R^+ \times \R^m \to \R^n$ be a $C^2$ map:
$$
	\colvecthree{x_1}{\vdots}{x_n}
	= \colvecthree
		{g_1(t, \vecu)}
		{\vdots}
		{g_n(t, \vecu)}
	= \colvecthree
		{g_1(t, u_1, \ldots, u_m)}
		{\vdots}
		{g_n(t, u_1, \ldots, u_m)}.
$$
Then
$$
	\vecX_t = \vecg(t, \vecb_t)
$$
is again an It\=o process with $k$th component (for $k = 1, \ldots, n$)
$$
	dX^{(k)}_t
		= \fracDgt(t,\vecb_t)\,dt
		+ \sum_{i=1}^m \frac{\Dg_k}{\Du_i} (t,\vecb_t)\,db^{(i)}_t
		+ \frac{1}{2} \sum_{i,j=1}^m \frac{\D^2 g_k}{\Du_i \Du_j}
			(t,\vecb_t)\,db^{(i)}_t \,db^{(j)}_t.
$$
\end{prop}

%% ----------------------------------------------------------------
\subsection{The It\=o formula from two dimensions to one}

\begin{prop}
\label{prop:ito_2_1}
Let $\vecg:\R^+ \times \R^2 \to \R$ be a $C^2$ map
$$
	z = g(t, x, y).
$$
Then
$$
	Z_t = g(t, X_t, Y_t)
$$
is again an It\=o process with
\begin{align*}
	dZ_t &= \fracDgt(t,X_t,Y_t)\,dt
		+ \fracDgx(t,X_t,Y_t)\,dX_t
		+ \fracDgy(t,X_t,Y_t)\,dY_t \\
	&	+ \frac{1}{2} \fracDgxx(t,X_t,Y_t)\,dX_t^2
		+ \frac{1}{2} \fracDgyy(t,X_t,Y_t)\,dY_t^2
		+ \fracDgxy(t,X_t,Y_t)\,dX_t\, dY_t.
\end{align*}
\end{prop}

%% ----------------------------------------------------------------
\subsection{The stochastic product rule}

\begin{prop}
\label{prop:stochastic_product_rule}
Let\index{product rule} $X_t$, $Y_t$ be It\=o processes.  Then
$$
	d(X_t\, Y_t) = X_t\, dY_t + Y_t\,dX_t + dX_t\,dY_t.
$$
\begin{proof}
Using the It\=o formula in the form of proposition \ref{prop:ito_2_1} with
$g(x,y) = xy$,
we have
$$
	\fracDgt  = 0, \qquad
	\fracDgx  = y, \qquad
	\fracDgy  = x, \qquad
	\fracDgxx = 0, \qquad
	\fracDgyy = 0, \qqand
	\fracDgxy = 1.
$$
Then
$$
	d(X_t\,Y_t) = Y_t\,dX_t + X_t\,dY_t + dX_t\,dY_t.
$$
\end{proof}
\end{prop}

%% ----------------------------------------------------------------
\subsection{Stochastic integration by parts}

\begin{prop}
\label{prop:stochastic_parts}
For\index{parts}\index{integration by parts} It\=o processes $X_t$ and $Y_t$,
$$
	\int_0^t X_s dY_s = X_t Y_t - X_0 Y_0
		- \int_0^t Y_s \,dX_s - \int_0^t dX_s\,dY_s.
$$
\begin{proof}
Using the stochastic product rule (proposition
\ref{prop:stochastic_product_rule}), we have
\begin{align*}
	d(X_t\, Y_t) &= X_t\, dY_t + Y_t\,dX_t + dX_t\,dY_t \\
	X_t\, dY_t &= d(X_t\, Y_t) - Y_t\,dX_t - dX_t\,dY_t.
\end{align*}
Integrating from $0$ to $t$ gives
\begin{align*}
	\int_0^t X_s\, dY_s &= \int_0^t d(X_s\, Y_s)
		- \int_0^t Y_s\,dX_s - \int_0^t dX_s\,dY_s \\
	&= X_t Y_t - X_0 Y_0 - \int_0^t Y_s\,dX_s - \int_0^t dX_s\,dY_s.
\end{align*}
\end{proof}
\end{prop}

\begin{cor}
\label{prop:stochastic_parts_cor}
For $f_t$ not depending on $b_t$, we have
$$
	\int_0^t f_s\,db_s = f_t b_t - \int_0^t b_s\,df_s.
$$
\begin{proof}
Putting $X_t = f_t$ and $Y_t = b_t$, the proposition gives
$$
	\int_0^t f_s\,db_s = f_t b_t - \int_0^t b_s\,df_s
		- \int_0^t df_s\,db_s
$$
since $b_0=0$.  By the It\=o calculus rule $dt\,db_t = 0$, the last integral
vanishes as long as there is no $db_t$ in $df_t$.
\end{proof}
\end{cor}

%% ----------------------------------------------------------------
\subsection{The It\=o isometry}

\begin{prop}
\label{prop:ito_isometry}
For\index{isometry}\index{It\=o isometry} all $f$ such that the It\=o integral
is defined,
$$
	E\left[ \left(\int_{t_1}^{t_2} f_s\,db_s\right)^2 \right]
	=
	E\left[ \int_{t_1}^{t_2} f_s^2\,ds \right].
$$
\end{prop}

%% ----------------------------------------------------------------
\subsection{Expectation of integrals}

\begin{prop}
\label{prop:property_iii}
For\index{expecation of integrals} all $f$ such that the It\=o integral is
defined,
$$
	E\left[ \int_{t_1}^{t_2} f_s db_s \right] = 0.
$$
\begin{proof}
This is property (iii) on p. 30 of {\O}ksendahl.  The proof is quick
for step functions, since
$$
	E[c\,b_t] =
	cE[\,b_t] =
	0
$$
on each piece; for the general case, one takes limits of step functions.
\end{proof}
\end{prop}

%% ================================================================
\newpage
\section{The single-particle Feynman-Kac formula}
\label{sec:fk1}

[xxx lead up to fkb.]  The proof is adapted from \cite{bib:lawler}, with
missing steps filled in and notation changed to match that used in this paper.
(See also \cite{bib:oksendal} where uniqueness of the solution is proved.)

\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^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
$$
and $\bbE^x[Y]$ denotes $\bbE[Y \mid X_0 = x]$.
(We assume that this expectation exists for all $t,x$.)

\begin{rem}
\label{rem:fkac_diffusion}
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}

Figure \ref{fig:fk1} plots equation \ref{eqn:fk1_start} for $x$ from $-2$ to
$2$ in steps of $0.1$, for $t=0,1,2$, $f=\sqrt 2$, $e=1$, $g=0$, and
$$
	h(x) = \frac{1}{1+x^2}.
$$
That is, we are estimating the solution to
$$
	\fracDphit(t,x) = \fracDphixx(t,x) + \fracDphix(t,x).
$$
The expectations are taken over $10,000$ Brownian motions for each $x$; these
are stepped with $\Delta t = 0.01$.  Since the coefficient on $\D^2\phi/\Dx^2$
is nonzero, we expect the initial condition to spread over time; since the
coefficient on $\D\phi/\Dx$ is nonzero, we expect drift.

\begin{figure}[h!tb]
\begin{center}
\includegraphics{figures/fk1.eps}
\caption{Feynman-Kac solution for diffusion with drift.
	\label{fig:fk1}}
\end{center}
\end{figure}

