\newpage
%% ================================================================
\section{Damped Brownian motion (problem 1.5a)}

\emph{Prove that
$$
	X_t = \frac{b_t}{1+t}
$$
solves
$$
	dX_t = \frac{-1}{1+t}\,X_t\,dt + \frac{1}{1+t}\,db_t.
$$
}

\begin{proof}
Use the \Ito formula in the form of proposition \ref{prop:ito_1d_b_t}
with
$$
	g(t,x) = \frac{x}{1+t}.
$$
We have
$$
	\fracDgt  = \frac{-x}{(1+t)^2}, \qquad
	\fracDgx  = \frac{1}{1+t}, \qqand
	\fracDgxx = 0.
$$
Then
\begin{align*}
	dX_t &= \frac{-b_t}{(1+t)^2}\,dt + \frac{db_t}{1+t} \\
	&= \frac{-1}{1+t}\,X_t\,dt + \frac{1}{1+t}\,db_t.
\end{align*}
\end{proof}

Figure \ref{fig:1.5.a} shows five realizations of $X_t$ with $t$ from 0 to 10
in steps of $0.005$.  The exact solutions and approximate solutions (using
naive a first-order Euler method) are both plotted, but are indistinguishable at
this scale.

Python source code for all solutions plotted in this document may be found in
the directory

\begin{center}
\texttt{http://math.arizona.edu/{\tat}kerl/doc/565C/code/}
\end{center}

I will not include source code for each problem.  Here, however, is the Python
code for this problem:  this gives the flavor of the numerical approach.

\begin{verbatim}
import random        # For random.gauss: generation of normal deviates
from math import *   # For sqrt
T  = 10.0            # End time
nt = 2000            # Number of mesh points
dt = T/nt            # Time step
t  = 0.0             # Initial time
Bt = 0.0             # Initial value of Brownian motion
Xexact  = Bt / (1+t) # Initial exact solution
Xapprox = Bt / (1+t) # Initial approximate solution
while (t <= T):
    Xexact = Bt / (1+t)
    print "%11.7f %11.7f %11.7f %9.3e" % (t, Xexact, Xapprox, Xexact-Xapprox)
    dB = random.gauss(0, sqrt(dt))
    # First-order Euler update:
    Xapprox += -1/(1+t) * Xapprox * dt + 1/(1+t) * dB
    Bt += dB; t += dt
\end{verbatim}

\begin{figure}[!ht]
\begin{center}
\includegraphics{code/1.5.a.eps}
\caption{Problem 1.5.a: $X_t = b_t/(1+t)$.
	\label{fig:1.5.a}}
\end{center}
\end{figure}
\clearpage

%% ================================================================
\newpage
\section{Brownian motion on an ellipse (problem 1.5b)}

\emph{Let
\begin{align*}
	X_t &= A \cos(b_t) \\
	Y_t &= B \sin(b_t),
\end{align*}
where $A,B > 0$.  Show that these solve
\begin{align*}
	dX_t &= -\frac{1}{2} X_t\,dt - \frac{A}{B}\,Y_t\,db_t \\
	dY_t &= -\frac{1}{2} Y_t\,dt + \frac{B}{A}\,X_t\,db_t.
\end{align*}
}

\begin{proof}
Use the \Ito formula (once for $X_t$ and once for $Y_t$) in the form of
proposition \ref{prop:ito_ndb} with $m=1$, $n=2$, and
\begin{align*}
	g(t,x) &= A\cos(x) \\
	h(t,x) &= B\sin(x).
\end{align*}
\end{proof}

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/ellipse_cos.eps}
\caption{Problem 1.5.b:
	Cosine part of Brownian motion on an ellipse with $A=2$ and $B=3$.
	\label{fig:ellipse_cos}}
\end{center}
\end{figure}

We have
\begin{align*}
	\fracDgt  &=  0,        & \fracDht  &=  0,        \\
	\fracDgx  &= -A\sin(x), & \fracDhx  &=  B\cos(x), \\
	\fracDgxx &= -A\cos(x), & \fracDhxx &= -B\sin(x).
\end{align*}
Then
\begin{align*}
	dX_t &= -\frac{A}{2} \cos(b_t)\,dt - A\sin(b_t)\,db_t \\
	dY_t &= -\frac{B}{2} \sin(b_t)\,dt + B\cos(b_t)\,db_t
\end{align*}
\begin{align*}
	dX_t &= -\frac{1}{2} X_t\,dt - \frac{A}{B}\,Y_t\,db_t \\
	dY_t &= -\frac{1}{2} Y_t\,dt + \frac{B}{A}\,X_t\,db_t.
\end{align*}

Figure \ref{fig:ellipse_cos} shows one realization of $X_t$ with $t$ from 0 to
2 in steps of $0.0001$, with $A=2$ and $B=3$.  The approximate solution is
again a naive first-order Euler; the error control is poor here.  One may take
this as an advertisement for higher-order numerical methods, and/or as an
advertisement for the value of closed-form solutions.

%% ================================================================
\newpage
\section{Exponential models with noise (problem 1.5.c)}

%% ----------------------------------------------------------------
\subsection{Exponential growth with noise (problem 1.5.c.i)}

\emph{Solve the equation
$$
	dX_t = X_t\,dt + db_t
$$
with an arbitrary constant initial condition $X_0 = c$.
}

We may try the integrating factor $\emt$ and compare with
$d(\emt X_t)$.  The equation to be solved becomes
$$
	\emt \,dX_t = \emt X_t\,dt + \emt\,db_t.
$$
On the other hand, applying the stochastic product rule
(\ref{prop:stochastic_product_rule}), we have
\begin{align*}
	d(\emt X_t) &= d(\emt) X_t + \emt dX_t + d(\emt) dX_t \\
	&= -\emt X_t dt + \emt(X_t\,dt + db_t) - \emt\,dt(X_t\,dt + db_t) \\
	&= -\emt X_t\,dt + \emt X_t\,dt + \emt db_t
		- \emt X_t dt^2 - \emt dt\,db_t \\
	&= \emt\,db_t.
\end{align*}
Integrating both sides, we have
\begin{align*}
	\int_0^t d(\ems X_s) &= \int_0^t \ems\,dbs \\
	\emt X_t - X_0 &= \int_0^t \ems\,db_s \\
	\emt X_t &= c + \int_0^t \ems\,db_s \\
	X_t &= ce^t + e^t\int_0^t \ems\,db_s.
\end{align*}

\begin{figure}[!pth]
\begin{center}
\includegraphics[scale=0.8]{code/noisygrowth.eps}
\caption{Problem 1.5.c.i: $dX_t = X_t\,dt + db_t$, along with $E[X_t]$.
	\label{fig:noisygrowth}}
\end{center}
\end{figure}

\begin{figure}[!pth]
\begin{center}
\includegraphics[scale=0.8]{code/noisydecay.eps}
\caption{Problem 1.5.c.ii: $dX_t = -X_t\,dt + \emt db_t$, along with $E[X_t]$.
	\label{fig:noisydecay}}
\end{center}
\end{figure}

Figure \ref{fig:noisygrowth} shows five realizations of $X_t$ with $t$ from 0
to 2 in steps of $0.001$.  Here, the exact and approximate solutions are
indistinguishable.  The expected value is also shown.  This
is
\begin{align*}
	E[X_t] &= E[ce^t] + E\left[e^t\int_0^t \ems\,db_s\right] \\
	&= ce^t
\end{align*}
using the non-stochasticity of the first term and
proposition \ref{prop:property_iii} for the second term.

