Created
January 16, 2009 23:10
-
-
Save sudish/48199 to your computer and use it in GitHub Desktop.
If 60% chance of picking winner of a game, and 32 games played, what are odds of picking 12 of 16 correctly?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Update: All of this turns out to be nothing more than a classic | |
| Binomial Distribution: http://en.wikipedia.org/wiki/Binomial_distribution | |
| Jim asked: "If 60% chance of picking winner of a game, and 32 games | |
| played, what are odds of picking 12 of 16 correctly?" (I'm going to | |
| ignore the "32 games played" and assume you meant 16 played, since I | |
| don't understand the 12 of 16 of 32 statement as it stands. I.e., how | |
| do you pick the 16 out of the 32?) | |
| Assumption: every game is independent of the other and the only | |
| possible outcomes are losses and wins (no ties!). I.e., the results | |
| of any game cannot influence the results of any of the other games. | |
| I'm pretty much going to use the binomial theorem here, so quick | |
| refresher at http://en.wikipedia.org/wiki/Binomial_theorem | |
| Let's simplify to 3 independent games, where you have a fixed | |
| probability 'x' of winning each one. For the sake of convenience, let | |
| 'y' denote the probability of losing a given game. So, y = 1 - x, | |
| since there are only two possible outcomes here (no ties!) and the | |
| probabilities must add up to 1 for the two outcomes. | |
| Let's also use the notation P(W, L, W) to indicate the probability of | |
| winning the 1st, losing the 2nd, and winning the 3rd. | |
| Q: So, what's P(W, L, W), assuming x = 0.6? | |
| A: Given that these are independent games, the probability is | |
| x * y * x = x^2 * y, where y = 1-x = 0.4. | |
| Q: How many ways can we win 2 and only 2 games? | |
| A: Counting them off there's 3 of them: (W, W, L), (W, L, W), (L, W, W). | |
| Q: What's the probability that we win exactly two games out of three? | |
| A: That's the sum of the probabilities of each of the independent | |
| outcomes above: | |
| P(W, W, L) + P(W, L, W) + P(L, W, W) | |
| = x * x * y + x * y * x + y * x * x | |
| = 3 * x^2 * y | |
| Let's denote the above quantity, the probability that you win exactly | |
| 'k' of 'n' games, by Q(n, k). | |
| So, we just computed Q(3, 2) = 3 * x^2 * y. | |
| Q: What's the probability that we win *at least* 2 games of 3? | |
| A: That's the probability that we win exactly 2 games + the | |
| probability that we win all 3 games (x * x * x). Using our Q | |
| notation, this is Q(3, 2) + Q(3, 3). | |
| I.e., x^3 + 3 * x^2 * y. | |
| If you look at the Binomial Theorem page linked above, you'll notice | |
| this is the sum of the first two terms in the expansion for (x + y)^3. | |
| This isn't surprising, since another way of looking at the coefficient | |
| of x^k * y^(n-k) in the expansion of (x + y)^n is that it is the | |
| number of ways of picking 'k' x'es and (n-k) y's when you multiply it | |
| all out. | |
| This binomial coefficient for x^k * y^(n-k) is | |
| C(n,k) = n!/(k! * (n-k)!). | |
| Going back to the original problem and plugging things in, the number | |
| of ways of winning *exactly* 12 games of 16 is | |
| C(16, 12) | |
| = 16*15*14*13/1*2*3*4 | |
| = 1820. | |
| Our x'es here are the probability that the game was won (0.6) and the | |
| y's are the probability it was lost (1 - 0.6 = 0.4). So the | |
| probability of the outcome being any one such sequence of12 wins and | |
| 4 losses is: | |
| 0.6^12 * 0.4^(16-12) | |
| = .0000557256278016 | |
| Pretty low! But that's for a given sequence of 12 wins and 4 losses. | |
| There are C(16, 12) such sequences, so the overall probability that we | |
| win exactly 12 of 16 is | |
| C(16, 12) * x^12 * y^(16 - 12) | |
| = 1820 * .0000557256278016 | |
| = .1014206425989120 | |
| I.e., you will win *exactly* 12 games a little over 10% of the time. | |
| This is Q(16, 12) by our earlier notation. | |
| Q: What's the probability that you'll win *at least* 12 of 16? | |
| A: This is the proability of winning exactly 12 + probability of | |
| winning exactly 13 + ... + probability of winning exactly 16. | |
| = Q(16, 12) + Q(16, 13) + Q(16, 14) + Q(16, 15) + Q(16, 16) | |
| Using good old Unix bc with some helper functions (code below), this | |
| comes out to: | |
| q(16,12,0.6)+q(16,13,0.6)+q(16,14,0.6)+q(16,15,0.6)+q(16,16,0.6) | |
| = .16656738435072000000 | |
| or just over 16.6% | |
| Like I said, probability is not something I'm good at, so I tested the | |
| above with something I felt I had an intuitive answer for: the | |
| probability of winning at least half of 17 games if the probability of | |
| winning each is 50%. | |
| I used 17 because there's an even number of outcomes, 18, including the | |
| "0 games won" outcome and so we can split the outcomes neatly. | |
| By the formula above, this is: | |
| q(17,9,0.5) + q(17,10,0.5) + q(17,11,0.5) + q(17,12,0.5) + q(17,13,0.5) | |
| + q(17,14,0.5) + q(17,15,0.5) + q(17,16,0.5) + q(17,17,0.5) | |
| = .50000000000000000000 | |
| I.e., 50% of the time we win at least half of 17 games, which is nice | |
| and intuitive and makes me feel better about this exercise. | |
| Sorry about the length of this! While the final destination may be of dubious | |
| certainty, I had fun getting there and figured I'd map out the journey. | |
| -Sudish | |
| bc functions used (the rest of this can be cut'n'pasted | |
| as is into the Unix bc calculator): | |
| define f (x) { | |
| if (x <= 1) return (1); | |
| return (f(x-1) * x); | |
| } | |
| define c (n, k) { | |
| return (f(n) / (f(k) * f(n-k))); | |
| } | |
| define q (n, k, p) { | |
| return (c(n,k) * (p^k) * ((1-p)^(n-k))); | |
| } | |
| c (16, 12) | |
| scale = 10 | |
| q (16, 12, 0.6) | |
| q(16,12,0.6)+q(16,13,0.6)+q(16,14,0.6)+q(16,15,0.6)+q(16,16,0.6) | |
| q(17,9,0.5) + q(17,10,0.5) + q(17,11,0.5) + q(17,12,0.5) + q(17,13,0.5) + q(17,14,0.5) + q(17,15,0.5) + q(17,16,0.5) + q(17,17,0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment