Smith is in jail and has 1 dollar; he can get out on bail if he has $8. 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. . .

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

Answer: 0.02

library(matlib)
## Warning: package 'matlib' was built under R version 4.3.3
Q <- matrix(c(0, 0.4, 0, 0, 0, 0, 0,
              0.6, 0, 0.4, 0, 0, 0, 0,
              0, 0.6, 0, 0.4, 0, 0, 0,
              0, 0, 0.6, 0, 0.4, 0, 0,
              0, 0, 0, 0.6, 0, 0.4, 0,
              0, 0, 0, 0, 0.6, 0, 0.4,
              0, 0, 0, 0, 0, 0.6, 0), nrow = 7, byrow = TRUE)
R <- matrix(c(0.6, 0,
              0, 0,
              0, 0,
              0, 0,
              0, 0,
              0, 0,
              0, 0.4), nrow = 7, byrow = TRUE)
I <- diag(7)
new1 <- I - Q
N <- inv(new1)
B <- N %*% R
rownames(B) <- c("1", "2", "3", "4", "5", "6", "7")
colnames(B) <- c("0", "8")

B
##           0          8
## 1 0.9796987 0.02030135
## 2 0.9492466 0.05075337
## 3 0.9035686 0.09643140
## 4 0.8350515 0.16494845
## 5 0.7322760 0.26772403
## 6 0.5781126 0.42188739
## 7 0.3468676 0.65313244
B["1", "8"]
## [1] 0.02030135

(b) he bets, each time, as much as possible but not more than necessary to

bring his fortune up to 8 dollars (bold strategy).

Answer: 0.064

Q <- matrix(c(0, 0.4, 0,
              0, 0, 0.4,
              0, 0, 0), nrow = 3, byrow = TRUE)
R <- matrix(c(0.6, 0,
              0.6, 0,
              0.6, 0.4), nrow = 3, byrow = TRUE)
I <- diag(3)
new1 <- I - Q
N <- inv(new1)
B <- N %*% R
rownames(B) <- c("1", "2", "4")
colnames(B) <- c("0", "8")

B
##       0     8
## 1 0.936 0.064
## 2 0.840 0.160
## 4 0.600 0.400
B["1", "8"]
## [1] 0.064

(c) Which strategy gives Smith the better chance of getting out of jail?

The second strategy gives him a better chance of getting out of jail. His probability is 0.064 when acting bold, where his probability is 0.02 when acting timid. Since 0.064 is larger than 0.02, it is a better probability.