%% ----------------------------------------------------------------
\subsection{Exponential decay with decaying noise (problem 1.5.c.ii)}

\emph{Solve the equation
$$
	dX_t = -X_t\,dt + \emt db_t
$$
with an arbitrary constant initial condition $X_0 = c$.
}

We may try the integrating factor $e^t$ and compare with $d(e^t X_t)$.  The
equation to be solved becomes
$$
	e^t \,dX_t = -e^t X_t\,dt + db_t.
$$
Applying the stochastic product rule (\ref{prop:stochastic_product_rule}), we
have
\begin{align*}
	d(e^t X_t) &= e^t X_t dt + e^t\,dX_t + e^t\,dt\,dX_t \\
	&= e^tX_t\,dt + e^t(-X_t\,dt + \emt\,db_t)
		+ e^t\,dt(-X_t\,dt + \emt\,db_t) \\
	&= e^t X_t\,dt - e^t X_t\,dt + db_t \\
	&= db_t.
\end{align*}
Integrating both sides, we have
\begin{align*}
	\int_0^t d(e^s X_s) &= \int_0^t dbs \\
	e^t X_t &= X_0 = b_t - b_0 \\
	X_t &= (c + b_t) e^{-t}.
\end{align*}

Figure \ref{fig:noisydecay} shows five realizations of $X_t$ with $t$ from 0 to
10 in steps of $0.001$.  Here, the exact and approximate solutions are
indistinguishable.  The expectation $E[X_t]$ is also shown.  This is
$$
	E[X_t] = E[ce^{-t}] + E[b_t e^{-t}] = ce^{-t}
$$
since $b_t$ has mean 0 for all $t$.

%% ================================================================
\newpage
\section{Brownian bridges (problem 1.5.d)}

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\textbf{Part (i):}
\emph{Verify\index{bridge, Brownian}\index{Brownian bridge} that the process
$$
	Y_t = A(1-t) + B t + (1-t) \int_0^t \frac{db_s}{1-s},
		\qquad 0 \le t < 1,
$$
is a solution of
$$
	dY_t = \frac{B-Y_t}{1-t}\,dt + db_t,
		\qquad 0 \le t < 1, Y_0 = A.
$$
}

Differentiating the first equation, we have
\begin{align*}
	dY_t &= Ad(1-t) + B\,dt +
		d\left( (1-t)\int_0^t \frac{db_s}{1-s} \right) \\
	&= (B-A)dt + d\left( (1-t)\int_0^t \frac{db_s}{1-s} \right).
\end{align*}

Using the stochastic product rule requires taking $d$ of the integral.  I want
to use the second fundamental theorem of calculus, but that applies to Lebesgue
integrals; I don't know how to apply it to a stochastic integral.  In order to
convert from the latter to the former, I will use integration by parts
(proposition \ref{prop:stochastic_parts_cor}), namely,
$$
	\int_0^t f_s\,db_s = f_t b_t - \int_0^t b_s\,df_s.
$$
Here $f(s) = (1-s)^{-1}$ and $df_s = ds/(1-s)^2$.  Thus
$$
	\int_0^t \frac{db_s}{1-s} = \frac{b_t}{1-t}
		- \int_0^t \frac{b_s\,ds}{(1-s)^2}.
$$
Then
\begin{align*}
	d\int_0^t \frac{db_s}{1-s} &=
		d\left(\frac{b_t}{1-t}\right)
		- d\int_0^t \frac{b_s\,ds}{(1-s)^2} \\
	&= \frac{db_t}{1-t} + \frac{b_t\,dt}{(1-t)^2} + db_t\,dt
		- \frac{b_t\,dt}{(1-t)^2} \\
	&= \frac{db_t}{1-t}.
\end{align*}

Returning to $dY_t$ we have
\begin{align*}
	dY_t &= (B-A)dt - dt \, \int_0^t \frac{db_s}{1-s}
		+ (1-t)\, d\int_0^t \frac{db_s}{1-s}
		-dt\,d\int_0^t \frac{db_s}{1-s} \\
	&= (B-A)dt - dt \, \int_0^t \frac{db_s}{1-s}
		+ (1-t)\, \frac{db_t}{1-t}
		-dt \frac{db_t}{1-t} \\
	&= (B-A)dt - dt\,\int_0^t \frac{db_s}{1-s} + db_t.
\end{align*}
I am asked to show
$$
	dY_t = \frac{B-Y_t}{1-t}\,dt + db_t.
$$
I need to show
$$
	B-A-\int_0^t \frac{db_s}{1-s} = \frac{B-Y_t}{1-t}
$$
which is true if
$$
	B(1-t) - A(1-t) - (1-t)\int_0^t \frac{db_s}{1-s} = B - Y_t
$$
which is true if
$$
	B(1-t) - A(1-t) - (1-t)\int_0^t \frac{db_s}{1-s}
	= B-A(1-t) - Bt - (1-t)\int_0^t \frac{db_s}{1-s}
$$
which is true if
$$
	B(1-t) - A(1-t) - (1-t)\int_0^t \frac{db_s}{1-s}
	= B-A(1-t) - Bt - (1-t)\int_0^t \frac{db_s}{1-s}
$$
which is true.

Figure \ref{fig:bridges} shows twenty realizations of $Y_t$ with $t$ from 0 to
1 in steps of $0.001$.  The approximate solutions are plotted.

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/bridges.eps}
\caption{Problem 1.5.d: Brownian bridges running from zero to zero in time one.
	\label{fig:bridges}}
\end{center}
\end{figure}


%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\textbf{Part (ii):}
\emph{Show that $\lim_{t\to 1} Y_t = B$ with probability 1.
}

\begin{proof}
Since
$$
	Y_t = A(1-t) + Bt + (1-t)\int_0^t \frac{db_s}{1-s},
$$
We have
$$
	\lim_{t\to 1} Y_t = B + (1-t) \lim_{t\to 1} \int_0^t \frac{db_s}{1-s}.
$$
The last term goes to zero as long as
$$
	\left| \int_0^t \frac{db_s}{1-s} \right| < \infty \quad w.p. 1,
$$
or at least if it goes to infinity slower than $1/(1-t)$.

Perhaps the \Ito isometry (proposition \ref{prop:ito_isometry}) will
help.  With
$$
	f_s = \frac{1-t}{1-s},
$$
we have
$$
	E\left[ (1-t)^2 \left(\int_0^t \frac{db_s}{1-s}\right)^2 \right]
	=
	E\left[ (1-t)^2 \int_0^t \frac{ds}{(1-s)^2} \right].
$$
But this is
$$
	E\left[ (1-t)^2 \int_0^t \frac{ds}{(1-s)^2} \right]
	= (1-t)^2 \frac{t}{1-t} = t(1-t) < \infty
$$
by elementary calculus.

\end{proof}

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\textbf{Part (iii):}
\emph{Find the mean and covariance of $Y_t$ for $A=B=0$.
}

Here
$$
	Y_t = (1-t) \int_0^t \frac{db_s}{1-s}.
$$
The variance is easily found --- from part (ii), it is
$$
	E[Y_t^2] - E[Y_t]^2 = E[Y_t^2] = t(1-t).
$$
The mean is zero by proposition \ref{prop:property_iii}.

