# Math Help - Hand Draw Proabilities for Magic:tG

1. ## Hand Draw Proabilities for Magic:tG

Hello all,

(BTW I misspelled Probability in the subject... apparently I cant edit it. Sorry )

I play Magic: the Gathering, and it has been 10 years since I took probability in college.

Problem A (example): taken from wikipedia
Poker probability - Wikipedia, the free encyclopedia

What is probability of drawing 2 pair in a 5 card hand from 52 card deck?

f = 13C2 * 4 C 2 * 4 C 2 * 11C1 * 4 C 1
= (choose 2 numbers for pairs) * # combos for 4 suits pair 1 * # combos for 4 suits pair 2 * choose 11th number for last card * choose suit last card

Problem B (My problem)

I have a 60 card deck
4 card A
4 card B
10 card C
42 card D ("other")

What is the probability in 7 card, 8 card, 9 card draw that I draw at least one A, one B, and one C?

Events, 7 card draw
Choose 3 cards of 7 to be the three special cards
# ways to choose 1 card from A (4)
# ways to choose 1 card from B (4)
# ways to choose 1 card from C (10)
# ways to choose 4 cards from D (42)

f = 7C3 * 4C1 * 4C1 * 10C1 * 57 C 4
f = 2,212,056,000
N = 60 C 7
N = 386,206,920
P = 572%

What am I doing wrong?

The following answer seems right, but I would appreciate validation.

If I focus on the fact that order matters for the first 3 cards, but not the last 4, I get

f = 7P3 * 4C1 * 4C1 * 10C1 * 57 C 4
N = 60P3 * 57 C 4
P = 16.36%

Thus, for these 3 cards drawn together in a hand of n, the probability is
P(3 cards in draw of n) = 160 * nP3 / 60P3
P(n+1) = (n+1)/(n-2) * P (n)

So P (3 in 7 draw) = 16%
P (3 in 8 draw) = 26%
P (3 in 9 draw) = 39%

2. Originally Posted by NerdChieftain
Hello all,

(BTW I misspelled Probability in the subject... apparently I cant edit it. Sorry )

I play Magic: the Gathering, and it has been 10 years since I took probability in college.

Problem A (example): taken from wikipedia
Poker probability - Wikipedia, the free encyclopedia

What is probability of drawing 2 pair in a 5 card hand from 52 card deck?

f = 13C2 * 4 C 2 * 4 C 2 * 11C1 * 4 C 1
= (choose 2 numbers for pairs) * # combos for 4 suits pair 1 * # combos for 4 suits pair 2 * choose 11th number for last card * choose suit last card

Problem B (My problem)

I have a 60 card deck
4 card A
4 card B
10 card C
42 card D ("other")

What is the probability in 7 card, 8 card, 9 card draw that I draw at least one A, one B, and one C?

Events, 7 card draw
Choose 3 cards of 7 to be the three special cards
# ways to choose 1 card from A (4)
# ways to choose 1 card from B (4)
# ways to choose 1 card from C (10)
# ways to choose 4 cards from D (42)

f = 7C3 * 4C1 * 4C1 * 10C1 * 57 C 4
f = 2,212,056,000
N = 60 C 7
N = 386,206,920
P = 572%

What am I doing wrong?

The following answer seems right, but I would appreciate validation.

If I focus on the fact that order matters for the first 3 cards, but not the last 4, I get

f = 7P3 * 4C1 * 4C1 * 10C1 * 57 C 4
N = 60P3 * 57 C 4
P = 16.36%

Thus, for these 3 cards drawn together in a hand of n, the probability is
P(3 cards in draw of n) = 160 * nP3 / 60P3
P(n+1) = (n+1)/(n-2) * P (n)

So P (3 in 7 draw) = 16%
P (3 in 8 draw) = 26%
P (3 in 9 draw) = 39%
Multinomial distribution

CB

3. Thank you for the reply.

Ultimately, I come to Multivariate hypergeometric distribution in Wikipedia.

This doesn't help me advance further, I stuck more on theoretics than the mechanics.

f = [ 7P3 * 57P4 ] * 4C1 * 4C1 * 10C1
N = 60P7
P = 16.4%

The problem with this formula is that for n >= 12, the probability is > 100%

4. I revisited the multinomial distribution,

Sorry for my slow uptake here.

P (draw A,B,C) = [3! /(1!1!1!)] * (10*4*4) / (60 * 59 * 58 )
= 960 / 205,320
= 4.7%

But I don't think that is right; if we count permutations for f, also need to for N
P(ABC) = [3! /(1!1!1!)] * (10*4*4) / 60P3
P(ABC) = 0.5%
Generalizing,
P(ABCD^4) = [7! /(1!1!1!4!)] * (10*4*4) 42P4/ 60P7
P(ABCD^4) = 4.6%

