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

a.he bets 1 dollar each time (timid strategy).

p <- .4
l <- .6
r <- l/p
s <- 1
m <- 8

ans<- (r^1 - 1)/(r^8 - 1)
print(ans)
## [1] 0.02030135
  1. he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

.4 probability he will win, .6 probability that he will lose.

mmat <- matrix(c(1,0,0,0,0,0.6,0,0.4,0,0,0.6,0,0,0.4,0,0.6,0,0,0,0.4,0,0,0,0,1), ncol=5,nrow=5, byrow = TRUE)
mmat
##      [,1] [,2] [,3] [,4] [,5]
## [1,]  1.0    0  0.0  0.0  0.0
## [2,]  0.6    0  0.4  0.0  0.0
## [3,]  0.6    0  0.0  0.4  0.0
## [4,]  0.6    0  0.0  0.0  0.4
## [5,]  0.0    0  0.0  0.0  1.0
b1 <- matrix(c(0,1,0,0,0), ncol=5,nrow = 1,byrow = TRUE)
b1
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    0    1    0    0    0
b2 <- b1 %*% mmat
b2
##      [,1] [,2] [,3] [,4] [,5]
## [1,]  0.6    0  0.4    0    0
b3 <- b2 %*% mmat
b3
##      [,1] [,2] [,3] [,4] [,5]
## [1,] 0.84    0    0 0.16    0
b4 <- b3 %*% mmat
b4
##       [,1] [,2] [,3] [,4]  [,5]
## [1,] 0.936    0    0    0 0.064

The probability that he will be successful in winning the bets is .064

  1. Which strategy gives Smith the better chance of getting out of jail? The bold strategy gives Smith the better chance of getting out of jail.