For the covariance, assume without loss of generality that $s \le t$.
Then --- with the key being to separate the integral from 0 to $t$
into an integral from 0 to $s$ and another from $s$ to $t$ --- we have
\begin{align*}
	E[Y_sY_t] &= E\left[
			(1-s)(1-t)
			\int_0^s \frac{db_u}{1-u}
			\int_0^t \frac{db_v}{1-v}
		\right] \\
	&= (1-s)(1-t)\,
		E\left[
			\left( \int_0^s \frac{db_u}{1-u} \right)^2
		\right]
	+ (1-s)(1-t)\,
		E\left[
			\int_0^s \frac{db_u}{1-u}
		\right]
		E\left[
			\int_s^t \frac{db_v}{1-v}
		\right].
\end{align*}
The second expectation factors due to independence of the events;
the first expecattion is as found in part (ii).
Then we have
\begin{align*}
	E[Y_sY_t]
	&= (1-s)(1-t)\frac{s}{1-s} \\
	&= s(1-t).
\end{align*}
Note that for $s=t$ I recover the variance that I obtained using \Ito isometry:
this is reassuring.

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\textbf{Part (iv):}
\emph{Verify that
$$
	X_t := b_t - tb_1, \quad 0 \le t < 1,
$$
has the same distribution as $Y_t$.
}

\begin{proof}
I will first compute the mean and covariance of $X_t$.  These uniquely
characterize Brownian motions; I would hope they also uniquely characterize
Brownian bridges.  (Regardless, the exercise is good practice for me.)

For the mean, we have
$$
	E[X_t] = E[b_t - tb_1] = 0 - t\cdot 0 = 0.
$$
For the covariance, recalling that
$$
	E[b_s b_t] = s \wedge t
$$
where $s \wedge t$ is the minimum of $s$ and $t$, we have
\begin{align*}
	E[X_s X_t] &= E[(b_s - s b_1)(b_t - t b_1)] \\
	&= E[b_s b_t] - E[t b_1 b_s] - E[s b_1 b_t] + E[s t b_1^2] \\
	&= s \wedge t - t (s \wedge 1) - s (t \wedge 1) + s t \\
	&= s \wedge t - 2 st + st \\
	&= s \wedge t - st.
\end{align*}
Now, if $s \le t$ then this is $s-st=s(1-t)$, matching my result from part
(iii).  Happily, using the $X_t$ formulation of the bridge I get the more
elegant expression $s \wedge t - st$, which is valid whether $s \le t$ or not
--- an expression which I might not have so easily gotten using the $Y_t$
formulation.

Now, do these computations suffice to answer the original question?
Do the zero-to-zero Brownian bridges form a Gaussian family?
\end{proof}

%% ================================================================
\newpage
\section{Complex Brownian motion (problem 1.5.e)}

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\emph{Let\index{complex Brownian motion} $(a_t, b_t)$ be two-dimensional
Brownian motion.  The complex-valued function
$$
	c_t = a_t + ib_t
$$
is called a \emph{complex Brownian motion}.
Let $F$ be an entire analytic function.  For $Z_t = F(c_t)$, prove that
$$
	dZ_t = F'(c_t) \, dc_t.
$$
}

\begin{proof}
Write
$$
	z=F(w)
$$
in the form
$$
	x+iy = g(u,v) + i h(u,v),
$$
i.e. $w=u+iv$, $z=x+iy$, and $F=g+ih$.  Then
\begin{align*}
	X_t &= g(a_t, b_t) \\
	Y_t &= h(a_t, b_t).
\end{align*}
Use the \Ito formula in the form of proposition \ref{prop:ito_ndb}.  Since
$\Dg/\Dt$ and $\Dh/\Dt$ are zero, $da_t\,db_t$ is zero, and $da_t^2 = db_t^2 =
dt$, we have
\begin{align*}
	dX_t &= \fracDgu\,da_t
		+ \fracDgv\,db_t
		+ \frac{1}{2} \left( \fracDguu + \fracDgvv \right) \\
	dY_t &= \fracDhu\,da_t
		+ \fracDhv\,db_t
		+ \frac{1}{2} \left( \fracDhuu + \fracDhvv \right).
\end{align*}
Since $F$ is entire analytic, its components $g$ and $h$ satisfy the
Cauchy-Riemann equations
$$
	\fracDgx = \fracDhy
	\qqand
	\fracDhx = -\fracDgy.
$$
These in turn yield harmonicity of $g$ and $h$:
$$
	\fracDguu + \fracDgvv = \fracDhuu + \fracDhvv = 0.
$$
Thus
\begin{align*}
	dX_t &= \fracDgu\,da_t + \fracDgv\,db_t \\
	dY_t &= \fracDhu\,da_t + \fracDhv\,db_t
\end{align*}
which is to say
$$
	dZ_t = F'(c_t) \, dc_t.
$$
\end{proof}

Figure \ref{fig:complexb} shows one realization of $c_t$ with $t$ from 0 to
5 in steps of $0.0005$.

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/complexb.eps}
\caption{Problem 1.5.e: Complex Brownian motion.
	\label{fig:complexb}}
\end{center}
\end{figure}

%% ================================================================
\newpage
\section{Iterated stochastic integrals (problem 1.5.f)}

%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\emph{The following is an important \Ito formula for an iterated stochastic
integral:
$$
	n! \int_0^t db_{u_n} \int_0^{u_n} db_{u_{n-1}} \cdots
		\int_0^{u_2} db_{u_1} = t^{n/2} h_n \left(\frac{b_t}{\sqrt t}\right),
$$
where
$$
	h_n(x) = (-1)^n e^{\frac{t^2}{2}} \frac{d^n}{dx^n} \left(
		e^{\frac{-x^2}{2}} \right)
$$
is the Hermite polynomial of degree $n$.
Verify the formula for $n=0,1,2,3$.
}

\begin{proof} First recall
\begin{align*}
	h_0(x) &= 1, \\
	h_1(x) &= x, \\
	h_2(x) &= x^2-1, \\
	h_3(x) &= x^3-3x.
\end{align*}

\textbf{Case $n=0$:}  This is immediate, as $0!=1$.

\textbf{Case $n=1$:}  The left-hand side is
$$
	\int_0^t db_s = b_t;
$$
the right-hand side is
$$
	t^{1/2}\,\frac{b_t}{\sqrt t} = b_t.
$$

\textbf{Case $n=2$:}  The left-hand side is
\begin{align*}
	2 \int_0^t db_s \int_0^s db_r &= 2 \int_0^t db_s \, b_s \\
	&= 2\left(\frac{1}{2} b_t^2 - \frac{t}{2}\right) \\
	&= b_t^2-t;
\end{align*}
the right-hand side is
$$
	t\left( t \left(\frac{b_t}{\sqrt t}\right)^2 - 1\right) = b_t^2 - t.
$$

I take it that
$$
	\int_0^t db_s\,b_s = \frac{b_t^2-t}{2}
$$
is well-known.  However, I will re-derive it, as it illustrates the technique
used below.  Use the \Ito formula in the form of proposition
\ref{prop:ito_1d_b_no_t}.  Guess
$$
	g(x) = \frac{x^2}{2},
$$
so
$$
	\fracDgx = x
	\qqand
	\fracDgxx = 1.
$$
Then for
$$
	X_t = g(b_t)
$$
we have
\begin{align*}
	dX_t = d\left(\frac{b_t^2}{2}\right)
	&= \frac{1}{2} \fracDgxx\,dt + \fracDgx\,db_t \\
	&= \frac{1}{2}\,dt + b_t\,db_t.
\end{align*}
Integrating from $0$ to $t$ we have
\begin{align*}
	\int_0^t d\left(\frac{b_s^2}{2}\right)
		&= \frac{1}{2} \int_0^t ds + \int_0^t b_s\,db_s \\
%
	\int_0^t b_s\,db_s &=
		\frac{b_t^2}{2} - \frac{t}{2}.
