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. Find the probability that he wins 8 dollars before losing all of his money if:
*The Gambler’s Ruin Problem: \[ \begin{aligned} &P_{i}=\frac{1-\left(\frac{q}{p}\right)^{t}}{1-\left(\frac{q}{p}\right)^{N}}, \text { if } p \neq q \\ &P_{i}=\frac{i}{N}, \text { if } p=q=0.5 \end{aligned} \]
he bets 1 dollar each time (timid strategy).
p <- 0.4
q <- 1-p
i <- 1
N <- 8
round(((1-(q/p)**i))/(1-(q/p)**N),5)## [1] 0.0203
he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).
Assuming he wins each bet he will get: 1, 2 (1st win), 4 (2nd win), 8 (3rd win)
p**3## [1] 0.064