The Gambler's Ruin Problem

Problem Statement

A gambler starts with initial capital of $k$ dollars and repeatedly plays a game where:

The gambler continues playing until either:

Question: What is the probability that the gambler reaches $N$ before going broke?

Mathematical Analysis

Setting up the Problem

Let $P_k$ be the probability of reaching $N$ starting from $k$ dollars.

We have the boundary conditions:

For $0 < k < N$, we have the recurrence relation:

$$P_k = p \cdot P_{k+1} + q \cdot P_{k-1}$$

Solution of the Recurrence

The general solution depends on whether the game is fair ($p = q = 0.5$) or unfair ($p \neq q$):

Case 1: Fair Game ($p = 0.5$)

$$P_k = \frac{k}{N}$$

Case 2: Unfair Game ($p \neq 0.5$)

$$P_k = \frac{1 - (q/p)^k}{1 - (q/p)^N}$$

Expected Duration

Let $E_k$ be the expected number of games until absorption (reaching 0 or N) starting from $k$.

Fair Game:

$$E_k = k(N-k)$$

Unfair Game:

$$E_k = \frac{k}{q-p} - \frac{N}{q-p} \cdot \frac{1-(q/p)^k}{1-(q/p)^N}$$

Interactive Simulation

Single Gambler's Path

Success Probability by Initial Capital

Simulation Results

Theoretical Analysis

Concrete Examples

Example 1: Fair Game

A gambler starts with $30 and wants to reach $100. Each bet is a fair coin flip.

Solution: Since $p = 0.5$, we use the fair game formula:

$$P_{30} = \frac{30}{100} = 0.3$$

The gambler has a 30% chance of reaching $100 before going broke.

Example 2: Casino Game

Playing roulette (betting on red/black), a gambler starts with $40 and wants to reach $100.

Solution: Since $p \neq 0.5$, we calculate $q/p = 20/18 = 10/9$:

$$P_{40} = \frac{1 - (10/9)^{40}}{1 - (10/9)^{100}} \approx 0.0002$$

The gambler has only about 0.02% chance of reaching $100!