%
\end{align*}

\textbf{Case $n=3$:}
The left-hand side is
\begin{align*}
	6 \int_0^t db_s \int_0^s db_r \int_0^r db_q
		&= 6 \int_0^t db_s \int_0^s db_r \,b_r \\
	&= 3 \int_0^t db_s (b_s^2 - s) \\
	&= 3 \int_0^t b_s^2 \, db_s - 3 \int_0^t s \, db_s.
\end{align*}
The right-hand side is
\begin{align*}
	t^{3/2} h_3 \left(\frac{b_t}{\sqrt t}\right)
	&=  t^{3/2} \left(\frac{b_t}{\sqrt t}\right)^3 -
		t^{3/2} \left(\frac{b_t}{\sqrt t}\right) \\
	&=  b_t^3 - t\,b_t.
\end{align*}

\begin{center}* * *\end{center}

First we need to compute
$$
	\int_0^t b_s^2 \, db_s.
$$
Proceeding as above and guessing
$$
	g(x) = \frac{x^3}{3},
$$
we have
$$
	\fracDgx = x^2
	\qqand
	\fracDgxx = 2x.
$$
Then for
$$
	X_t = g(b_t)
$$
we have
\begin{align*}
	dX_t = d\left(\frac{b_t^3}{3}\right)
	&= \frac{1}{2} \fracDgxx\,dt + \fracDgx\,db_t \\
	&= b_t\,dt + b_t^2 \,db_t.
\end{align*}
Integrating from $0$ to $t$ we have
\begin{align*}
	\int_0^t d\left(\frac{b_s^3}{3}\right)
		&= \int_0^t b_s ds + \int_0^t b_s^2 \,db_s \\
%
	\int_0^t b_s^2 \,db_s &=
		\frac{b_t^3}{3} - \int_0^t b_s\,ds.
%
\end{align*}

\begin{center}* * *\end{center}

Next we need to compute
$$
	\int_0^t s \, db_s.
$$
Guessing
$$
	g(x) = tx
$$
we have
$$
	\fracDgt = x,
	\qquad
	\fracDgx = t,
	\qqand
	\fracDgxx = 0.
$$
Then for
$$
	X_t = g(t, b_t)
$$
we have
\begin{align*}
	dX_t = d(t\, b_t)
	&= \left(\fracDgt + \frac{1}{2} \fracDgxx\right)\,dt + \fracDgx\,db_t \\
	&= b_t\,dt + t \,db_t.
\end{align*}
Integrating from $0$ to $t$ we have
\begin{align*}
	\int_0^t d(s\,b_s)
		&= \int_0^t b_s ds + \int_0^t s\,db_s \\
%
	\int_0^t s \,db_s &=
		t\,b_t - \int_0^t b_s\,ds.
%
\end{align*}

\begin{center}* * *\end{center}

The left-hand side in the original equation to be verified now becomes
\begin{align*}
	3 \int_0^t b_s^2 \,db_s -
		3 \int_0^t s \,db_s
	&= b_t^3 - 3 \int_0^t b_s\,ds
		- 3 t\,b_t + 3 \int_0^t b_s\,ds \\
	&= b_t^3 - 3 t\,b_t.
\end{align*}
The right-hand side is
\begin{align*}
	t^{3/2}\left(\frac{b_t}{t^{1/2}}\right)^3 -
	3 t^{3/2}\left(\frac{b_t}{t^{1/2}}\right)
	&=
	b_t^3 - 
	3 t\,b_t
\end{align*}
as desired.
\end{proof}

%% ================================================================
\newpage
\section{Exponential growth with multiple noise sources (problem 2.2)}

\emph{Let $c, \alpha_1, \ldots, \alpha_n$ be constants; let $b_t = \left(
b_t^{(1)}, \ldots, b_t^{(n)} \right)$ be $n$-dimensional Brownian motion.  Let
$$
	X_t = \exp\left( ct + \sum_{j=1}^n \alpha_j b_t^{(j)} \right).
$$
Prove that
$$
	dX_t = \left( c + \frac{1}{2} \sum_{j=1}^n \alpha_j^2 \right)\,X_t\,dt
		+ X_t\, \sum_{j=1}^n \alpha_j\,db_t^{(j)}.
$$
}

\begin{proof}
Use the multidimensional \Ito formula in the form of proposition
\ref{prop:ito_ndb}.  We have
\begin{align*}
	g(t,u_1, \ldots, u_n) &= e^{ct} e^{\alpha_1 u_1} \cdots e^{\alpha_n u_n} \\
	\fracDgt(t,u_1, \ldots, u_n) &= cg \\
	\frac{\Dg}{\Dx_j}(t,u_1, \ldots, u_n) &= \alpha_j g \\
	\frac{\Dg^2}{\Dx_j^2}(t,u_1, \ldots, u_n) &= \alpha_j^2 g.
\end{align*}
Then
\begin{align*}
	dX_t &= \left( cX_t + \frac{1}{2} \sum_{j=1}^n \alpha_j^2 X_t \right)\,dt
		+ \sum_{j=1}^n \alpha_j X_t \,db_t^{(j)} \\
	&= \left( c + \frac{1}{2} \sum_{j=1}^n \alpha_j^2 \right) X_t \,dt
		+ X_t \sum_{j=1}^n \alpha_j \,db_t^{(j)}.
\end{align*}
\end{proof}

%% ================================================================
\newpage
\section{Martingales (problem 2.3)}

%% ----------------------------------------------------------------
\subsection{Problem 2.3.a}

\emph{Prove that
$$
	X_t = e^{t/2} \cos(b_t)
$$
is a \plainidx{martingale} with respect to the \plainidx{filtration} of the
Brownian motion $b_t$.
}

First recall that a stochastic process is a martingale with respect to a
filtration $\mcF_s$ if
$$
	E[X_t\mid \mcF_s] = X_s.
$$
This is an overblown, measure-theoretic way of obscuring the simple statement
that, conditioned on $X_s = a$, the expected value of $X_t$ for times past $s$
is $a$.

