NowhereLog

Gambler's Ruin

September 01, 2022

As a professional gambler, it seems natural to start with gambler’s ruin.

As a professional gambler, I’m extremly senstive about the house edge. That’s why I mostly just play fair games like flipping a coin. After a coin is flipped, I win 1 dollar for head (H) and lose 1 dollar for tail (T). I play until I got broke or the casino got broke (ambitious plan). As ridiculous it seems, I almost always got broke, even though it’s a “fair” game.

Let’s consider a more general version of the problem. Two gamblers Alice and Bob flip a biased coin with probability pp to get a head and q=1pq = 1-p to get a tail. Alice wins 1 dollar from Bob if head is flipped and loses 1 dollar to Bob if tail is flipped. Alice has aa dollars and Bob has b=nab = n-a dollars to start with. The game ends when one party owns all nn dollars.

Let AiA_i be the probability that Alice gets all nn dollars starting with ii dollars, and BiB_i be the probability that Bob gets all nn dollars starting with ii dollars. We have An=Bn=1A_n = B_n = 1 and A0=B0=0A_0=B_0=0.

Suppose Alice has ii dollars now and they flip a coin. If a head comes, Alice will own i+1i+1 dollars and the probability that she wins in the end is exactly Ai+1A_{i+1}; similarly, the probability that she wins is Ai1A_{i-1} if a tail is flipped. Thus, we have

Ai=pAi+1+qAi1    Ai+1Ai=qp(AiAi1)A_i = p A_{i+1} + q A_{i-1} \implies A_{i+1} - A_{i} = \frac{q}{p}(A_{i} - A_{i-1})

Using the equations on the right recursively, we have that

AiAi1=qp(Ai1Ai2)=(qp)2(Ai2Ai3)==(qp)i1(A1A0)=(qp)i1A1A_i - A_{i-1} = \frac{q}{p} (A_{i-1} - A_{i-2}) = \Big(\frac{q}{p}\Big)^2 (A_{i-2} - A_{i-3}) = \cdots = \Big(\frac{q}{p}\Big)^{i-1} (A_{1} - A_{0}) = \Big(\frac{q}{p}\Big)^{i-1} A_{1}

Using the equations on the right and A0=0A_0 = 0, we have

Ai=AiA0=j=1iAjAj1=Aij=1i(qp)j1={iAiq=p=121(qp)i1qpA1qpA_i = A_i - A_0 = \sum_{j=1}^i A_j - A_{j-1} = A_i \sum_{j=1}^i \Big(\frac{q}{p}\Big)^{j-1} = \begin{cases} iA_i & q = p = \frac{1}{2} \\ \frac{\displaystyle 1-\Big(\frac{q}{p}\Big)^{i}}{\displaystyle 1-\frac{q}{p}} A_1 & q \neq p \end{cases}

Substitute in An=1A_n = 1,

A1={1nq=p=121qp1(qp)nqpA_1 = \begin{cases} \frac{\displaystyle 1}{\displaystyle n} & q = p = \frac{1}{2} \\ \frac{\displaystyle 1-\frac{q}{p}}{\displaystyle 1-\Big(\frac{q}{p}\Big)^{n}} & q \neq p \end{cases}

Thus, we have

Ai={inq=p=121(qp)i1(qp)nqpA_i = \begin{cases} \frac{\displaystyle i}{\displaystyle n} & q = p = \frac{1}{2} \\ \frac{\displaystyle 1-\Big(\frac{q}{p}\Big)^{i}}{\displaystyle 1-\Big(\frac{q}{p}\Big)^{n}} & q \neq p \end{cases}

By symmetry, we have

Bi={inq=p=121(pq)i1(pq)nqpB_i = \begin{cases} \frac{\displaystyle i}{\displaystyle n} & q = p = \frac{1}{2} \\ \frac{\displaystyle 1-\Big(\frac{p}{q}\Big)^{i}}{\displaystyle 1-\Big(\frac{p}{q}\Big)^{n}} & q \neq p \end{cases}

It takes some algebra to show that Ai+Bni=1A_i + B_{n-i} = 1. This apparently makes sense, since either Alice wins or Bob wins. However, it is actually a non-trivial result because it suggests the game is finite.


By NowhereMan who goes nowhere.


© 2024, NowhereLog by NowhereMan