\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\pl}{\partial}
\parindent=0pt
\begin{document}


{\bf Question}

In a simple random walk on $0, 1, 2,\ldots, a$ there are
probabilities $p, q$ and $1 - p - q$ of a step of $1, -1$ and 0
respectively .  There is a reflecting barrier at 0 defined by:
$$P\{X_n = 0 | X_{n-1} = 0\} = 1-p,$$ $$P\{X_n = 1 | X_{n-1} = 0
\} = p,$$ and an absorbing barrier at $a.$

Derive a difference equation for the expected number, $E_z$, of
steps from a start at $z\ \ (0 \leq z \leq a)$ until absorption
occurs.  Find $E_z$ for the two cases $p = q$ and $p \not= q.$

What is the difference in the expected duration between walks
starting at 0 and starting at 1?



\vspace{.25in}

{\bf Answer}

For $0 < z < a,$

$E_z = p(1+E_{z+1}) + q(1 + E_{z-1}) + (1 - p -q)(1 + E_z)$

$\Rightarrow pE_{z+1} - (p+q)E_z + q E_{z-1} = -1$

The auxiliary equation is $\ds p\lambda^2 - (p+q)\lambda + q =
0\Rightarrow \lambda = 1, \ \ \frac{q}{p}$

For $p \not= q$ a particular solution is $E_z = cz$ and
substituting in the difference equation gives $\ds c =
\frac{1}{q-p}$

So the general solution is $$E_z = A + B\left( \frac{q}{p}
\right)^z + \frac{z}{q-p} \hspace{.2in} 0 \leq z \leq a$$

Boundary conditions:

$\ds E_a = 0$ so $\ds 0 = A + B \left( \frac{q}{p} \right)^a +
\frac{a}{q-p}$

$\ds E_0 = p(1 + E_1) + (1-p)(1+E_0) \Rightarrow 1 + pE_1 - pE_0 =
0$

So $\ds 1 + p\left( A + B \left( \frac{q}{p} \right) \frac{1}{q-p}
\right) - p(a+B) = 0$

Solving the two equations for A and B gives $$E_z = \underbrace {
\frac{q}{(q-p)^2} \left( \frac{q}{p} \right)^a -
\frac{a}{q-p}}_{\ds A} \, \underbrace{ - \frac{q}{(q-p)^2}}_{\ds
B} \left( \frac{q}{p} \right)^z + \frac{z}{q-p}$$

For $p=q$  the auxiliary equation has equal roots $\lambda =1,$ so
the general solution is $\ds A + B z.$ A particular solution will
be $cz^2$, and substituting gives $\ds c = -\frac{1}{2p}$

So $\ds E_z = A + B z - \frac{z^2}{2p}$

The boundary conditions are as above, and give

$(z=a) \hspace{.2in} \ds 0 = A + Ba - \frac{a^2}{2p}$

$(z=0) \hspace{.2in} \ds 1 = p\left(A + B - \frac{1}{2p}\right) -
p \cdot A = 0$

So $\ds E_z = \frac{a^2 + a}{2p} - \frac{z}{2p} - \frac{z^2}{2p}$

from which $\ds E_0 - E_1 = \frac{1}{p}$

Alternatively this equation is simply a rearrangement of the
boundary condition at $z = 0$



\end{document}
