Last modified on 01 Oct 2021.

Consider a gambler who starts with an initial fortune of ii$ and then on each successive gamble either wins 11$ or loses 11$ independent of the past with probabilities pp and q=1pq = 1−p respectively. The gambler’s objective is to reach a total fortune of NN$, without first getting ruined (running out of money).

Let PiP_i be the probability that the gambler wins when starting with ii$, we have

P0=0PN=1Pi=pPi+1+qPi1 \begin{aligned} P_0 &= 0 \\ P_N &= 1 \\ P_i &= pP_{i+1} + qP_{i-1} \end{aligned}

Finally,

Pi={1qp1(qp)N,if pq;1Nif p=q=12. \begin{aligned} P_i = \begin{cases} \dfrac{1-\frac{q}{p}}{1-(\frac{q}{p})^N}, & \text{if } p \ne q; \\ \dfrac{1}{N} &\text{if }p=q=\frac{1}{2}. \end{cases} \end{aligned}

Note that, 1Pi1-P_i is the probability of ruin.

Another type of this question: Consider an ant walking along the positive integers. At position ii, the ant moves to i+1i+1 with probabilities pp and to i1i-1 with probabilities qq. If the ant reach 00, it stops walking. Starting from i>0i>0, what is the probability that the ant reaches i=Ni=N before reaching 00?

Sometimes, we consider above problem as a random walk problem. This post is copied from this and we have a backup version here.