For a concrete example, consider the \plainidx{d'Alembert system}.  The time
$t$ is in discrete steps $t=0,1,2,\ldots$.  One random variable, $C_t$, is the
outcome of a coin flip with probability $p$ of heads where we encode heads as
$+1$ and tails as $-1$.  The second random variable is
$$
	X_t = \sum_{s=0}^t C_s.
$$
This represents the accumulated earnings of a \plainidx{gambler} who, beginning
with zero balance, plays a game wherein he/she wins a dollar for each head and
loses a dollar for each tail.  Now suppose that at the $s$th step the gambler
has a balance of $a=100$.  (That is, condition on $X_s=100$.) If the coin is
fair, the expected value of $X_{s+1}$ is $(101+99)/2=100$.  Likewise $E[X_{s+2}
= (102 + 2\cdot 100 + 98)/4=100$ and so on.  We say that for $t\ge s$, $E[X_t |
X_s=a] = a$.  One then generalizes this statement by considering not just one
specific value of $a$ but instead all values of $X_s$:  we collect all the
$a$'s into a $\sigma$-algebra bag.  We say
$$
	E[X_t\mid \mcF_s] = X_s.
$$
Last, note that if the coin has a probability $p>1/2$ of heads, then the
expected future earnings, conditioned on the present balance, \emph{exceed} the
present balance.  Similarly, if $p<1/2$, then $E[X_t\mid F_s] < X_s$.
The d'Alembert system is a martingale if and only if the coin is fair.

Brownian motion is simply (in a very specific sense) the limiting case of the
d'Alembert system.  When thinking of martingales with respect to the filtration
of Brownian motion, I ask myself:  for all processes $X_t$ which pass through
$a$ at time $s$, what is the expected value of those processes at subsequent
times $t$ --- is that expectation above, below, or at the current value $a$.

\begin{center}* * *\end{center}

Returning to the original problem, recall two facts:
\begin{itemize}
\item If $X$ is $\mcF$-measurable, then $E[X\mid \mcF] = X$.
\item If $X$ is independent of $\mcF$, then $E[X \mid \mcF] = E[X]$.
\end{itemize}
We split $X_t$ into $(X_t-X_s) + X_s$.  Then
$$
	E[X_t \mid \mcF_s] =
	E[X_t -X_s \mid \mcF_s] +
	E[X_s \mid \mcF_s].
$$
Now $X_t-X_s$ is independent of $\mcF_s$ and $X_s$ is $\mcF_s$-measurable.
Thus
$$
	E[X_t \mid \mcF_s] =
	E[X_t] - E[X_s] + X_s.
$$
We will be done if we can show $E[X_t] = E[X_s]$.  Figure \ref{fig:et2cosbt}
shows forty realizations of $X_t$ for $t$ from 0 to 2 in steps of $0.002$.  The
figure suggests that $E[X_t]=1$ for all $t$.  I have computed, but have not
included in this paper, plots of $e^{ct}\cos(b_t)$ for values of $c$ above and
below $0.5$:  for $c<0.5$, the mean $E[X_t]$ drops down from 1 as $t$ increases
from 0 (and $X_t$ is a supermartingale); for $c>0.5$, $E[X_t]$ rises from 1
(and $X_t$ is a submartingale).  Also note from the figure that, for each $t$,
values of $X_t$ occur with less spread, but more densely, above 1; they occur
with more spread, but less densely, below 1.  Thus the density function of
$X_t$ is asymmetrical but nonetheless has mean 1 for all $t$.

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/et2cosbt.eps}
\caption{Problem 2.3.a: 40 realizations of $e^{t/2}\cos(b_t)$,
	with sample mean $\overline{X}_t$ and envelope curves $\pm e^{t/2}$.
	\label{fig:et2cosbt}}
\end{center}
\end{figure}

Since
$$
	E[e^{t/2}\cos(b_t)] = e^{t/2}\, E[\cos(b_t)],
$$
I need to show that $E[\cos(b_t)]=e^{-t/2}$.  This is plausible intutively: at
$t=0$, $b_t$ is 0 and $\cos(b_t)=1$.  As $t$ increases slightly, the
distribution of $b_t$ spreads a little above and below $0$, so $\cos(b_t)$
spreads a little below 1.  As $t$ becomes quite large and the distribution of
$b_t$ approaches uniformity on the real line, $\cos(b_t)$ approaches uniformity
on $[-1,1]$ and so the expectation of the latter approaches 0.  This matches
the behavior of $e^{-t/2}$ --- as well as $e^{-ct}$ in general; I need to
show what's special about $c=1/2$.

Since $E[X]=\int X\,dP$ for random variables $X$, and since the Law of the
Unconscious Statistician tells me $E[f(X)] = \int f(X)\,dP$, and since $b_t$ is
normal with mean $0$ and variance $t$, I can write down explicitly
$$
	E[\cos(b_t)] = \frac{1}{t \sqrt{2\pi}}\int_{-\infty}^{+\infty} \cos(x)
		\, e^{-\frac{x^2}{2t}} \,dx.
$$
To solve this, observe that $\cos(b_t) = \mathrm{Re}(e^{ib_t})$.  Employing
the complete-the-square trick which is usual for Gaussian integrals, we have
\begin{align*}
	E[\cos(b_t)] &= \mathrm{Re}(E[e^{ib_t}]) \\
	E[e^{ib_t}]) &= \frac{1}{t\sqrt{2\pi}}
		\int_{x=-\infty}^{x=+\infty} e^{ix} e^{-x^2/2t}\,dx \\
	&= \frac{1}{t\sqrt{2\pi}} \int_{x=-\infty}^{x=+\infty} \exp\left[
		\frac{-1}{2t}\left(x^2-2tix - t^2 + t^2\right)
		\right]\,dx \\
	&= \frac{e^{t^2/2t}}{t\sqrt{2\pi}} \int_{x=-\infty}^{x=+\infty} \exp\left[
		\frac{-1}{2t}\left(x-ti\right)^2
		\right]\,dx \\
	&= \frac{e^{t/2}}{t\sqrt{2\pi}} \int_{x=-\infty}^{x=+\infty} \exp\left[
		\frac{-1}{2t}\left(x-ti\right)^2
		\right]\,dx.
\end{align*}
I am done as long as
$$
	\mathrm{Re}\left(
	\int_{x=-\infty}^{x=+\infty} \exp\left[
		\frac{-1}{2t}\left(x-ti\right)^2
		\right]\,dx
	\right)
	= t \sqrt{2\pi}.
$$

%% ----------------------------------------------------------------
\subsection{Problem 2.3.b}

\emph{Prove that
$$
	X_t = (b_t + t) \exp(-b_t - t/2)
$$
is a martingale with respect to the filtration of the Brownian motion
$b_t$.
}

Just as above, we have
$$
	E[X_t\mid \mcF_s] = E[X_t] - E[X_s] + X_s;
$$
again, it suffices to show that $E[X_t]$ is constant along $t$.

Figure \ref{fig:2.3.b} shows forty realizations of $X_t$.  Many values of $X_t$
drop far below the horizontal axis and have been clipped from the viewing
window.  Here $X_t$ has much higher variance than in the previous problem, but
it appears (from multiple computational runs) that the sample mean approaches 0
for all $t$.

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/2.3.b.eps}
\caption{Problem 2.3.b: 40 realizations of $(b_t + t) \exp(-b_t - t/2)$
	with sample mean $\overline{X}_t$.
	\label{fig:2.3.b}}
\end{center}
\end{figure}

As in the previous problem, I can combine the Law of the Unconscious
Statistician with the known density function of $b_t$ to compute $E[X_t]$:
\begin{align*}
	E[X_t] &= E[(b_t+t)e^{-b_t}e^{-t/2}] \\
	&= e^{-t/2} E[(b_t+t)e^{-b_t}] \\
	&= e^{-t/2} E[b_t \,e^{-b_t}] + e^{-t/2} E[t\,e^{-b_t}].
\end{align*}

One computes
\begin{align*}
	E[b_t\,e^{-b_t}] &= \frac{1}{t\sqrt{2\pi}}
		\int_{-\infty}^{+\infty} x e^{-x} e^{-x^2/2t}\,dx \\
	&= \frac{1}{t\sqrt{2\pi}} \left[
		-e^{t/2}
			\sqrt{\frac{\pi}{2}}\,\erf\left(\frac{t+x}{\sqrt{2t}}\right) t^{3/2}
		- t e^{-x^2/2t - x}
		\right]_{x=-\infty}^{x=+\infty} \\
	&= -\sqrt{t} e^{t/2}
\end{align*}
since $\erf$ goes to $\pm 1$ as $x \to \pm \infty$, respectively, and since
$e^{-x^2/2t - x}$ goes to 0 as $x \to \pm\infty$.

