Gambler's ruin

Consider a random walk where at each step $k$, $$ \prob(Y_k = +1) = p, \quad \prob(Y_k = -1) = 1-p \equiv q. $$ The gambler will walk away either when $X_n = a$ or 0.

The key is to see that if we condition on the first step, say $Y_1=1$, then $(X_{n+1})_{n\geq 0}$ is again a simple random walk with the same step distribution.

Denote $\prob_x$ and $\expect_x$ for probability and expectation regarding initial value $x$, and $$ T = \min\sb{n\geq 0}{X_n=0\text{ or } a}. $$

Proposition (gambler's ruin almost always terminates) open_in_new

The process almost always terminates, i.e. $\prob(T<\infty) = 1$. (Derivation)

Prbability of success in gambler's ruin open_in_new

Let the probability of success be $h_x = \prob(X_T=a)$.

For $x=1,2,\ldots,a-1$, using the law of total probability $$ \begin{align*} h_x &= \prob(Y_1=1)\prob(X_T=a|Y_1=1)+\prob(Y_1=-1)\prob(X_T=a|Y_1=-1) \\ &= ph_{x+1} + qh_{x-1} \end{align*} $$ and boundary condition is $$ h_0 = 0, \quad h_a=1. $$ Solving (derivation), $$ h_x = \begin{cases} \dfrac ax, &p=\dfrac12, \\ \dfrac{1-(p/q)^x}{1-(p/q)^a}, &p\neq\dfrac12. \end{cases} $$

Mean time to absorption in gambler's ruin open_in_new

Let the mean time to absorption be $\tau_x = \expect_x(T)$.

For $x=1,2,\ldots,a-1$, using the law of total expectation, $$ \begin{align*} \tau_x &= \prob(Y_1=1)\expect(X_T=a|Y_1=1)+\prob(Y_1=-1)\expect(X_T=a|Y_1=-1) \\ &= p(1+\tau_{x+1}) + q(1+\tau_{x-1}) \\ &= 1+p\tau_{x+1} + q\tau_{x-1}. \end{align*} $$ and boundary condition is $$ \tau_0 = 0,\quad \tau_a = 0. $$ Solving (Derivation), $$ \tau_x = \begin{cases} x(a-x),& p=\dfrac12,\\ \dfrac{x}{q-p}-\dfrac{a}{q-p}\dfrac{(q/p)^x - 1}{(q/p)^a-1},& p\neq\dfrac12. \end{cases} $$