Smith is in jail and has 1 dollar; he can get out on bail if he has 8 dollars. A guard agrees to make a series of bets with him. If Smith bets A dollars, he wins A dollars with probability .4 and loses A dollars with probability .6.
To solve this problem we need to understand the probability of getting to state 8 (winning enough games to have $8) without reaching state 0 (losing all of our money). There is a useful function that can give us the solution called “Gambler’s ruin probabilities”: \[ x_n = \frac{1-(\frac{q}{p})^n}{1-(\frac{q}{p})^N} \] Where n is our starting point, $1, and N is where we want to be, $8.
p <- 0.4
q <- 1-p
n <- 1
N <- 8
x <- (1 - (q/p)^n) / (1 - (q/p)^N)
x
## [1] 0.02030135
The result means it’s around a 2% chance of becoming free with this betting strategy.
Since we are trying to reach $8 smith would need to bet his full balance in each game:
Win 1: $2 Win 2: $4 Win 3: $8
So we need to calculate the probability of winning 3 games in a row at a 40% chance.
p^3
## [1] 0.064
This gives us a 6.4% chance of winning our freedom.
Betting large sums gives the highest chance of freedom