5 ms·
The number of dollars you win out of N flips is 2W - N, where W ~ B(N,0.51). So, your question is: What is the minimum value of N such that P(2W - N >= 10) >=
by tome 17y ago
The number of dollars you win out of N flips is 2W - N, where W ~ B(N,0.51). So, your question is:
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)]
- zackattack 17y agoWhat is W?
- tome 17y agoW ~ B(N, p) means W is a binomial random variable: the number of heads you get from N independent coin flips each with probability p of coming up heads.
- zackattack 17y agoThere's got to be a better way to express summations and combinations on the internet. Did you see that link posted earlier?
- tome 17y agoNo I didn't. Could you please repost? I'd be interested.
- zackattack 17y agohttp://detexify.kirelabs.org/classify.html http://detexify.kirelabs.org/classify.html
- madcaptenor 17y agoYeah, but that just tells you how to write the symbol in LaTeX. HN doesn't support LaTeX so that's no good. What tome wrote is basically LaTeX stripped of some of the syntax that makes it unambiguous for computers but hard to read for humans. This is basically the standard way of writing mathematics in a plain-text setting.
- zackattack 17y agoYou missed my intention. My point is that there's got to be a better way. That link shows important progress towards the next step: expressing equations, translating them into LaTeX, and then rendering them into image (e.g. png) form.
- rarestblog 17y agoI think he was asking for a numeric answer.
- tome 17y agoIf he wants one he can calculate it using the formula I've provided. A normal approximation to the binomial distribution might help too.
- deleted 17y ago[deleted]
- madcaptenor 17y agoThe amount you win on a single flip has mean 0.02 and variance 0.9996. So the amount won after n flips, for large n, is approximately normally distributed with mean 0.02n and 0.9996n. (This uses the Central Limit theorem.) The question, then, is to find n large enough that this has probability 0.99 of being at least 10. A normally distributed random variable has probability 0.99 of being at least 2.33 standard deviations below its mean, so we want to find n such that 0.02n - 2.33*sqrt(0.9996n) = 10 and solving for n (this is a quadratic equation in sqrt(n)) gives 14507. (Your 10576 is what I get from my method if I look for 97.5% certainty.)
- tome 17y agoYes, we used the wrong CDF. 14507 is what we get as well with the correct one.
- splat 17y agoSolving this numerically, I get 14414. 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....)
- madcaptenor 17y agoI'm glad to see an answer from this approach. (Maple wasn't cooperating for me.) And notice that it compares well with the 14507 from the normal approximation to the binomial.
- tspiteri 17y agoI did it in C, my code was a bit longer. (And it has the advantage that you do not need an initial estimate for the problem to be solved in a very short time.) #include <math.h> #include <stdio.h> double p(int throws, double pwin, int req_wins) { int win, i; double log_dp = log(pwin) * throws; double log_loss_win = log((1 - pwin) / pwin); double ret = 0; for (win = throws, i = 0; win >= req_wins; win -= 2, ++i) { ret += exp(log_dp); log_dp += log_loss_win + log((throws - i) / (i + 1.0)); } return ret; } int main() { double pwin = 0.51; int req_wins = 10; double conf = 0.99; int min, max = 1; while (p(max, pwin, req_wins) < conf) max *= 2; min = max / 2; while (min < max) { int mid = (min + max) / 2; if (p(mid, pwin, req_wins) < conf) min = mid + 1; else max = mid; } printf("For %d throws, P(win $10 or more) = %f\n" "For %d throws, P(win $10 or more) = %f\n", min - 1, p(min - 1, pwin, req_wins), min, p(min, pwin, req_wins)); } The output from this program: For 14413 throws, P(win $10 or more) = 0.989777 For 14414 throws, P(win $10 or more) = 0.990004