Coin Flip Brain Teaser
I have a coin with a 51% probability of landing on heads, and 49% probability of landing on tails. I call heads 100% of the time. My opponent calls tails 100% of the time. If the coin lands on heads, I get $1, and my opponent loses $1. If the coin lands on tails, my opponent gets $1, and I lose $1.
How many coin flips do I need to do in order to earn $10 with a 99% certainty?
[+] [-] tome|16 years ago|reply
What is the minimum value of N such that P(2W - N >= 10) >= 0.99, i.e. P(W >= 5 + N/2) >= 0.99.
So calculate Sum from {n = 5 + N/2} to {n = N} of P(W = n) for some different values of N, and see what you get!
[P(W = n) = (N choose n) 0.51^n 0.49^(N-n)]
[+] [-] splat|16 years ago|reply
I used the following line of Mathematica code:
For[n=14400, Sum[PDF[BinomialDistribution[n,.51],k],{k,n/2+5,n}] < .99, n++, Null]; Print[n]
(I played around with it a little to guess the initial value of 14400, just so it wouldn't take forever to run....)
[+] [-] rarestblog|16 years ago|reply
[+] [-] zackattack|16 years ago|reply
[+] [-] zackattack|16 years ago|reply
[+] [-] madcaptenor|16 years ago|reply
[+] [-] dadkins|16 years ago|reply
[+] [-] jongraehl|16 years ago|reply
[+] [-] bcater|16 years ago|reply
As a first guess, let's agree that in expectation you earn $0.51 each time you flip the coin, so it should take you about 20 tries to reach $10. Let's do something better, though.
EDIT: The previous paragraph is totally wrong. Thanks, tome :)
Let's build a confidence interval with alpha = 0.01 so that (1 - alpha) = 0.99. First, we'll need some trials. For that, I wrote a program that flipped a weighted coin and played the game until it reached $10 using the rules that you described. I recorded the number of coin flips required in each of 15 trials:
298, 84, 268, 2712, 110, 66, 42, 128, 84, 48, 280, 80, 64, 42, 234
We'll need the sample mean, X_bar = 302.
Now, we'll compute the Z-score so that we can build an interval in which the true mean (mu) lies with 99% probability:
P(-z <= Z <= z) = 0.99
We know that Z = (302 - mu) / (sigma / sqrt(n)), where sigma (the standard deviation) = 650 and sqrt(n) = 4. I'm rounding. Therefore, Z = (302 - mu) / 168.
Now, let's look at the cumulative distribution function Phi(z) and note that if Phi(z) = 1 - (alpha / 2) = 0.995, then Phi(z) ~= 0.997, the approximate cutoff for the 3rd standard deviation. Thus, z ~= 3.
Thus, we have that P(-3 <= (X_bar - mu) / (sigma / sqrt(n)) <= 3) = 0.99, so P(X_bar - 504 <= mu <= X_bar + 504) = 0.99. Therefore, I am 99% confident that the true mean, mu, lies on [X_bar - 504, X_bar + 504] = [302 - 504, 302 + 504].
That's a really wide range, and seemingly completely unhelpful for the purposes of betting. More sample trials would teach us more and lead us to a smaller interval since we expect that within some large number of trials we will converge on mu.
[+] [-] madcaptenor|16 years ago|reply
I wrote a program and did ten thousand trials; the 100th largest hitting time was 5578, which is my estimate of the 99th percentile of the distribution, and thus the answer to the version of the original problem where we don't have to fix the number of coin flips ahead of time.
The median hitting time from my simulation is 152; the mean, 506, the standard deviation, 1155. Yes, the standard deviation is larger than the mean! The distribution has a very long right tail.
I'm fairly confident (in an informal sense) that the median of the true distribution is somewhere near 152, but I'm not confident about the mean or standard deviation. A lot of distributions in problems like this have tails which decay only like power laws, which makes estimating the mean and standard deviation from a sample very difficult. (I'm not saying that the distribution is a power law, though; it's hard to identify those just by looking at the data.)
[+] [-] tome|16 years ago|reply
[+] [-] bcater|16 years ago|reply
[+] [-] aidenn0|16 years ago|reply
[+] [-] dadkins|16 years ago|reply
In other words, we want to find n such that
Pr[X < n/2 + 5] < .01
If we express that in terms of the mean, we can apply a Chernoff bound:
Pr[X <= E[X] - a] <= Exp[-2a^2/n], for 0 < a < E[X]
If E[x] = pn, then a = pn - (n/2 + 5), which for p = 0.51 is a = .01n - 5.
So, solving Exp[-2a^2/n] = .01 (with help from Wolfram alpha) gives a quadratic equation with two solutions:
n = 348.257 and n = 651.743
The first is too small, a would be negative (n needs to be at least 500). The second is good enough.
652 does the trick.
[+] [-] madcaptenor|16 years ago|reply
But I get, as solutions for exp(-2(.01n-5)^2 / n) = .01, n = 10.4 and n = 24015.
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] czar235|16 years ago|reply
sum_{i=0}^k [(10+k) choose (10+i)] (.51)^(10+i) >= .99
find the minimum value of k that satisfies the inequality.
[+] [-] asorbus|16 years ago|reply
[+] [-] uptown|16 years ago|reply
[+] [-] aidenn0|16 years ago|reply
[+] [-] joecool|16 years ago|reply
[+] [-] joecool|16 years ago|reply
[+] [-] zackattack|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] tome|16 years ago|reply
[+] [-] noodle|16 years ago|reply
[+] [-] Jopius|16 years ago|reply
exp: after 7 flips 99% probability of earning $1 (1-(0,49^7))
times 10
[+] [-] unknown|16 years ago|reply
[deleted]