Problem Statement

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 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:

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

  2. he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

  3. Which strategy gives Smith the better chance of getting out of jail?

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 0.4 and loses \(A\) dollars with probability 0.6. We aim to find the probability that he wins 8 dollars before losing all of his money.

We define the state of Smith’s fortune as a Markov chain, where each state represents the amount of money Smith has. The transition probabilities are defined as follows:

The transition probabilities are \(0.4\) for winning and \(0.6\) for losing. We will calculate the probabilities of reaching $8 starting with $1 using a matrix approach to solve the corresponding system of linear equations.

Now, we’ll perform the calculations using R:

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

In the timid strategy, Smith bets 1 dollar each time. We model this process as a Markov chain with states representing Smith’s current amount of money, from $0 to $8. State $0 is when he has lost everything, and state $8 is when he can pay bail to get out of jail.

# Load the necessary library
library(Matrix)

# Probability of winning
p_win <- 0.4

# Probability of losing
p_lose <- 0.6

# Number of states excluding 0 dollars and 8 dollars
n_states <- 7

# Initialize matrix A
A <- diag(1, n_states, n_states)

# Adjust probabilities for non-boundary states
for (i in 2:(n_states - 1)) {
  A[i, i] <- 1
  A[i, i - 1] <- -p_lose
  A[i, i + 1] <- -p_win
}

# Boundary conditions for the first and last state
A[1, 1] <- 1
A[1, 2] <- -p_win
A[n_states, n_states] <- 1
A[n_states, n_states - 1] <- -p_lose

# Boundary vector b with the condition at the first state
b <- rep(0, n_states)
b[1] <- p_win

# Solve the system of equations
probabilities <- solve(A, b)

# Output the probability of reaching $8 starting with $1
probabilities[1]
## [1] 0.6531324

(b) Smith bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

For the bold strategy, we consider a more complex approach where Smith bets the maximum amount that would not exceed 8 dollars. The bold strategy is an all-or-nothing approach. In the context of Smith’s scenario, it entails betting the entire current amount of money he has or enough to reach the $8 goal, whichever is less. The objective of this strategy is to reach the target amount as quickly as possible, taking on the highest risk possible with each bet.

# Simulation of the bold strategy

set.seed(123)  # Setting a seed for reproducibility

simulate_bold_strategy <- function() {
  wealth = 1  # Starting with $1
  goal = 8  # Target is $8
  while (wealth > 0 && wealth < goal) {
    bet = min(wealth, goal - wealth)  # Bet the lesser of current wealth or the amount to reach $8
    if (runif(1) < 0.4) {
      wealth = wealth + bet  # Wins the bet
    } else {
      wealth = wealth - bet  # Loses the bet
    }
  }
  return(wealth == goal)  # Returns TRUE if reached $8, FALSE otherwise
}

# Running the simulation 10000 times
results = replicate(10000, simulate_bold_strategy())

# Calculating the probability of reaching $8 before running out of money
prob_bold = mean(results)

prob_bold
## [1] 0.0613

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

Through this analysis, we determine which betting strategy offers Smith the highest probability of winning 8 dollars before losing all of his money and potentially securing his release from jail.

prob_timid <- probabilities[1] # From timid strategy calculation
prob_bold # From bold strategy calculation
## [1] 0.0613
# Which strategy is better?
better_strategy <- ifelse(prob_timid > prob_bold, "Timid", "Bold")
better_strategy
## [1] "Timid"