Recently, I needed to use a result that was, at the heart of it, a glorified **gambler’s ruin** problem. I have not looked at gambler’s ruin for a while, so thought that it will be fun to rederive the results. Gambler’s ruin refers to various scenarios, the most common of which is the following.

A gambler enters a casino with $ in cash and starts playing a game where he wins with probability and looses with probability The gampler plays the game repeatedly, betting $ in each round. He leaves the gave it his total fortune reaches $

Nor he runs out of money (he isruined), whichever happens first. What is the probability that the gambler is ruined.

A gambler’s ruin can be modeled as a one-dimensional random walk in which we are interested in the hitting probability of the absorbing states. Calculating these probabilities is fairly straightforward. Let denote the probability that the gambler’s fortune reaches $ before he is ruined on the condition that his current fortune is . Then,

which can be rewritten as

Since , we have that

and similarly

Continuing this way, we get that

.

and therefore, by adding the first such terms, we get

.

Moreover, we know that

.

Thus,

.

Combining with the previous expression for we get,

.

For ease of representation let . Then, the probability of *winning* are

.

This was simple, but I am interested in finding the expected time when the game stops.

#### Expected number of steps until stopping

Let denote the number of plays until the game stops on the condition that the player’s current fortune is $. As before, we can write

.

Rewriting this and observing , we get

.

Rearranging terms, we have

.

Since $C_N(0) = 0$, we have that

.

where . And similarly,

.

Continuing this way, we have that

.

Adding the first such terms, we get

.

Moreover, we know that . Thus,

.

Substituting this back in the expression for , we get

.

When , we obtain a simplified expression

.

OK. Itch scratched. That feels better.

Pingback: A martingale solution to gambler’s ruin « Random Determinism

The Martingale method in another article is great! However, I guess you made a mistake when calculating the expected number of steps in both the Markov Chain and the Martingale method.

In the Markov Chain method, the second equation should be minus (1+\lambda) instead of plus, i.e.:

displaystyle C_N(n+1) – C_N(n) = \lambda [ C_N(n) – C_N(n-1)] – (1 + \lambda)

Therefore, the final formula should be:

\displaystyle C_N(n) = \frac{ (1+\lambda)}{(1 – \lambda)} \left[ -n + N \frac{ (1 – \lambda^n)}{(1 – \lambda^N)} \right]

This makes sense because in the Martingale method,

E[\sum_t=1^\tau Z_t] = E[\sum_t=1^\tau (X_\tau – X_0)] = {N*P_N(n) + 0*[1-P_N(n)]}-n