Edit: Python code added. Question corrected

Right, i am trying to figure out my chances of drawing certain cards in MTG, so that is my frame. I have 4 of the same card and 56 fillers (60 in total)

I can figure out how to calc the chances of having at least 1 of the 4 cards drawn after 1.,2.,3.,4....60. draws.

I can figure out how to cal the chances of drawing 1 of the 4 in 1. draw and then 2 of the 4 in 2. draw.

WHAT i would like to figure out is how to calc the chances of having drawn 2 of the 4 cards after 2.,3.,4.,5.,6.....60. draw, with no cards going back in the deck. (first draw 0%, draw 58, 59, 60 100%)

I made a card drawing script in python and ran i 1.000.000 times, and it gave me the following numbers. Chance of drawing x amount i n draws:

 x  n
1/4 1: 6.67390%  2: 12.99830% 3: 18.98930% 4: 24.65400% ... 57: 100% ...
2/4 1: 0.00000%  2:  0.33760% 3:  0.98370% 4:  1.92270% ... 58: 100% ...

I've done some "research" and found a lot of math that i didnt really understand (i have no training what so ever in math) but i found some that i made into the following code:

print(1-(factorial(N-n) * factorial(n) * factorial(N-n)) / (factorial(n) * factorial(N-n-n) * factorial(N)))

So what i need, if someone wouldn't mind taking the time to write down the propper math needed. With explanations would be great, but if i can just get the math i at least know where i am going towards.

Edit: This is the python script i came up with after i got the answer below:

from math import *
#N is the total population (of cards)
#n is the total desired population (of cards)
#r is the total expected draws of the desired population
result, N, n, r = 0, 60, 4, 2
for k in range(r, N-(n-r-1)):
   a = factorial(k - 1) / (factorial(r - 1) * factorial(k - r))
   b = factorial(N - k) / (factorial(n - r) * factorial(N - k - n + r))
   c = factorial(N) / (factorial(N - n) * factorial(n))
   result +=(a * b)/c

for ease of reading/understanding, i have kept the 3 parts to the problem separated as a, b and c.

Python code for my draw script: https://www.pastiebin.com/5bd96e1930d39 (I am nearly as bad at programming as i am at math)

  • $\begingroup$ From the setup, it looks like once a card is drawn it is not put back into the deck, is that correct? $\endgroup$ – Almacomet Oct 31 '18 at 0:17
  • $\begingroup$ Yes, sorry, forgot to tell that. $\endgroup$ – Hudlommen Oct 31 '18 at 7:32

If we ignore everything about each card except whether it is or is not one of your four cards, then as you deal out the deck you construct a sequence of $4$ objects of one kind (your "same cards") and $56$ objects of another kind (the "fillers").

Just so we can apply the math to other problems like this, where there might be more or fewer total cards or cards of the "same" type, I'll write $N$ instead of $60$ and $n$ instead of $4.$

Continuing to ignore any distinction among the cards except whether they are or are not among your $n$ "same cards," there are $$ \binom Nn = \frac{N!}{(N-n)! n!} $$ distinct ways the cards can come out, and each way is equally likely. (Technically, we should prove each way is equally likely, and we can, but let's move along anyway.)

Now let's say we wanted to know the probability that the $k$th card you draw will be the $r$th card of the "same type" that you draw. (In the question as asked, $r = 2.$) The only way for this to happen is if you first draw $k - 1$ cards that contain only $r - 1$ of the "same" card, which can happen in $ \binom{k-1}{r-1} = \frac{(k-1)!}{(r-1)! (k - r)!} $ ways, then draw one of the "same card" as the $k$th card, and then draw an additional $N - k$ cards of which $n - r$ are the "same", which can happen in $ \binom{N-k}{n-r} =\frac{(N - k)!}{(n - r)! (N - k - n + r)!} $ ways. Naturally, this is only for $k \geq r$ and $k \leq N - r + 1$; if $k < r$ or $k > N - r + 1$ the probability is zero.

So the probability that the $k$th card drawn will be the $r$th same card is $$ f(k) = \frac{\binom{k-1}{r-1}\binom{N-k}{n-r}}{\binom Nn}. $$

You are asking for the probability that the $r$th "same" card will be drawn on or before the $k$th draw; this is simply the sum of $f(i)$ for $i = 1$ to $k.$

There are some algorithmic tricks you might try to make the computation faster. Here's one suggested reference: http://www.math.wm.edu/~leemis/2005informsjoc.pdf (see section 2.1 for sampling without replacement, finite support, equally likely probabilities; the model for generating the probabilities looks different from what you describe, but the probability distribution is the same).

The linked question (Drawing cards until the same card is drawn.) has you put the card back and shuffle the deck every time you draw, which is not the kind of thing you described. (For one thing, if you keep replacing and shuffling, there is no theoretical limit on the number of times you might draw before getting even the first one of your "same" cards.)

  • $\begingroup$ Thank you so much for your help. I am right to understand that to get the probability of having drawn the 2 cards after 4 draws would be f(2) + f(3) + f(4) right? $\endgroup$ – Hudlommen Oct 31 '18 at 8:09
  • $\begingroup$ Yes, that's how it goes. $\endgroup$ – David K Oct 31 '18 at 9:44
  • $\begingroup$ Thanks man. It did fit my numbers, but you can make the foot fit the glove if you are just biased enough.. So i just had to be sure! $\endgroup$ – Hudlommen Oct 31 '18 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.