Likewise, one computes
\begin{align*}
	E[t\,e^{-b_t}] &= t E[e^{-b_t}] \\
	&= \frac{1}{\sqrt{2\pi}}
		\int_{-\infty}^{+\infty} e^{-x} e^{-x^2/2t}\,dx \\
	&= \frac{1}{\sqrt{2\pi}} \left[
		e^{t/2}
			\sqrt{\frac{\pi}{2}}\,\erf\left(\frac{t+x}{\sqrt{2t}}\right) t^{1/2}
		\right]_{x=-\infty}^{x=+\infty} \\
	&= \sqrt{t} e^{t/2}.
\end{align*}

Then
\begin{align*}
	E[X_t] &= e^{-t/2} E[b_t \,e^{-b_t}] + e^{-t/2} E[t\,e^{-b_t}] \\
	&= -e^{-t/2} \sqrt{t} e^{t/2} +e^{-t/2} \sqrt{t} e^{t/2} \\
	&= 0
\end{align*}
as desired.

%% ================================================================
\newpage
\section{Mean-reverting Ornstein-Uhlenbeck process (problem 2.4)}
\label{sec:mrou}

\emph{Solve the mean-reverting \plainidx{Ornstein-Uhlenbeck equation}:
$$
	dX_t = (m-X_t)\,dt + \sigma\,db_t
$$
with real constant $m$ and positive real constant $\sigma$.
Compute the mean and variance of the solution, using constant initial
condition $X_0$.
}

Since this is first-order, an integrating-factor approach is again a good
guess:
\begin{align*}
	e^t\,dX_t &= e^t(m-X_t)\,dt + \sigma e^t\,db_t \\
	d(e^t\,X_t) &= e^t X_t\,dt + e^t(m-X_t)dt + \sigma e^t\,db_t \\
	&= me^t\,dt + \sigma e^t \,db_t.
\end{align*}
Integrating from $0$ to $t$, we have
\begin{align*}
	\int_0^t d(e^s\,X_s) &= m \int_0^t e^s\,ds + \sigma \int_0^t e^s \,db_s \\
	e^t X_t - X_0 &= m(e^t-1) + \sigma \int_0^t e^s \,db_s \\
	X_t &= X_0 e^{-t} + m(1-e^t) + \sigma \int_0^t e^{s-t}\,db_s.
\end{align*}

The mean is
\begin{align*}
	E[X_t] &= X_0 e^{-t} + m(1-e^{-t}) + \sigma E\left[
		\int_0^t e^{s-t}\,db_s \right] \\
	&= X_0 e^{-t} + m(1-e^{-t})
\end{align*}
where the expectation of the integral vanishes by proposition
\ref{prop:property_iii}.

For the variance, we first compute $X_t^2$:
\begin{align*}
	X_t^2 &= X_0^2 e^{-2t} + m^2(1-e^{-t})^2 + \sigma^2\left(
		\int_0^t e^{s-t}\,db_s \right)^2 \\
		&+ 2mX_0 e^{-t}(1-e^{-t})
		+ 2X_0 e^{-t}\sigma\int_0^t e^{s-t}\,db_s
		+ 2m \sigma(1-e^{-t})\int_0^t e^{s-t}\,db_s.
\end{align*}
The last two terms have zero expected value by proposition
\ref{prop:property_iii}; the first, second, and fourth terms are non-stochastic
and are their own means.  For the third term I can again use the \Ito isometry
(proposition \ref{prop:ito_isometry}) with $f_s = e^{s-t}$:
\begin{align*}
	E\left[ e^{-2t} \left(\int_0^t e^s\,db_s \right)^2 \right]
	&= E\left[ e^{-2t} \int_0^t e^{2s}\,ds \right]
	= e^{-2t} \int_0^t e^{2s}\,ds \\
	%
	&= \frac{e^{-2t}}{2}\, \left[e^{2s}\right]_{s=0}^{s=t}
	= \frac{e^{-2t}}{2}\, [e^{2t}-1]
	= \frac{1-e^{-2t}}{2}.
\end{align*}

Combining terms, we have
$$
	E[X_t^2] = X_0^2 e^{-2t} + m^2(1-e^{-t})^2 + 2m X_0 (e^{-t}-e^{-2t})
		+ \frac{\sigma^2}{2}(1-e^{-2t}).
$$
Then
\begin{align*}
	\Var(X_t) &= E[X_t^2] - E[X_t]^2 \\
	&= X_0^2 e^{-2t}
		+ m^2(1-e^{-t})^2
		+ 2m X_0 (e^{-t}-e^{-2t})
		+ \frac{\sigma^2}{2}(1-e^{-2t}) \\
	&- X_0^2 e^{-2t}
		- m^2(1-e^{-t})^2
		- 2m X_0 (e^{-t}-e^{-2t}) \\
	&= \frac{\sigma^2}{2}(1-e^{-2t}).
\end{align*}

The interpretation of the mean and variance is that the process starts surely
at $X_0$, then moves toward $m$:  specifically, the initial state $X_0$ decays
exponentially while the difference from the steady state $m$ decays
exponentially.  Meanwhile the standard deviation of the process starts at zero,
then increases to a steady-state value $\sigma/\sqrt{2}$.

Figure \ref{fig:mrou} shows six realizations of $X_t$ with $t$ from 0 to 10 in
steps of $0.01$.  The parameters are $X_0=1.7$, $m=2$, and $\sigma=0.05$.  In
addition to the six realizations of the process, I also plot the mean $E[X_t]$,
along with the mean plus or minus one and two standard deviations.

\begin{figure}[!htb]
\begin{center}
\includegraphics{code/mrou.eps}
\caption{Problem 2.4: The mean-reverting Ornstein-Uhlenbeck process.
	$M=E[X_t]$; $S=\Var(X_t)^{1/2}$.
	\label{fig:mrou}}
\end{center}
\end{figure}

%% ================================================================
\newpage
\section{Stochastically forced vibrating string (problem 2.5)}

\emph{Solve the stochastically forced vibrating-string equation:
\begin{align*}
	dX_t &=  Y_t\,dt + \alpha \,da_t \\
	dY_t &= -X_t\,dt + \beta  \,db_t
\end{align*}
where $\alpha,\beta$ are real consants and $a_t,b_t$ are independent
Brownian motions.
}

On scratch paper, I tried using a pair of integrating factors --- one for each
equation --- but this did not result in any simplification.  Following a hint
in \cite{bib:bernt}, I realize that we may write
$$
	\colvectwo{dX_t}{dY_t} =
		\prmatrix{ 0 & 1 \\ -1 & 0 }
		\colvectwo{X_t\,dt}{Y_t\,dt}
	+	\colvectwo{\alpha\,da_t}{\beta\,db_t},
$$
and that the appropriate integrating factor for this coupled (hence
second-order) equation is $e^{-At}$ where
$$
	A = \prmatrix{ 0 & 1 \\ -1 & 0 }.
$$
Writing down the power-series expansion
$$
	e^{-At}=\sum_{n=0}^\infty \frac{A^n}{n!}
$$
and collecting even and odd terms, one recognizes the Maclaurin series
for sine and cosine in the matrix elements, leading to
$$
	e^{-At} = \prmatrix{
		\cos(t) & -\sin(t) \\
		\sin(t) &  \cos(t)
	}.
$$
Multiplying the coupled equations through by the integrating factor
gives
\begin{align*}
	\prmatrix{
		\cos(t) & -\sin(t) \\
		\sin(t) &  \cos(t)
	}
	\prmatrix{
		dX_t \\
		dY_t
	}
	&=
	\prmatrix{
		\cos(t) & -\sin(t) \\
		\sin(t) &  \cos(t)
	}
	\prmatrix{
		0  & 1 \\
		-1 & 0
	}
	\prmatrix{
		X_t\,dt \\
		Y_t\,dt
	} \\
	%
	&+
	\prmatrix{
		\cos(t) & -\sin(t) \\
		\sin(t) &  \cos(t)
	}
	\prmatrix{
		\alpha\,da_t \\
		\beta \,db_t
	}
