We're tackling the problem proposed by Elwyn Berlekamp (i think?)
You are a broker; your job is to accommodate your client’s wishes without placing any of your personal capital at risk. Your client wishes to place an even $1,000 bet on the outcome of the World Series, which is a baseball contest decided in favor of whichever of two teams first wins 4 games. That is, the client deposits his $1,000 with you in advance of the series. At the end of the series, he must receive from you either $2,000 if his team wins, or nothing if his team loses.
No market exists for bets on the entire World Series. However, you can place even bets, in any amount, on each game individually. What is your strategy for placing bets on the individual games in order to achieve the cumulative result demanded by your client?
Foundation
For the sake of this problem, we can assume every game will be equal in probability, 50% chance that the desired team wins and 50% the other team wins.
Reading the problem, we can lay some foundation. First, we can use some state system (which will be useful later) to denote what stage the series is in. In this case, can represent the wins until the client's team wins the series and wins until the opposing team wins. Default starting state is .
Example: means the client's team has won 1 game, and the opposing team has yet to win a game.
We want to come up with some that will be the probability of the client's team winning starting from the state .
Since this is a recursive formula, if we plug any into the formula, such that and , it will create "subproblems" that will eventually be broken down to the base cases and .
How did we derive this formula? Well, here we used something called the Law of Total Probability to derive it. The first term is in the case that the client's team wins (one less win necessary for winning the series), and the second term is in the case that the opposing team wins (one less win necessary for winning the series).
We will also say that is the expected payout for the state . If it helps, imagine most sportbooks will allow you to cash your play during the series, so you can bet on the outcome of the series, and you want to have the appropriate payout on hand at any point.
Setting up the equations
We know that when the client team wins a game, then the on-hand capital, , will be
and when the opposing team wins a game, then the on-hand capital, , will be
where is the amount of bet on each game.
To find a equation that satisfies the above equations, we can use the following equations:
Subtract the second equation from the first equation to get
Simplify a bit to get
Now, we can plug this into the first equation to get
These two functions will give us the on-hand capital we should have and the bet we should place at any given .
Trying the solution
Quickly progammed a python script to test the solution.
import random
def p(i,j):
if i == 0:
return 1
elif j == 0:
return 0
else:
return 0.5*p(i,j-1) + 0.5*p(i-1,j)
def s(i,j):
return 2000 * p(i,j)
def b(i,j):
return (s(i-1,j) - s(i,j-1))/2
def simulate():
capital = 1000
i,j = 4, 4
game_number = 1
while i > 0 and j > 0:
current_bet = b(i,j)
if current_bet > capital:
current_bet = capital
outcome = random.choice(['win','lose'])
if outcome == 'win':
capital += current_bet
i -= 1
outcome_str = "Win"
else:
capital -= current_bet
j -= 1
outcome_str = "Loss"
print(f"Game {game_number}: State ({i + (1 if outcome == 'W' else 0)}, {j + (1 if outcome == 'L' else 0)}), "
f"Bet: ${current_bet:.2f}, Outcome: {outcome_str}, New Capital: ${capital:.2f}")
game_number += 1
if i == 0:
print("Client's team has won the series.")
print(f"Final Capital: ${capital:.2f}")
else:
print("Client's team has lost the series.")
print(f"Final Capital: ${capital:.2f}")
simulate()
And it works! Run it as much as you want, you'll see no matter how the series ends, the capital will always be $0 or $2000 by the end of the simulation.