But... is the piece that I am missing that this the probability that I draw exactly 1 of each or 1 of each and 4 of D?

To account for at least 1 of each,
1 - P(D^7) - P(AD^6) - P(BD^6) - P(CD^6) - P(ABD^5) - P(ACD^5) - P(BCD^5) = 47.4%
That seems high.

5. Originally Posted by NerdChieftain
I revisited the multinomial distribution,

Sorry for my slow uptake here.

P (draw A,B,C) = [3! /(1!1!1!)] * (10*4*4) / (60 * 59 * 58 )
= 960 / 205,320
= 4.7%

But I don't think that is right; if we count permutations for f, also need to for N
P(ABC) = [3! /(1!1!1!)] * (10*4*4) / 60P3
P(ABC) = 0.5%
Generalizing,
P(ABCD^4) = [7! /(1!1!1!4!)] * (10*4*4) 42P4/ 60P7
P(ABCD^4) = 4.6%

But... is the piece that I am missing that this the probability that I draw exactly 1 of each or 1 of each and 4 of D?

To account for at least 1 of each,
1 - P(D^7) - P(AD^6) - P(BD^6) - P(CD^6) - P(ABD^5) - P(ACD^5) - P(BCD^5) = 47.4%
That seems high.
Sorry its not a multinomial distribution it is a geometric (multivariate) distribution.

CB

6. Originally Posted by NerdChieftain
Hello all,

(BTW I misspelled Probability in the subject... apparently I cant edit it. Sorry )

I play Magic: the Gathering, and it has been 10 years since I took probability in college.

Problem A (example): taken from wikipedia
Poker probability - Wikipedia, the free encyclopedia

What is probability of drawing 2 pair in a 5 card hand from 52 card deck?

f = 13C2 * 4 C 2 * 4 C 2 * 11C1 * 4 C 1
= (choose 2 numbers for pairs) * # combos for 4 suits pair 1 * # combos for 4 suits pair 2 * choose 11th number for last card * choose suit last card

Problem B (My problem)

I have a 60 card deck
4 card A
4 card B
10 card C
42 card D ("other")

What is the probability in 7 card, 8 card, 9 card draw that I draw at least one A, one B, and one C?

Events, 7 card draw
Choose 3 cards of 7 to be the three special cards
# ways to choose 1 card from A (4)
# ways to choose 1 card from B (4)
# ways to choose 1 card from C (10)
# ways to choose 4 cards from D (42)

f = 7C3 * 4C1 * 4C1 * 10C1 * 57 C 4
f = 2,212,056,000
N = 60 C 7
N = 386,206,920
P = 572%

What am I doing wrong?

The following answer seems right, but I would appreciate validation.

If I focus on the fact that order matters for the first 3 cards, but not the last 4, I get

f = 7P3 * 4C1 * 4C1 * 10C1 * 57 C 4
N = 60P3 * 57 C 4
P = 16.36%

Thus, for these 3 cards drawn together in a hand of n, the probability is
P(3 cards in draw of n) = 160 * nP3 / 60P3
P(n+1) = (n+1)/(n-2) * P (n)

So P (3 in 7 draw) = 16%
P (3 in 8 draw) = 26%
P (3 in 9 draw) = 39%
Hi NerdChieftain,

I'll take a shot at finding the probability that you draw at least one A, at least one B, and at least one C in a hand of 7.

It may be easier to find the probability of the complementary event-- i.e., you draw no A, no B, or no C-- then subtract from 1 to solve the original problem. So let a=the number of A's, b=the number of B's, and c=the number of C's in the 7-card hand.

