The gambler’s ruin describes a scenario where a gambler starts with an initial capital $x$ and repeatedly bets a fixed amount (e.g. 1 unit) on a game. In each game, there are two possible outcomes:
- *Win:* With probability $p$, the gambler's capital increases by one unit.
- *Lose:* With probability $q=1−p$, the gambler's capital decreases by one unit.
The game continues until the gambler either goes broke (reaches $0$ capital) or reaches a target capital $a$, at which point the game ends.
## Probability of Ruin
Let $Q_x$ be the probability of ruin for the gambler starting from capital $x$. After one game, the capital either increased or decreased by $1$, which affects the future probability of ruin. Thus, we can write $Q_x$ in recursive form:
$ Q_x = pQ_{x+1} + qQ_{x-1}$
This equation is a *second-order linear difference equation*, since $Q_x$ is expressed as a linear combination of its two adjacent terms in the sequence, namely $Q_{x+1}$ and $Q_{x-1}$.
## Solutions of the Difference Equation
For the above recursive formula, there are two solutions:
$ Q_x=1 \quad \text{and} \quad Q_x =\left(\frac{q}{p}\right)^x$
In mathematics, when an equation is linear and you have two solutions $f(x)$ and $g(x)$ that satisfy the equation, then any combination of these solutions is a valid solution as well.
$ Q_x=A\,f(x)+B\,g(x)$
Substituting our identified solutions into that linear form:
$
\begin{align}
Q_x = A*1+B*\left(\frac{q}{p}\right)^x\\[4pt]
= A+B*\left(\frac{q}{p}\right)^x
\end{align}$
## Applying Boundary Conditions
We know the probability of ruin $Q_x$ for the two boundary conditions:
- At $x=0$: The gambler is already ruined
- At $x=a$: The gambler has reached the target capital and the game ends.
$ Q_0=1, \quad Q_a=0$
Using these boundary conditions, we setup a system of 2 equations to solve for $A$ and $B$:
Condition 1: $Q_0=1$
$ 1 = A+B\left(\frac{q}{p}\right)^0 \implies A=1-B$
Condition 2: $Q_a=0$
$
\begin{align}
0 &= A+B\left(\frac{q}{p}\right)^a \\[2pt]
0 &= 1-B+B\left(\frac{q}{p}\right)^a \\[2pt]
B-B\left(\frac{q}{p}\right)^a &=1\\[2pt]
B &= \frac{1}{1-\left(\frac{q}{p}\right)^a}
\end{align}
$
Now that we have determined $A$ and $B$, substitute them back into the general solution:
$
\begin{align}
Q_x &= A+B*\left(\frac{q}{p}\right)^x \\[2pt]
&= 1-B+B\left(\frac{q}{p}\right)^x \\
&= 1-\frac{1}{1-\left(\frac{q}{p}\right)^a}+\frac{1}{1-\left(\frac{q}{p}\right)^a}\left(\frac{q}{p}\right)^x\\[6pt]
&=\frac{1-\left(\frac{q}{p}\right)^a-1+\left(\frac{q}{p}\right)^x}{1-\left(\frac{q}{p}\right)^a}\\[6pt]
\end{align}
$
Simplifying further, the probability of ruin $Q_x$ is:
$ Q_x=\frac
{\left(\frac{q}{p}\right)^a-\left(\frac{q}{p}\right)^x}
{\left(\frac{q}{p}\right)^a-1}
$
## Generalize the Step Size
If the gambler bets $b$ units each time (instead of 1 unit), the capital changes by $\pm b$ per game. The recursive equation now becomes:
$ Q_x = pQ_{x+b} + qQ_{x-b}$
The two solutions for this linear equation are:
$ Q_x=1, \quad Q_x = \left(\frac{q}{p} \right)^{x/b}$
> [!note:]
> This also makes intuitive sense, since the probability of ruin only cares about the number of discrete steps until hitting the boundary. Increasing the bet $b$ e.g. by a factor of $2$, is similar of lowering the target capital $a$ by half.
By following the same algebraic steps as before, we obtain the following for the probability of ruin:
$ Q_x=\frac
{\left(\frac{q}{p}\right)^{a/b}-\left(\frac{q}{p}\right)^{x/b}}
{\left(\frac{q}{p}\right)^{a/b}-1}
$