IntroductionSo, I see a lot of statements getting thrown around. "Oh, if only I'd drawn this." and "You only won because you were lucky." etc. Sometimes it's correct, but frequently it isn't.
So I decided that I would put up a little primer on how probability works.
The general approach to finding the probability of a certain event happening is to find how many ways that event can happen and dividing it by how many total ways the system can occur. Let's demonstrate this with an example.
Let's say I wanted to find the probability of rolling exactly one 6 when I roll two dice. Here's a table of all of the possibilities:
1st\2nd | 1 | 2 | 3 | 4 | 5 | 6 |
1 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | 1,6 |
2 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | 2,6 |
3 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6 |
4 | 4,1 | 4,2 | 4,3 | 4,3 | 4,5 | 4,6 |
5 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6 |
6 | 6,1 | 6,2 | 6,3 | 6,4 | 6,5 | 6,6 |
So there are 10 rolls that give exactly one 6. We can find the total number of possible rolls with 6^2, because there are 6 things each die can be and I roll 2 dice. This means the total probability of rolling exactly one 6 is 10/36.
This example was simple enough that we could look at all the possibilities by hand. Most of the time though, the number of possibilities would be so large that doing this would be impossible. So we'll have to do something else.
Enter hypergeometrics. Many of you have probably seen various hypergeometric calculators online but not really understood how they actually worked. They use the same principle described above, it's just that a general formula is needed to do it.
DefinitionsIn order to describe the equations, I will need to define some things first.
n! is the factorial function and what is means is that you multiply all the numbers between n and 1 together. In math notation:
n!=n*(n-1)*(n-2)*...*3*2*1
The other thing we will need is what's called the nCr function. This function is a combination of factorials and what it does is count how many ways I can choose r things from n things, the final order not mattering. This is what it looks like.
ncr(N,n) = N!/(n!*(N-n)!)
First ExampleSo lets look at another example. Suppose I want to know the chance of rolling 3 heads in 10 coin flips. This is simple enough that it could be done by hand but let's do it with our new tools instead.
So we want to see how many ways we can pick out 3 heads out of 10 total flips. Using our handy ncr function:
ncr(10,3) = 10!/(3!*7!) =120
To find the probability, we divide by the total number of possibilities, which in this case is 2^10, 10 coin flips and 2 ways each one could go.
Probability of flipping 3 heads=120/2^10=.1171875~12%
So there is approximately a 12% chance that you will flip 3 heads in 10 flips.
ElementsNow let's get on to what you've all been waiting for. How can this be applied to elements?
There are several different ways that this can be applied to elements, but the biggest one by far is based on drawing specific things.
So lets say I have 6 of a card (we'll call it card A) in my 30 card deck. What are the chances that I have 2 of them in my opening hand? (we'll ignore mulligan for now, just pretend my deck has no 0 cost cards in it)
There will be ncr(6,2) ways that you could pick out 2 of your 6 'card A's, and ncr(24,5) ways you could choose the remaining 5 cards (30-6 leaves 24 cards that are not card A, and the 5 is the remaining number of cards you need to draw).
This means there are
ncr(6,2)*ncr(24,5)=637560
total hands where I start with 2 of card A. This sounds like a really big number, but to find the probability we have to divide by the total possible number of hands. Here we just go back to our ncr function.
Total number hands=ncr(30,7)=2035800
To find the probability we divide the two:
probability of having 2 of card A in first 7 cards=637560/2035800~.3132~31%
So the chance is about 31%.
The way this formula will generalize for 1 desired result is:
Suppose a population consists of N items, k of which are successes. And a random sample drawn from that population consists of n items, x of which are successes. Then the hypergeometric probability is:
P(N,n,k,x)=ncr(k,x)*ncr(N-k,n-x)/ncr(N,n)
The first term is how many ways I can the card that I want, the second is the number of ways there are to get the remaining cards, and the last is the total number of hands.
MulliganIn decks that are 1/3 pillars, the chance for a mulligan is under 5%, even for a 60 card deck, so it can generally be ignored and you'd still be pretty close. But let's try and take it into account.
If I want to see what my chances are of starting with 2 pillars in hand, I can get a start by just using the same equation as before.
Here N=30, n=7, k=10, x=2
P(30,7,10,2)=ncr(10,2)*ncr(20,5)/ncr(30,7)~.34
However, if I get 0 pillars in my hand I get a second chance for this 34%. So now I have to find the chance of a mulligan.
P(30,7,10,0)=ncr(10,0)*ncr(20,7)/ncr(30,7)~.04
If I get the mulligan, than I get a second chance at the 34%. So the final probability is:
P2~.34+.04*.34~.354
So the mulligan has an effect here, but it's not very large.
GeneralizationsTo generalize the above equation further to more than one desired card.
Suppose a population consists of N items, of which there are j & k of two separate desirable items. And a random sample drawn from that population consists of n items, x of which are 'j's and y of which are 'k's. Then the hypergeometric probability is:
P(N,n,k,x)=ncr(j,x)*ncr(k,y)*ncr(N-j-k,n-x-y)/ncr(N,n)
ConclusionSo next time you're thinking about how lucky/unlucky something was, you'll now have the tools at your disposal to tell exactly how lucky it was.
Comments?
*Summary/TLDR to be added soon, along with further information on generalizations.*