% vim: tw=50
% 17/02/2022 11AM

\subsubsection*{Random Walks}

\ul{Setting}: $(X_n)_{n \ge 1}$ independent and
identically distributed random variables
\[ S_n = x_0 + X_1 + \cdots + X_n \]
$(S_0, S_1, S_2, \dots)$ is a random process
called \emph{Random Walk} started from $x_0$.
\myskip
\ul{Main example in our course}: \\
\emph{Simple Random Walk} (SRW) on $\ZZ$.
\[ \PP(X_i = +1) = p \qquad \PP(X_i = -1) = q = 1 - p \]
$x_0 \in \ZZ$ (often $x_0 = 0$). \\
\ul{Special case}: $p = q = \half$.
(``symmetric''):
\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/0d89842e8fe311ec.png}
\end{center}
For example, $\PP(S_2 = x_0) = pq + qp = 2pq$.
\myskip
\ul{Useful interpretation}: A gambler repeatedly
plays a game where he wins $\pounds 1$ with $\PP = p$ and
losses $\pounds 1$ with $\PP = q$. \\
Often we stop if we ever reach $\pounds 0$.
\myskip
\textbf{Question}: Suppose we start with $\pounds
x$ at time 0. What is the probability he reaches
$\pounds a$ before $\pounds 0$?

\begin{notation*}
    \[ \PP_X(\bullet) ``='' \PP(\bullet \mid x_0 =
    x) \]
    ``measure of RW started from $x_0$''.
\end{notation*}

\noindent
\ul{Key Idea}: Conditional on $S_1 = z$, $(S_1,
S_2, \dots)$ is a random walk started from $z$. \\
Now we apply the Law of Total Probability:
\begin{align*}
    \PP_X(\text{$S$ hits $a$ before 0}
    &= \sum \PP_X(\text{$S$ hits $a$ before 0}
    \mid S_1 = z)\PP_X(S_1 = z) \\
    &= \sum_z \PP_Z (\text{$S$ hits $a$ before
    0})\PP_Z(S_1 = z)
\end{align*}
so $h_X = \PP_X(\text{$S$ hit $a$ before 0})$.
$S_1 = x \pm 1$.
\[ h_X = px_{x + 1} + qh_{x - 1} \]
Important to specify boundary conditions:
\[ h_0 = 0, \qquad h_a = 1 .\]
Now we apply law of total expected value. Expected
absorption time:
\[ T = \min\{n \ge 0 : S_n = 0 \text{ or } S_n =
a\} \]
``first time $S$ hits $\{0, a\}$''. Want:
$\EE_x[T] = \tau_x$.
\begin{align*}
    \tau_x = \EE_x[T]
    &= p \EE_x [T \mid S_1 = x +
    1] + q\EE_x[T \mid S_1 = x - 1] \\
    &= p \EE_{x + 1}[T + 1] + q \EE_{x - 1}[T + 1]
    \\
    &= p(1 + \EE_{x + 1}[T]) + q(1 + \EE_{x -
    1}[T]) \\
    &= 1 + p \tau_{x + 1} + q\tau_{x - 1}
\end{align*}
Boundary conditions:
\[ \tau_0 = \tau_a = 0 \]
``we're already there''

\subsubsection*{Solving Linear Recurrence Equations}

Homogeneous case (boundary conditions: $h_0, h_a$):
\[ ph_{x + 1} - h_x + qh_{x - 1} = 0 \]
\begin{itemize}
    \item Analagous to DEs
    \item Solutions form a vector space.
\end{itemize}
\ul{Plan}: (homogeneous case):
\begin{itemize}
    \item Find two solutions (linearly
        independent)
\end{itemize}
Guess $h_x = \lambda^x$, so
\[ p\lambda^{x + 1} - \lambda^x + q\lambda^{x - 1}
= 0 \]
\[ p\lambda^2 - \lambda + q = 0 \]
Quadratic in $\lambda \implies \lambda = 1
\text{ or } \frac{p}{q}$. \\
\ul{Case $q \neq p$}: $h_x = A + B \left(
\frac{q}{p} \right)^x$.
\begin{itemize}
    \item Use boundary conditions to find $A$,
        $B$: i.e.
        \[ x = 0: \qquad h_0 = 0 = A + B \]
        \[ x = a: \qquad h_a = 1 = A + B \left(
        \frac{q}{p} \right)^a \]
        \[ h_x = \frac{\left( \frac{q}{p}
        \right)^x - 1}{\left( \frac{q}{p}
        \right)^a - 1} \]
\end{itemize}
\ul{Case $p = q = \half$}: (symmetric random walk)
\begin{itemize}
    \item Note $h_x = x$ ``$x$ is the average of
        $x + 1$ and $x - 1$''.
\end{itemize}
General solution: $h_x = A + Bx$. Boundary
conditions:
\[ h_0 = 0 = A \]
\[ h_a = 1 = A + Ba \]
so $A = 0$, $B = \frac{1}{a}$. Hence
\[ h_x = \frac{x}{a} \]
\myskip
\ul{Probability sanity check}: $p = q = \half$. \\
Study Expected profit if you start from $\pounds
x$ and play until time $T$.
\[ \EE_x [S_T] = a \PP_x(S_T = a) + 0 \times
\PP_x(S_T = 0) = a \cdot \frac{x}{a} = x \]
fits intuition for fair games.

\subsubsection*{Inhomogeneous Case}

\[ ph_{x + 1} - h_x + qh_{x - 1} = f(x) = -1 \]
Plan:
\begin{itemize}
    \item Find a \emph{particular solution} Guess:
        ``one level more complicated than general
        solution''.
    \item Add on general solution
    \item Solve for boundary conditions
\end{itemize}
For $p \neq q$: Guess $h_x = \frac{x}{q - p}$
works as a particular solution. \\
For $p = q = \half$: Guess $h_x = Cx^2$
\emph{might} work. Sub in:
\[ \frac{C}{2} (x + 1)^2 - Cx^2 + \frac{C}{2} (x -
1)^2 = -1 \implies C = -1 \]
So
\[ h_x = A + Bx - x^2 \]
then find $A$, $B$ with boundary conditions:
roots are 0 and $a$, so
\[ h_x = x(a - x) \]
