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

  1. he bets 1 dollar each time (timid strategy).
p <- 0.4
q <- 0.6
i <- 1
n <- 8

#round(((1-(q/p)^i))/(1-(q/p)^n),5)
answer <- ((q/p)^i - 1) / ((q/p)^n - 1)
print(paste("The probability that he wins 8 dollars before losing all of his money if he bets 1 dollar each time is", round(answer,4)))
## [1] "The probability that he wins 8 dollars before losing all of his money if he bets 1 dollar each time is 0.0203"
  1. he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

In order to win 8 dollars, he needs to win all 3 bets. with 1 dollar bet, if he wins, he will have 2 dollar. with 2 dollar bet, if he wins again, he will have 4 dollar. with 4 dollar bet, if he wins again, he will have 8 dollar at the end.

answer<- p^3

print(paste("The probability if he bets, each time, as much as possible but not more than necessary to
bring his fortune up to 8 dollars is",answer))
## [1] "The probability if he bets, each time, as much as possible but not more than necessary to\nbring his fortune up to 8 dollars is 0.064"
  1. Which strategy gives Smith the better chance of getting out of jail?

Comparing the probability of timid strategy(0.0203) and bold strategy(0.064), the bold strategy have higher chance for Smith to get out of jail.