<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\pl}{\partial}
\parindent=0pt
\begin{document}


{\bf Question}

Write down and solve the difference equations for the Gambler's
ruin problem when the chances of winning and losing 1 unit are $p$
and $q,$ respectively, and the chance of a draw on a bet is $r\ \
(p + q + r =1).$

(Hint: try, as a particular solution to the difference equation
for the expected duration of the game, a multiple of the gambler's
capital $z$).

\vspace{.25in}

{\bf Answer}

\begin{eqnarray*} P({\rm ruin}) &amp; = &amp; P({\rm ruin\ \&amp;\ wins\ first\
bet}) + P({\rm ruin\ \&amp;\ loses\ first\ bet})\\ &amp; &amp; + P({\rm ruin\
\&amp;\ draws\ on\ first\ bet}) \\ &amp; = &amp; P({\rm ruin\ |\ wins\ first\
bet}) \cdot P({\rm wins\ first\ bet}) \\ &amp; &amp; + P({\rm ruin\ |\
loses\ first\ bet}) \cdot P({\rm loses\ first\ bet}) \\ &amp; &amp; +
P({\rm ruin\ |\ draws\ first\ bet}) \cdot P({\rm draws\ first\
bet}) \end{eqnarray*}

So \begin{eqnarray*} q_z &amp;  = &amp; q_{z+1} \cdot p + q_{z-1} \cdot q
+ q_z \cdot r \\ q_z(1-r) &amp; =  &amp; pq_{z+1} +q  q_{z-1} \\ q_z &amp; = &amp;
\frac{p}{p+q} q_{z+1} + \frac{q}{p+q} q_{z-1} \hspace{.3in} {\rm
assuming\ }r \not= 1 \end{eqnarray*} with boundary conditions $q_0
=1$ and $q_a = 0$

 Substituting $q_z = \lambda^z$ gives
$$\lambda^z  =  \frac{p}{p+q} \lambda^{z+1} + \frac{q}{p+q}
\lambda^{z-1}$$
\begin{eqnarray*}  \\ {\rm i.e.\ \ } \frac{p}{p+q} \lambda^2 -
\lambda + \frac{q}{p+q} &amp; = &amp; 0 \\ (\lambda-1)\left( \frac{p}{p+q}
\lambda - \frac{q}{p+q} \right) &amp; = &amp; 0 \end{eqnarray*}

 $${\rm So}\ \  \lambda = 1 \hspace{.2in} {\rm or} \hspace{.2in} \lambda =
\frac{q}{p} $$

IF $p\neq q$ then $\ds q_z=A+B\left(\frac{q}{p}\right)^z$

The boundary conditions give $1  =  A + B$ and $ 0  =  A + B
\left( \frac{q}{p} \right)^a$ which give $$q_z =
\frac{\left(\frac{q}{p} \right)^z + \left( \frac{q}{p}
\right)^a}{1 - \left( \frac{q}{p} \right)^a} \hspace{.2in} (p
\not= q) $$

\bigskip

If $p=q$ we have a repeated root $\lambda = 1$, so we have the
general solution $(A + Bz) \cdot 1^z$ and a particular solution,
applying the boundary conditions, $\ds q_z = 1 - \frac{z}{a}$.

\bigskip

To find the expected duration of the game \begin{eqnarray*} E_z &amp;
= &amp; p(1 + E_{z+1}) + q ( 1 + E_{z-1}) + r (1+ E_z) \\ E_z &amp; = &amp;
\frac{1}{p+q} + \frac{p}{p+q}E_{z+1} + \frac{q}{p+q}E_{z-1}
\end{eqnarray*} with boundary conditions $E_0 = 0$ and $E_a = 0$.

The general solution of the homogeneous equation is
\begin{eqnarray*} A + B \left( \frac{q}{p} \right) ^ z &amp; &amp; p \not=
q \\ A' + B'z &amp; &amp; p = q \end{eqnarray*} Particular solutions to
try for the non-homogeneous equation are $\ds E_z = Cz$ for
$p\not= q$ or $\ds E_z = Dz^2$ if $p=q$

Applying the boundary conditions gives: \begin{eqnarray*} E_z &amp; =
&amp; \frac{z}{q-p} - \frac{a}{q-p} \left( \frac{1 - \left(
\frac{q}{p} \right)^z}{1 - \left( \frac{q}{p}\right)^a }\right)
\hspace{.2in} p \not= q
\\ E_z &amp; = &amp; \frac{z(a-z)}{p+q} \hspace{1.55in} p=q \end{eqnarray*}



\end{document}
</pre></body></html>