# When does the probability of dealing 2 cards that I've already dealt in a previous shuffle reach 50%

I play poker and create poker software. So questions about card shuffling and dealing interest me. I'm trying to understand the likelihood of receiving the same hand twice over a number of shuffles.

Here's how my hand is created: Take a freshly shuffled deck of cards. Deal the first two cards (more specifically, the first two cards whose faces I see.) Consider order to not be important. There are (52 x 51) / 2 possibilities, that is 1,326 possibilities. That suggests to me that it is reasonably likely that in any online poker session (which can involve playing hundreds of hands), I'll receive the same two cards twice.

How many hands would I need to play for the probability to see a hand I've already had to be at least 50%?

(Perhaps to be answered in the comments: how can I educate myself to answer such questions in the future? Is there a good book or online resource?)

This is the birthday problem.

Instead of determining the probability of (at least) a duplicate deal, because that "at least" raises difficulties in computation, let us instead determine the probability $q_k$ that no duplicate arises in $k$ deals.

$q_1 = 1 = 1326/1326$, obviously, because there can be no duplicate in a single deal. In two deals, a duplicate occurs if the second deal duplicates the first. As you've determined there are $(52)(51)/2 = 1326$ deals, so that probability that a duplicate does not occur is $q_2 = q_1(1325/1326) = (1326/1326)(1325/1326)$.

For the third deal not to be a duplicate, it has to avoid both the first two deals, which happens with probability $1324/1326$, so $q_3 = q_2(1324/1326) = (1326/1326)(1325/1326)(1324/1326)$. And for the fourth deal not to be a duplicate, it has to avoid all of the first three deals, so $q_4 = q_3(1323/1326) = (1326/1326)(1325/1326)(1324/1326)(1323/1326)$. It should be clear by now that

$$q_k = \frac{1326}{1326} \cdot \frac{1325}{1326} \cdot \frac{1324}{1326} \cdot \cdots \cdot \frac{1326-k+2}{1326} \cdot \frac{1326-k+1}{1326} = \frac{1326!}{(1326-k)!1326^k}$$

and is terminated by $q_{1327} = 0$, since by the pigeonhole principle, a duplicate is certain to occur by the $1327$th deal. (By convention, we can write $(-1)! = \Gamma(0) = +\infty$, so in some sense, the expression above is applicable even to $k = 1327$.)

The sequence $q_k$ drops much faster than one generally thinks (if one hasn't encountered the birthday problem previously), and drops to below $1/2$ (that is, attains a probability greater than $1/2$ that a duplicate has occurred) at about $k \doteq 1/2 + \sqrt{2N\ln 2}$, where $N$ is the number of choices ($365$ in the case of the birthday problem, and $1326$ here). That expression yields a critical point of about $k \doteq 1/2 + \sqrt{(2)(1326)(0.69315)} \doteq 43.375$; hence, the $43$ provided by David in his answer.

• Thank you. I have encountered the birthday problem, but didn't work out myself that this is the same problem. – Steve McLeod Apr 24 '15 at 5:52

Looks like about $43$ hands before the prob of a repeat of the first $2$ cards reaches at least $50$% but it depends what you mean by previous. For example, if you draw cards A and B initially, are you then only looking for the next occurrence of A and B and want to know when it is $50$% or greater chance of getting A and B as the first 2 cards or do you mean if you get A,B on the first hand, then $2$ different cards, C and D on the 2nd hand, then you are now looking for either an A,B pair or a C,D pair...?

• I mean, getting any hand that has previously appeared. So yes, A,B or C,D or E,F or... – Steve McLeod Apr 20 '15 at 3:05