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 \(0.4\) and loses A dollars with probability \(0.6\). Find the probability that he wins 8 dollars before losing all of his money if

Smith wins with probability \(p\), and loses with probability \(q\). The probability he wins \(N\) dollars if he starts with \(i\) dollars is

\[ P_i = \frac {1 - (\frac{q}{p})^i}{1-(\frac{q}{p})^n} \] We know that \(P_i = 0\) when \(i=0\) (no money left) and \(P_i = 1\) when \(i=N\) (he won).

i <- 1 #Starting money
p = 0.4 #P win
q = 1-p #P lose
n = 8 #final amount needed to win

P_timid <- (1-(q/p)^i)/(1-(q/p)^n)
cat("The chance of winning with the timid approach is: ", P_timid*100, "%.")
## The chance of winning with the timid approach is:  2.030135 %.

If he’s betting the maximum each time, he’s going to bet 1$, then 2$, 4$. If he wins, he’ll have 8$. If he loses even a single bet, he loses all his monday, therefore he has to win 3 bets in a row, each being independent and having \(P(win) = 0.4\)

P_bold = p^3
cat("The chance of winning with the bold approach is: ", P_bold*100, "%.")
## The chance of winning with the bold approach is:  6.4 %.

While both strategies seem awful, he seems to have better chances with the bold approach.