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
p <- 0.4
q <- 0.6
r <- q/p
for (i in 0:8){
P <- round((1-r^i)/(1-r^8),4)
print (P)
}
## [1] 0
## [1] 0.0203
## [1] 0.0508
## [1] 0.0964
## [1] 0.1649
## [1] 0.2677
## [1] 0.4219
## [1] 0.6531
## [1] 1
bring his fortune up to 8 dollars (bold strategy).
b <- matrix(c(1,0.6,0.6,0.6,0,0,0,0,0,0,0,0.4,0,0,0,0,0,0.4,0,0,0,0,0,0.4,1),nrow = 5, byrow=FALSE)
b
## [,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),nrow=1)
b1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0 1 0 0 0
b2 <- b1 %*% b
b2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0.6 0 0.4 0 0
b3 <- b2 %*% b
b4 <- b3 %*% b
b4
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0.936 0 0 0 0.064
The probability is 0.064
The probability of bold strategy is better than timid strategy to get out of jail.