Here's the tricky part:
(1)... P(a=0 or b=0 or c=0) = P(a=0) + P(b=0) + P(c=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(b=0 and c=0) + P(a=0 and b=0 and c=0)

Now, the total number of possible hands is $\binom{60}{7}$, all of which are equally likely. The number of possible hands with no A's is $\binom{56}{7}$. So
$P(a=0) = \binom{56}{7} / \binom{60}{7}$.

Similarly,
$P(b=0) = \binom{56}{7} / \binom{60}{7}$
$P(c=0) = \binom{50}{7} / \binom{60}{7}$
$P(a=0 \text{ and } b=0) = \binom{52}{7} / \binom{60}{7}$
$P(a=0 \text{ and }c=0) = \binom{46}{7} / \binom{60}{7}$
$P(b=0 \text{ and }c=0) = \binom{46}{7} / \binom{60}{7}$
$P(a=0 \text{ and } b=0 \text{ and } c=0) = \binom{42}{7} / \binom{60}{7}$

Substituting all these values in (1), I find
P(a=0 or b=0 or c=0) = 0.90590,
so
P(a>0 and b>0 and c>0) = 1 - 0.90590 = 0.09410,
approximately.

7. Originally Posted by awkward
Hi NerdChieftain,

I'll take a shot at finding the probability that you draw at least one A, at least one B, and at least one C in a hand of 7.

It may be easier to find the probability of the complementary event-- i.e., you draw no A, no B, or no C-- then subtract from 1 to solve the original problem. So let a=the number of A's, b=the number of B's, and c=the number of C's in the 7-card hand.

Here's the tricky part:
(1)... P(a=0 or b=0 or c=0) = P(a=0) + P(b=0) + P(c=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(b=0 and c=0) + P(a=0 and b=0 and c=0)

Now, the total number of possible hands is $\binom{60}{7}$, all of which are equally likely. The number of possible hands with no A's is $\binom{56}{7}$. So
$P(a=0) = \binom{56}{7} / \binom{60}{7}$.

Similarly,
$P(b=0) = \binom{56}{7} / \binom{60}{7}$
$P(c=0) = \binom{50}{7} / \binom{60}{7}$
$P(a=0 \text{ and } b=0) = \binom{52}{7} / \binom{60}{7}$
$P(a=0 \text{ and }c=0) = \binom{46}{7} / \binom{60}{7}$
$P(b=0 \text{ and }c=0) = \binom{46}{7} / \binom{60}{7}$
$P(a=0 \text{ and } b=0 \text{ and } c=0) = \binom{42}{7} / \binom{60}{7}$

Substituting all these values in (1), I find
P(a=0 or b=0 or c=0) = 0.90590,
so
P(a>0 and b>0 and c>0) = 1 - 0.90590 = 0.09410,
approximately.
Awkward:

I am working on a spreadsheet with this exact problem and was so glad to find this thread! I do, however, have a question about your solution. Please bear with me, my stats experience is limited to a couple of introductory college courses.

Once you compute P(a=0), P(b=0), and P(c=0), could you not then subtract each from 1 to get the probability that you get at least 1 of each card? I.E.: 1-P(a=0) = P(a>0), correct? Once you get P(a>0), P(b>0), and P(c>0), wouldn't you then be able to multiply the three together to get the probability that all three are satisfied?

I did this with the example figures you used and came up with a different answer (0.118322738), so I am assuming that I am missing something. I cannot figure out why it does not work? The logic escapes me.

8. OP: If you are playing this game with any level of dedication, chances are you are going to want to answer a lot of questions of this form and, rather than coming up with new methods each time to solve each problem, it would probably be in your best interest to find a way to Monte Carlo it, or something. It shouldn't take very long to code something that can do problems like this if someone hasn't written it already.

That's certainly the route you go for Poker analysis, although the calculations are a bit more complicated.

I put everything into a spreadsheet and got .094103. I listed out all the ways to get a success (e.g. 4 of card A, 1 of card B, 2 of card C) and then used the usual multivariate hyper-geometric formula on all of them. Then, sum em up. Awkward's solution is better.

9. Originally Posted by CountZero
Awkward:

I am working on a spreadsheet with this exact problem and was so glad to find this thread! I do, however, have a question about your solution. Please bear with me, my stats experience is limited to a couple of introductory college courses.

Once you compute P(a=0), P(b=0), and P(c=0), could you not then subtract each from 1 to get the probability that you get at least 1 of each card? I.E.: 1-P(a=0) = P(a>0), correct? Once you get P(a>0), P(b>0), and P(c>0), wouldn't you then be able to multiply the three together to get the probability that all three are satisfied?

I did this with the example figures you used and came up with a different answer (0.118322738), so I am assuming that I am missing something. I cannot figure out why it does not work? The logic escapes me.

The correct way to do what you're suggesting is to do what Awkward did, which is use the Inclusion-Exclusion Principle to calculate the probability of P(a = 0 or b = 0 or c = 0). The events P(a > 0), P(b > 0), P(c > 0) are not independent, so you can't multiply them together like that.

10. Originally Posted by CountZero
Once you compute P(a=0), P(b=0), and P(c=0), could you not then subtract each from 1 to get the probability that you get at least 1 of each card? I.E.: 1-P(a=0) = P(a>0), correct?
It's true that 1-P(a=0) = P(a>0), but it's not true that P(a>0 or b>0) = P(a>0) + P(b>0). That's because the events a>0 and b>0 are not mutually exclusive. Instead, P(a>0 or b>0) = P(a>0) + P(b>0) - P(a>0 and b>0). The extension of this approach to three events is what I called "the tricky part" in my original post. As theodds said, the general case with n events is called the "inclusion / exclusion principal".

Once you get P(a>0), P(b>0), and P(c>0), wouldn't you then be able to multiply the three together to get the probability that all three are satisfied?
No, because the events are not independent. (Again, theodds has already noted this.)

11. Awkward & TheOdds:

You guys don't know how much I appreciate your help with this. I see the problem with my "simple" approach. Now, let me see if I have this straight:

For 2 choices:

> 1 - P(a=0 or b=0) = 1 - P(a=0) + P(b=0) - P(a=0 and b=0)

For 3:

> 1 - P(a=0 or b=0 or c=0) = 1 - P(a=0) + P(b=0) + P(c=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(b=0 and c=0) + P(a=0 and b=0 and c=0)

And for 4 (this one I tried to derive from 2 and 3 above):

> 1 - P(a=0 or b=0 or c=0 or d=0) = 1 - P(a=0) + P(b=0) + P(c=0) + P(d=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(a=0 and d=0) - P(b=0 and c=0) - P(b=0 and d=0) - P(c=0 and d=0) - P(a=0 and b=0 and c=0) - P(a=0 and b=0 and d=0) - P(b=0 and c=0 and d=0) + P(a=0 and b=0 and c=0 and d=0)

Here is what I am doing: I have a spreadsheet where the user enters their cards in a list. They can then go select 1 or more cards (up to 7) to see what the odds are that they draw at least 1 of each in their first hand. I was initially trying to calculate this in a single formula, but from the looks of this it will require some simple VBA code and a couple of loops. I just want to make sure I have the logic straight.

Once the user selects a card in the list, the spreadsheet puts the probability of drawing at least 1 in their first hand in the cell to the right. I can subtract this figure from 1 and have the P(x=0) value for each one, then run down the list in a loop adding and subtracting according to the logic above.

Does it sound like I am on the right track?

Thanks again!
CountZero

12. Originally Posted by theodds
OP: If you are playing this game with any level of dedication, chances are you are going to want to answer a lot of questions of this form and, rather than coming up with new methods each time to solve each problem, it would probably be in your best interest to find a way to Monte Carlo it, or something. It shouldn't take very long to code something that can do problems like this if someone hasn't written it already.

That's certainly the route you go for Poker analysis, although the calculations are a bit more complicated.

I put everything into a spreadsheet and got .094103. I listed out all the ways to get a success (e.g. 4 of card A, 1 of card B, 2 of card C) and then used the usual multivariate hyper-geometric formula on all of them. Then, sum em up. Awkward's solution is better.
Your not supposed to tell the marks how we actually do these things, its a secret of the Sacred Brotherhood of Professional Games Analysts (SBPGA). Your black-spot is in the e-mail.

CB

13. Originally Posted by CountZero
Awkward & TheOdds:

You guys don't know how much I appreciate your help with this. I see the problem with my "simple" approach. Now, let me see if I have this straight:

For 2 choices:

> 1 - P(a=0 or b=0) = 1 - [P(a=0) + P(b=0) - P(a=0 and b=0)]

Added some brackets so that it's correct.

For 3:

> 1 - P(a=0 or b=0 or c=0) = 1 - [P(a=0) + P(b=0) + P(c=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(b=0 and c=0) + P(a=0 and b=0 and c=0)]

Similarly here.

And for 4 (this one I tried to derive from 2 and 3 above):

> 1 - P(a=0 or b=0 or c=0 or d=0) = 1 - [P(a=0) + P(b=0) + P(c=0) + P(d=0) - P(a=0 and b=0) - P(a=0 and c=0) - P(a=0 and d=0) - P(b=0 and c=0) - P(b=0 and d=0) - P(c=0 and d=0) + P(a=0 and b=0 and c=0) + P(a=0 and b=0 and d=0) + P(b=0 and c=0 and d=0) - P(a=0 and b=0 and c=0 and d=0)]

I think you have the pattern a little off; the sign alternates when you pass from two to three items, three to four, etc. Changed some pluses to minuses, and put some brackets on it. See the Inclusion-Exclusion link above.

Here is what I am doing: I have a spreadsheet where the user enters their cards in a list. They can then go select 1 or more cards (up to 7) to see what the odds are that they draw at least 1 of each in their first hand. I was initially trying to calculate this in a single formula, but from the looks of this it will require some simple VBA code and a couple of loops. I just want to make sure I have the logic straight.

It's probably a better investment of time to work on coding something that can do a simulation. You'll end up with something a little more robust in terms of the types of questions you can answer. Someone has probably already written an app that does this for MTG; a lot of those guys play poker, and there are tons of poker apps floating around.

Once the user selects a card in the list, the spreadsheet puts the probability of drawing at least 1 in their first hand in the cell to the right. I can subtract this figure from 1 and have the P(x=0) value for each one, then run down the list in a loop adding and subtracting according to the logic above.

Not just P(a = 0) for each card, you'll need to do all the P(a = 0, b = 0) and so forth on down the line. You can't get those from the univariate probabilities (because they aren't independent), but they aren't hard to calculate.

Does it sound like I am on the right track?

Thanks again!
CountZero
@CB: Haha. Circa 2004 I wouldn't, but all this stuff is public knowledge now