PDA

View Full Version : Simple coinflipping problem.

Mr_J
04-20-2005, 12:48 AM
Say I decide to enter a coinflipping contest. We both start with \$15. Say we are forced to wager \$1 on every coinflip. I'm using a rigged coin, so I will win 55% of these coinflips on average. We flip coins until one of us loses the \$15. How often will I take his money (do the math in the post)???

How much does my winrate change if we were forced to wager just 50 cents?

mannika
04-20-2005, 01:25 AM
I ran a simulation and came up with answers of:
Win all his money 94.67% of the time (st.dev of 0.225%) with \$1 wagers.
Win all his money 99.77% of the time (st.dev of 0.048%) with \$0.50 wagers.

(Sorry, I don't know how to do the math, and therefore cannot help you out with that part)

//procrastinating studying for derivative securities final

Mr_J
04-20-2005, 02:02 AM
"Win all his money 94.67% of the time"

19 in 20? Wow. Thanks for the reply. Anyone want to calculate what 52.5% would give?

Also, what is the average game length (in terms of coinflips) for the \$1 game and the 50 cent game?

DrPublo
04-20-2005, 02:21 AM
Two related pages:

Gambler's Ruin (http://mathworld.wolfram.com/GamblersRuin.html)

and

Coin Tossing (http://mathworld.wolfram.com/CoinTossing.html)

The explicit math for your simulation isn't that tough either but I don't have time to do it right now.

The Doc

mannika
04-20-2005, 02:44 AM
[ QUOTE ]
"Win all his money 94.67% of the time"

19 in 20? Wow. Thanks for the reply. Anyone want to calculate what 52.5% would give?
Also, what is the average game length (in terms of coinflips) for the \$1 game and the 50 cent game?

[/ QUOTE ]

55% Game
\$1 - You will win ~95.39% of the time (st.dev of 0.21%), with the average game lasting ~136.05 trials (st.dev of 0.99)
\$0.50 - You will win ~99.74% of the time (st.dev of 0.05%), with the average game lasting ~293.88 trials (st.dev of 1.63)

52.5% Game
\$1 - You will win ~81.73% of the time (st.dev of 0.39%), with the average game lasting ~188.54 trials (st.dev of 1.50)
\$0.50 - You will win ~95.01% of the time (st.dev of 0.22%), with the average game lasting ~540.22 trials (st.dev of 3.87)

Stats Disclaimer:
Also, keep in mind that the standard deviations I am writing are the standard deviations of the real average around the sample average (the quoted averages are only sample averages based on a simulation). Therefore, for the 52.5%, \$0.50 example, there is not a 3.87 standard deviation for each trial, but rather the probability that the REAL mean is going to be within 3.87 of the sample mean listed is approx 67%.

BruceZ
04-20-2005, 03:12 AM
[ QUOTE ]
Say I decide to enter a coinflipping contest. We both start with \$15. Say we are forced to wager \$1 on every coinflip. I'm using a rigged coin, so I will win 55% of these coinflips on average. We flip coins until one of us loses the \$15. How often will I take his money (do the math in the post)???

[/ QUOTE ]

1 - [(45/55)^15 - (45/55)^30] / [1 - (45/55)^30]

= 95.3%.

[ QUOTE ]
How much does my winrate change if we were forced to wager just 50 cents?

[/ QUOTE ]

99.76%.

Derivation:

Let p = the probability that we win a coin flip, and q = the probability that we lose a coin flip. We can write the following difference equation for the risk of ruin as a function of our bankroll B:

ror(B) = p*ror(B+1) + q*ror(B-1)

This says that to lose a bankroll of size B, we can start by winning the first flip with probability p, making our bankroll B+1, and then sometime thereafter lose that bankroll with probability ror(B+1); or we can lose the first flip with probability q, making our bankroll B-1, and thereafter lose that bankroll with probability ror(B-1). It can be seen that this difference equation has two particular solutions:

ror(B) = 1, and ror(B) = (q/p)^B.

This means that a general solution will be of the form:

ror(B) = c1 + c2*(q/p)^B

where c1 and c2 are constants.

We now impose the two boundary conditions:

ror(0) = 1, and ror(T) = 0.

Where T is total money on the table, or the sum of our bankroll and our opponent's bankroll. This reflects the obvious facts that when our bankroll is 0, our risk of being ruined is 1, and when our bankroll is T, we have all of our opponent's money, at which point the game ends, so our risk of ruin is 0. We can now write 2 equations for the unknowns c1 and c2:

ror(0) = c1 + c2 = 1
ror(T) = c1 + c2*(q/p)^T = 0

Solving for c1 and c2 gives:

c1 = (q/p)^T / [ (q/p)^T - 1]

c2 = 1 / [ 1 - (q/p)^T ]

We now have our risk of ruin formula:

ror(B) = [ (q/p)^B - (q/p)^T ] / [ 1 - (q/p)^T ]

This is the classical risk of ruin formula for playing with a bankroll B against an opponent with a finite bankroll (T - B). This risk of ruin is the probability of losing a bankroll of size B before we can win all of our opponent's money. 1 - ror(B) is the probability that we bust our opponent before he can bust us.

BruceZ
04-20-2005, 03:31 AM
[ QUOTE ]
"Win all his money 94.67% of the time"

19 in 20? Wow. Thanks for the reply. Anyone want to calculate what 52.5% would give?

[/ QUOTE ]

81.8% for \$1 bets, and 95.3% for \$0.50 bets, using the same formula as in my above post.

[ QUOTE ]
Also, what is the average game length (in terms of coinflips) for the \$1 game and the 50 cent game?

[/ QUOTE ]

Here's the formula. I'll let you plug in the numbers for all the cases.

D(B) = B/(q-p) - [T/(q - p)]*[1 - (q/p)^B]/[1 - (q/p)^T]

Where D(B) is the expected duration for a bankroll B
p = probability of winning a flip
q = probability of losing a flip
B is bankroll in bets (15 for \$1 game, and 30 for \$0.50 game)
T = your bankroll + opponent's bankroll = 2*B

This is derived similarly to the way the formula for the risk of ruin was derived in my above post, except now we solve this difference equation.

D(B) = p*D(B+1) + q*D(B-1) + 1

with the boundary conditions:

D(0) = 0, and D(T) = 0.

gaming_mouse
04-20-2005, 03:48 AM
Bruce,

Nice post. It really is amazing how such a small advantage per flip gives you such a large advantage in the overall game with only 15 bets.

BruceZ
04-20-2005, 03:56 AM
[ QUOTE ]
Bruce,

Nice post. It really is amazing how such a small advantage per flip gives you such a large advantage in the overall game with only 15 bets.

[/ QUOTE ]

Thanks. That's because your risk of ruin decreases exponentially with bankroll. When you double your bankroll, you must then lose your original bankroll twice to go broke, and so the risk of ruin is squared.

gaming_mouse
04-20-2005, 03:58 AM
[ QUOTE ]
[ QUOTE ]
Bruce,

Nice post. It really is amazing how such a small advantage per flip gives you such a large advantage in the overall game with only 15 bets.

[/ QUOTE ]

Thanks. That's because your risk of ruin decreases exponentially with bankroll. When you double your bankroll, you must then lose your original bankroll twice to go broke, and so the risk of ruin is squared.

[/ QUOTE ]

Ah. Makes perfect sense.

BruceZ
04-20-2005, 04:16 AM
I went ahead and ran those average durations.

55% game

\$1 bets:
win 95.3%
Average duration = 135.9 flips

\$0.50 bets
win 99.76%
Average duration = 298.5 flips

52.5% game

\$1 bets
win 81.8%
Average duration = 190.7 flips

\$0.50 bets
win 95.3%
Average duration = 543.2 flips

jason_t
04-20-2005, 04:24 AM
Wow. This is really really beautiful. Thank you for taking the time to write this.

BruceZ
04-20-2005, 04:47 AM
[ QUOTE ]

ror(0) = c1 + c2 = 1
ror(T) = c1 + (q/p)^T = 0

[/ QUOTE ]

This should be:

ror(0) = c1 + c2 = 1
c1 + c2*(q/p)^T = 0

Mr_J
04-20-2005, 05:03 AM
"It really is amazing how such a small advantage per flip gives you such a large advantage in the overall game with only 15 bets."

Sure is (this was what I was thinking, but I'm surprised at how great the effect is). Thanks for the replies &amp; formulae guys.