On this web page, we describe the gambler’s ruin Markov chain. This allows us to demonstrate many of the concepts from Hitting Probabilities.
Description
Player A starts with $a and player B starts with $b. On each turn, they bet $1. The probability that A wins is p and the probability that B wins is q, with p + q = 1. The game continues until one player runs out of money. What is the probability that A goes broke, and what is the probability that B goes broke?
Let m = a + b. We use the sample space S = {0, 1, …, m}. Here, xn = the amount of money held by A, where x0 = a and the transition probabilities are
The probability that A goes broke given that he starts with $i is hi0.
hi0 = P(xn = 0 for some n | x0 = a)
But
hi0 = phi+1,0 + qhi-1,0 h00 = 1 hm0 = 0
This is a homogeneous difference equation of form
Hitting probabilities
Property 1: The probability that Player A will go broke in the gambler’s ruin game is
where ρ = q/p.
Proof: The characteristic equation is
The roots of this equation are
Thus, the roots are 1 and ρ = (1–p)/p = q/p
One root case
Suppose p = ½, then q = ½, and so there is one distinct root 1/(2p) = 1. The solution, therefore, takes the form
hi0 = A + Bi)1i = A + Bi
Using the initial conditions, we see that
1 = h00 = A + B(0) = A
0 = hm0 = A + B(m) = 1 + Bm
Thus, B = –1/m and A = 1. Therefore, the solution takes the form
hi0 = A + Bi = 1 – i/m
Two distinct real roots case
Since the roots are 1 and ρ, the solution takes the form
Using the initial conditions, we see that
1 = h00 = A + Bρ0 = A + B
0 = hm0 = A + Bρm
Hence
A = –Bρm
1 = A + B = –Bρm + B = (1–ρm)B
It now follows that
Limiting case
In the case where Player B has a huge cash reserve (e.g. Player B is a casino), we can estimate ha0 by using the limit when b → ∞ (or equivalently when m → ∞). Also, suppose that the odds are in favor of Player B (i.e. q > p).
This means that in the long run, Player A will lose all his money. Even in the case where p = q, we have
When does Player B go broke?
Property 2: The probability that one of players will go broke in the gambler’s ruin game is 1. The probability that Player B goes broke is 1 – ha0 (as described in Property 1).
Proof: Let U = {0, m}. We first prove that hiU = 1 for any i. The proof is almost identical to the proof of Property 1. The only difference is the impact of the initial condition that hmU = 1, whereas hm0 = 0.
When p = .5, as before
hiU = A + Bi
Using the initial conditions, we obtain
1 = h0U = A + B(0) = A
1= hmU = A + Bm = 1 + Bm
we see that A = 1 and B = 0. Thus
hiU = A + Bi = 1 + 0 = 1
When p ≠.5
hiU = A + Bρi
Using the initial conditions, we obtain
1 = h0U = A + Bρ0 = A + B
1= hmU = A + Bρm = 1 + Bρm
Bρm = 0
Thus, B = 0 and A = 1, and so
hiU = A + Bρi = 1 + 0 = 1
Now since 0 and m are both absorbing states, hi0 + him = hiU = 1. Thus him = 1 – hi0.
Expected duration
Property 3: The expected duration for gambler’s ruin is
where U = {0, m}.
Proof: Using the approach from Hitting Probabilities, we see that
kiU = 1 + pki+1,U + qki-1,U k0U = 0 kmU = 0
This can be expressed as the second-order non-homogeneous difference equation
As we saw in the proof of Property 1, the roots of the characteristic equation for this difference equation are again 1 and ρ = q/p. We use the approach described in Second-order Difference Equations to deal with the non-homogeneous component.
Two distinct real roots case
We first note that
Since this is zero, we, instead, define d as follows:
Thus, we can express kiU as follows
kiU = A + Bρi – i/(1–2p)
Using the initial conditions, we observe that
0 = k0U = A + Bρ0 – 0/(1–2p) = A + B
Thus, A = –B.
(1 – ρm)B = m/(1–2p)
Thus
kiU = A + Bρi – i/(1–2p)
One root case
If p = q, then 1 is the only root. Since p = 1/2,
So we need to use the following expression for d
Thus, kiU can be expressed as
kiU = A + Bi – i2
Again, we use the initial conditions, as follows:
0 = k0U = A + B(0) – 02 = A
0 = kmU = A + B(m) – m2 = 0 + Bm – m2
Thus, B = m. Thus, the general solution can be expressed as
kiU = A + Bi – i2 = 0 + m – m2 = m(1 – m)
Limiting case
When Player B has a huge cash reserve (e.g. a casino), we can estimate kaU by using the limit when b → ∞ (or equivalently when m → ∞). Also, suppose that the odds are in favor of Player B (i.e. q > p).
Since q > p, ρm → ∞ faster than m → ∞, which is why m(1 – ρa)/(1 – ρm) → 0.
We conclude that Player A will go broke in an average of a/(q–p) steps.
In the case where p = q = .5 (even odds)
We conclude that although Player A will eventually go broke, it might take a long time to do so.
Links
References
Aldridge, M. (2021) Hitting times. Introduction to Markov Processes
https://mpaldridge.github.io/math2750/S08-hitting-times.html
Norris, J. (2004) Discrete-time Markov chains. Cambridge University Press
https://www.statslab.cam.ac.uk/~jrn10//Markov/
Sargent, T. J., Stachurski, J. (2025) Markov chains: Basic concepts. First course in quantitative economics with Python
https://intro.quantecon.org/markov_chains_I.html


