\end{align*}
\begin{align*}
	\prmatrix{
		\cos(t)\,dX_t - \sin(t)\,dY_t \\
		\sin(t)\,dX_t + \cos(t)\,dY_t
	}
	&=
	\prmatrix{
		\sin(t)  & \cos(t) \\
		-\cos(t) & \sin(t)
	}
	\prmatrix{
		X_t\,dt \\
		Y_t\,dt
	}
	%
	+
	\prmatrix{
		\alpha\cos(t)\,da_t - \beta\sin(t)\,db_t \\
		\alpha\sin(t)\,da_t + \beta\cos(t)\,db_t
	}
\end{align*}
\begin{align}
\label{eqn:string_1}
	\prmatrix{
		\cos(t)\,dX_t - \sin(t)\,dY_t \\
		\sin(t)\,dX_t + \cos(t)\,dY_t
	}
	&=
	\prmatrix{
		\sin(t) X_t + \cos(t) Y_t \\
		-\cos(t)X_t + \sin(t) Y_t
	}
	+
	\prmatrix{
		\alpha\cos(t)\,da_t - \beta\sin(t)\,db_t \\
		\alpha\sin(t)\,da_t + \beta\cos(t)\,db_t
	}.
\end{align}

Now, as in the one-dimensional problems above, we need to find
$$
	d\left(e^{-At}\colvectwo{X_t}{Y_t}\right) =
	d\prmatrix{
		\cos(t)X_t - \sin(t)Y_t \\
		\sin(t)X_t + \cos(t)Y_t
	}.
$$
To use the \Ito formula (proposition \ref{prop:ito_nd}), write
\begin{align*}
	g(t,x,y) &= \cos(t)x - \sin(t) y \\
	h(t,x,y) &= \sin(t)x + \cos(t) y.
\end{align*}
Then
\begin{align*}
	\fracDgt &= -\sin(t)x - \cos(t) y, &
	\fracDgx &=  \cos(t), &
	\fracDgy &= -\sin(t), \\
	%
	\fracDht &=  \cos(t)x - \sin(t) y, &
	\fracDhx &=  \sin(t), &
	\fracDhy &=  \cos(t),
\end{align*}
and all second partials in $x$ and/or $y$ are zero.
Then
\begin{align}
\label{eqn:string_2}
	\begin{array}{rr} dg & = \\ dh & = \end{array}
	&
	\begin{array}{rrrrrrrr}
		-\sin(t)X_t\,dt &-& \cos(t)Y_t\,dt &+& \cos(t)\,dX_t &-& \sin_t\,dY_t \\
		 \cos(t)X_t\,dt &-& \sin(t)Y_t\,dt &+& \sin(t)\,dX_t &+& \cos_t\,dY_t.
	\end{array}
	%dg &= (-\sin(t)X_t - \cos(t)Y_t)\,dt + \cos(t)\,dX_t - \sin_t\,dY_t \\
	%dh &= ( \cos(t)X_t - \sin(t)Y_t)\,dt + \sin(t)\,dX_t + \cos_t\,dY_t.
\end{align}
Now we can re-write equation \ref{eqn:string_1} as
\begin{align*}
	\prmatrix{
		\cos(t)\,dX_t - \sin(t)\,dY_t \\
		\sin(t)\,dX_t + \cos(t)\,dY_t \\
	}
	-
	\prmatrix{
		 \sin(t)\,X_t\,dt + \cos(t)\,Y_t\,dt \\
		-\cos(t)\,X_t\,dt + \sin(t)\,Y_t\,dt \\
	}
	=
	\prmatrix{
		 \alpha\cos(t)\,da_t - \beta\sin(t)\,db_t \\
		 \alpha\sin(t)\,da_t + \beta\cos(t)\,db_t
	}.
\end{align*}

Using equation \ref{eqn:string_2}, we have
\begin{align*}
	d\left(e^{-At}\colvectwo{X_t}{Y_t}\right) =
	\prmatrix{
		\alpha\cos(t)\,da_t - \beta\sin(t)\,db_t \\
		\alpha\sin(t)\,da_t + \beta\cos(t)\,db_t
	}.
\end{align*}
Integrating both sides with respect to $t$, we obtain
\begin{align*}
	\int_0^t
	d\left(e^{-As}\colvectwo{X_s}{Y_s}\right) =
	\prmatrix{
		\alpha \int_0^t \cos(s)\,da_s - \beta \int_0^t \sin(s)\,db_s \\
		\alpha \int_0^t \sin(s)\,da_s + \beta \int_0^t \cos(s)\,db_s
	}.
\end{align*}
\begin{align*}
	e^{-At}\prmatrix{X_t \\ Y_t}
	&=
	\prmatrix{X_0 \\ Y_0}
	+
	\prmatrix{
		\alpha \int_0^t \cos(s)\,da_s - \beta \int_0^t \sin(s)\,db_s \\
		\alpha \int_0^t \sin(s)\,da_s + \beta \int_0^t \cos(s)\,db_s
	}.
\end{align*}
\begin{align*}
	\prmatrix{X_t \\ Y_t}
	&=
	\prmatrix{ \cos(t) & \sin(t) \\ -\sin(t) & \cos(t)}
	\prmatrix{
		X_0 + \alpha \int_0^t \cos(s)\,da_s - \beta \int_0^t \sin(s)\,db_s \\
		Y_0 + \alpha \int_0^t \sin(s)\,da_s + \beta \int_0^t \cos(s)\,db_s
	}.
\end{align*}

Figure \ref{fig:string_0.01} shows a realization of $X_t$ and $Y_t$ for $t$
from $0$ to $100$ in steps of $0.01$ and $\alpha=\beta=0.01$: the upper plot
shows shows $X_t$ $Y_t$ as functions of time, while the lower plot is a phase
portrait.  Figure \ref{fig:string_0.1} is similar, but with $\alpha=\beta=0.1$.

\begin{figure}[!pth]
\begin{center}
\includegraphics{code/string_0.01_txy.eps}
\includegraphics{code/string_0.01_xy.eps}
\caption{Problem 2.5: Weakly stochastically forced vibrating string.
	\label{fig:string_0.01}}
\end{center}
\end{figure}

\begin{figure}[!pth]
\begin{center}
\includegraphics{code/string_0.1_txy.eps}
\includegraphics{code/string_0.1_xy.eps}
\caption{Problem 2.5: Strongly stochastically forced vibrating string.
	\label{fig:string_0.1}}
\end{center}
\end{figure}

%% ================================================================
\newpage
\section{The Feynman-Kac formula}
\label{sec:fkac}

The following\index{Feynman-Kac formula} was not contained in Dr. Wehr's
problem set, but (as I write this section in the summer of 2008) is useful
background material for my comprehensive exam.  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:bernt} 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}[!htb]
\begin{center}
\includegraphics{code/fk1.eps}
\caption{Feynman-Kac solution for diffusion with drift.
	\label{fig:fk1}}
\end{center}
\end{figure}

%% ================================================================
\newpage
\section{Generators and forward equations}
\label{sec:gen_fwd}

As with section \ref{sec:fkac}, the following was not contained in Dr. Wehr's
problem set, but (as I write this section in the summer of 2008) is useful
background material for my comprehensive exam.

The plan of this section is as follows:

\begin{enumerate}
\item Present an Ornstein-Uhlenback process which is will be useful for
	comparing the generator and the forward equation.
