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
Ans.
transitionMatrix = rbind(# $1 $2 $3 $4 $5 $6 $7 $0 $8
c(0 ,.4,0 ,0 ,0 ,0 ,0 ,.6,0 ), # $1
c(.6,0,.4 ,0 ,0 ,0 ,0 ,0 ,0 ), # $2
c(0 ,.6,0 ,.4,0 ,0 ,0 ,0 ,0 ), # $3
c(0 ,0 ,.6,0 ,.4,0 ,0 ,0 ,0 ), # $4
c(0 ,0 ,0 ,.6,0 ,.4,0 ,0 ,0 ), # $5
c(0 ,0 ,0 ,0 ,.6,0 ,.4,0 ,0 ), # $6
c(0 ,0 ,0 ,0 ,0 ,.6,0 ,0 ,.4), # $7
c(0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ), # $0
c(0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) # $8
)
Q = transitionMatrix[1:7, 1:7]
I = diag(7)
N = inv(I-Q) # Analogous to geometric series N = sum( Q^n ) = 1/( 1-q)
R = transitionMatrix[1:7, 8:9]
B = N %*% R #Absorption Probability Matrix
timiProb = B[1,2]
timiProb
## [1] 0.02030135
The probability that he wins 8 dollars before losing all of his money if he bets 1 dollar each time is 0.0203013.
transitionMatrix = rbind(# $1 $2 $3 $4 $5 $6 $7 $0 $8
c(0 ,.4,0 ,0 ,0 ,0 ,0 ,.6,0 ), # $1
c(0 ,0 ,0 ,.4,0 ,0 ,0 ,.6,0 ), # $2
c(0 ,0 ,0 ,0 ,0 ,.4,0 ,.6,0 ), # $3
c(0 ,0 ,0 ,0 ,0 ,0 ,0 ,.6,.4), # $4
c(0 ,.6,0 ,0 ,0 ,0 ,0 ,0 ,.4), # $5
c(0 ,0 ,0 ,.6,0 ,0 ,0 ,0 ,.4), # $6
c(0 ,0 ,0 ,0 ,0 ,.6,0 ,0 ,.4), # $7
c(0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ), # $0
c(0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ) # $8
)
Q = transitionMatrix[1:7,1:7]
I = diag(7)
N = inv(I-Q)
R = transitionMatrix[1:7,8:9]
B = N %*% R
boldProb = B[1,2]
boldProb
## [1] 0.064
The probability that he wins 8 dollars before losing all of his money if he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars is 0.064.
Ans. The bold strategy has the higher probability of absorption in state which gives Smith the bettter chance of getting out of jail.