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). Answer:
# for the 1st condition
prob_win <- 0.4
prob_lose <- 0.6
result <- prob_lose/prob_win
for (i in 0:8){
prob_win <- (1-result^i)/(1-result^8)
print(prob_win)
}
## [1] 0
## [1] 0.02030135
## [1] 0.05075337
## [1] 0.0964314
## [1] 0.1649485
## [1] 0.267724
## [1] 0.4218874
## [1] 0.6531324
## [1] 1
Here, for the 1st condition the probability is 0.02030135
Answer:
# for the 2nd condition, he uses the bold strategy
# probability of winning = 1 - probability of broke/
bold_strategy <- 1 - ((1.5- (1.5^3)) / (1- (1.5^3)))
bold_strategy
## [1] 0.2105263
Here, for the 2nd condition the probability is 0.2105263