\item Define the generator, and compute it for the O-U process.
\item Define the forward equation, and compute it for the O-U process.
\item Compare and contrast.
\end{enumerate}

%% ----------------------------------------------------------------
\subsection{Scaled Brownian motion, and another Ornstein-Uhlenbeck process}

\begin{defn}
\emphidx{Scaled Brownian motion} is
$$
	Y_t = \sigma b_t.
$$
\end{defn}

\begin{defn}
The \emphidx{decay-controlled Ornstein-Uhlenbeck
process}\index{Ornstein-Uhlenbeck process} satisfies the SDE
$$
	dZ_t = -\beta\,Z_t\,dt + \sigma\,db_t.
$$
\end{defn}

Compare this DCOU process with the mean-reverting Ornstein-Uhlenbeck (MROU)
process in section \ref{sec:mrou}.  I will not include plots here.  The DCOU
decays to mean 0; the parameter $\beta$ allows one to control the quickness of
that decay.

To solve it, we try the integrating factor $e^{\beta t}$:
\begin{align*}
	e^{\beta t} \,dZ_t &= -\beta e^{\beta t} \,Z_t\,dt
		+ \sigma e^{\beta t}\,db_t \\
	d(e^{\beta t} Z_t) &= \beta e^{\beta t} Z_t \,dt
		- \beta e^{\beta t} Z_t \,dt
		+ \sigma e^{\beta t} \,db_t
	= \sigma e^{\beta t} \,db_t \\
	\int_0^t e^{\beta s} Z_s \,ds &= \sigma \int_0^t e^{\beta s} \,db_s \\
	Z_t &= Z_0 e^{-\beta t} + \sigma \int_0^t
		e^{-\beta(t-s)} \,db_s.
\end{align*}

Doing computations similar to those in section \ref{sec:mrou}, we find
that $Z_t$ has mean and variance
\begin{align*}
	\bbE[Z_t] &= Z_0 e^{-\beta t} \\
	\Var(Z_t) &= \frac{\sigma^2}{2\beta} (1-e^{-2\beta t}).
\end{align*}

\begin{defn}
\label{defn:inst_mean_var}
For a stochastic process
$$
	dX_t = e(X_t,t)\,dt + f(X_t,t)\,db_t,
$$
the \bfidx{instantaneous mean} is $e(X_t,t)$ and the \bfidx{instantaneous
variance} is $f(X_t,t)$.
\end{defn}

Thus, scaled Brownian motion has instantaneous mean 0 and instantaneous
variance $\sigma^2$, but mean 0 and variance $\sigma^2t$.  The DCOU process has
instantaneous mean $-\beta Z_t$ and instantaneous variance $\sigma^2$, but mean
and variance as shown above.  These computations make it clear that the
instantaneous mean and instantaneous variance of a process are distinct from
its mean and variance.

%% ----------------------------------------------------------------
\subsection{Generator of a diffusion process}

\begin{defn}
Let the stochastic process $X_t$ be defined by the SDE
$$
	dX_t = e(X_t,t)\,dt + f(X_t,t)\,db_t.
$$
As in remark \ref{rem:fkac_diffusion}, we say that $X_t$ is a \bfidx{diffusion
process} if $e$ and $f$ are time-independent, i.e. if we may write
$$
	dX_t = e(X_t)\,dt + f(X_t)\,db_t.
$$
\label{defn:diffusion}
\end{defn}

\begin{defn}
Let $X_t$ be a diffusion process as above.  Let $\phi(X_t)$ be some function of
the process.  (In mathematical physics,
$\phi$ might be some observable.)  Define
$$
	f_t(x) = \bbE^x[\phi(X_t)],
$$
where
$$
	\bbE^x[\cdot] = \bbE[\cdot \mid X_0 = x].
$$
Then $f_t(x)$ satisfies
$$
	\frac{\D f_t}{\Dt} = \mcL f_t
$$
where $\mcL$ is a differential operator called the \bfidx{generator} of
the process $X_t$.
\end{defn}

Here we compute the generators of scaled Brownian motion and the DCOU process.
As shown in \cite{bib:bernt}, the generator $\mcL$ of a diffusion process
$$
	dX_t = e(X_t)\,dt + f(X_t)\,db_t
$$
is
$$
	\mcL = e(x) \frac{\D}{\Dx} + \frac{\sigma^2}{2} \frac{\D^2}{\Dx^2}.
$$
For scaled Brownian motion, which satisfies $dX_t=db_t$ so $e=0$ and
$f=\sigma$, we have
\begin{align}
\label{eqn:bm_generator}
	\mcL_\textrm{B} = \frac{\sigma^2}{2} \frac{\D^2}{\Dx^2}.
\end{align}
(In $d\ge 1$ dimensions, this becomes $\frac{1}{2} \nabla^2$.)
For the DCOU process, with $e(x)=-\beta x$ and $f(x)=\sigma$, we have
\begin{align}
\label{eqn:dcou_generator}
	\mcL_{\textrm{DCOU}} = -\beta x\, \frac{\D}{\Dx}
		+ \frac{\sigma^2}{2} \frac{\D^2}{\Dx^2}.
\end{align}

%% ----------------------------------------------------------------
\subsection{The forward equation}

\begin{prop}
Let $X_t$ be a stochastic process (not necessarily a diffusion) satisfying the
SDE
$$
	dX_t = e(X_t,t)\,dt + f(X_t,t)\,db_t,
$$
with initial condition distributed according to
$$
	X_0(x) \sim g(x, 0).
$$
Then the density $g(x,t)$ of $X_t$ satisfies the
\bfidx{forward equation} or \bfidx{Fokker-Planck equation} of $X_t$ which
solves
$$
	\frac{\D g(x,t)}{\Dt} =
		-\frac{\D}{\Dx}\left[e(x,t)g(x,t)\right]
		+\frac{\D^2}{\Dx^2}\left[\frac{f(x,t)^2}{2} g(x,t)\right].
$$
\begin{rem*}
The forward equation governs the time evolution of the density:  it is the
PDE of the PDF.
\end{rem*}
\begin{rem*}
The term $e(x,t)$ is called the \bfidx{drift} of the process; the term
$\frac{1}{2}f(x,t)^2$ is called the \bfidx{diffusion}.  Note that the drift is
synonymous with the instantaneous mean; the diffusion is half the instantaneous
variance.
\end{rem*}
\begin{proof}
See \cite{bib:bernt}.
\end{proof}
\end{prop}

For scaled Brownian motion, with $e(x,t)=0$ and $f(x,t)=\sigma$, we have the
forward equation
$$
	\frac{\D g(x,t)}{\Dt} =
		\frac{\sigma^2}{2} \frac{\D^2}{\Dx^2}\left[g(x,t)\right].
$$
For the DCOU process, with $e(x,t)=-\beta x$ and $f(x,t)=\sigma$, we have
$$
	\frac{\D g(x,t)}{\Dt} =
		\beta \frac{\D}{\Dx}\left[x g(x,t)\right] +
		\frac{\sigma^2}{2} \frac{\D^2}{\Dx^2}\left[g(x,t)\right].
$$

%% ----------------------------------------------------------------
\subsection{Comparison}

The generator and forward equation are superficially similar, but distinct.  In
particular, while they coincide for the Brownian motion, they differ for the
DCOU process.

%% ================================================================

% xxx intuitive derivation of Ito ...

% xxx error analysis ...
% * point out that we could do it
% * do the analysis if time allows -- at least, explain the problem
% * xref to Tom's book
