Events and Probability Spaces · Recursive Probability Computation (Optional)
Lesson 6
To better understand why this happens, let's model this process. The graph below shows the trajectory of the player's capital with initial capital \(n=100\) and winning probability \(p=18/38\).
import matplotlib.pyplot as plt
from random import random, seed
capital, target, probability = 100, 200, 18/38
seed(25)
current, sequence = capital, []
while 0 < current < target:
current += 1 if random() < probability else -1
sequence.append(current)
plt.plot(sequence)
plt.plot([0, len(sequence)], [capital, capital + len(sequence) * (2 * probability - 1)])
plt.savefig('gambling.png') =5/image0.png)
In this experiment, the player went bankrupt after approximately 2500 bets. The orange line shows the expected capital of the player: since with each bet, the player's capital increases with probability \(18/38\) and decreases with probability \(20/38\), the expected decrease in their capital with each bet is \(2/38\). Therefore, the expected value of their capital after \(k\) bets will be \[100-\frac{2k}{38}.\] Specifically, after \(k=2500\) bets, this number will already be negative. Although the capital trajectory is random, it is clear that it still somewhat follows the drawn line, and the capital gradually decreases. The lower the capital becomes, the harder it is to reach the target capital. For example, in the experiment, the capital, closer to the beginning, grew to 110, and at the \(1500\)-th bet, there was a jump in capital (approximately from \(50\) to \(80\)), but this did not help the overall picture.
As usual, play around with the code above: change the values of the initial and target capitals, try different values for initializing the pseudorandom generator, and observe the behavior at \(p=\frac{1}{2}\).