I'm having trouble with a very specific problem.

Given the following assumptions:

- Start with a standard 52-card deck of playing cards.
- Deal five cards from the deck.
- These cards are "visible", i.e., known to the solver of the problem.
- None of the five visible cards are of the same rank, i.e., there are no pairs of fives, sixes, jacks, queens, etc.

Given these assumptions, what is the probability that, if two additional cards are dealt from the remaining 47-card deck, that the combined seven dealt cards will contain a five card hand that contains a pair (e.g., two fives or two sixes).

Here's how I've analyzed the problem so far.

Let C(n, k) be the binomial coefficient "n choose k". After the initial five cards have been dealt, there are 47 cards left in the deck, and there are C(47, 2) = 1081 ways to deal the two additional cards.

However, only 15 of the remaining 47 cards would "pair up" with one of the five cards that have already been dealt. (Three remaining cards of the same rank for each of the five originally dealt cards.) In order for the combined seven dealt cards to contain a five card hand with a pair, then the last two dealt cards would have to contain one or more of these 15 cards.

The probability of this happening is computed by choosing each of the 15 cards, pairing them with each of the remaining 46 cards, then dividing that product by the total number of outcomes for the final two cards, or 15*46/1081 = 63.83%.

My problem is that I've also written some code to simulate this problem and produce a monte carlo result, and the numbers don't match! The results of my monte carlo simulation are approximately 58.7% and are fairly consistent.

If any of you sees a flaw in the mathematical anlaysis I've presented here I would really appreciate a corrective post!

Thanks!