# Counting number of two pair hands in poker (not standard)

I was doing number counting problem and wanted to check if my result was correct.

Problem description:

From a standard deck of cards(52 cards, 4 suits, 13 numbers in each suit) there are 5 cards drawn. Calculate number of hands where there are atleast two cards with the same number and atleast two cards with different number. The fifth card can be anything, even same as one of the pair numbers.

For example these two would be valid hands:

5$\heartsuit$ 5$\clubsuit$ 9$\spadesuit$ 9$\diamondsuit$ 2$\heartsuit$,

J$\heartsuit$ J$\clubsuit$ 4$\spadesuit$ 4$\diamondsuit$ 4$\heartsuit$

My attempt at solving this:

First I choose two cards with the same number from two different suits.

$\dbinom{13}{1} * \dbinom{4}{2}$

Then I choose two cards with the same number but not the one from the first two and two different suits.

$\dbinom{12}{1} * \dbinom{4}{2}$

Finally I choose the last card which can be anything.

$\dbinom{13}{1} * \dbinom{4}{1}$

So the total number of hands would be: $\dbinom{13}{1} * \dbinom{4}{2} * \dbinom{12}{1} * \dbinom{4}{2} * \dbinom{13}{1} * \dbinom{4}{1}$

Is this correct? If not then could you correct the part where I am wrong?

Thanks!

• thanks, was confusing with different notation
– VOid
Sep 27, 2014 at 18:05
• I'm confused. Do you want to calculate the number of two-pair hands? You have a full-house hand in one of your examples. Do the cards with ranks different from the first pair, have to be a pair themselves? Or can they be anything? Sep 27, 2014 at 18:07
• A very large amount of change is needed. We need to count separately (i) $2$-$1$-$1$-$1$ split; (ii) $2$-$2$-$1$ split (careful not to double count); (iii) $3$ of one kind (we don't need to separate out full house). Then add. By the way, from the wording and examples it is not clear whether (i) is allowed. Sep 27, 2014 at 18:07
• Andrey there should be atleast two cards that have one(5 for example) number and two cards that have common number that is not the same as the other two(9 for example). The last fifth card can be anything even (5 or 9)
– VOid
Sep 27, 2014 at 18:11

From the comments, it seems that you are allowing only hands of the $3$-$2$ type, commonly called Full House, and hands of the $2$-$2$-$1$ type, commonly called Two Pairs.

Full House: The kind we have $3$ of can be chosen in $\binom{13}{1}$ ways. For each such way, the actual $3$ cards can be chosen in $\binom{4}{3}$ ways. for every way of doing these things, there are $\binom{12}{1}$ ways of choosing the kind we have $2$ of, and then $\binom{4}{2}$ ways to choose the $2$ cards, for a total of $\binom{13}{1}\binom{4}{3}\binom{12}{1}\binom{4}{2}$.

Two Pairs: This one is tricky, it is all too easy to double count. The two kinds we have $2$ each of can be chosen in $\binom{13}{2}$ ways. For each of thse ways, the $2$ cards of the higher-ranking kind can be chosen in $\binom{4}{2}$ ways, and for each of these ways the cards of the other kind can be chosen in $\binom{4}{2}$ ways. Finally, after all this has been done, the "junk" card can be chosen in $\binom{44}{1}$ ways, for a total of $\binom{13}{2}\binom{4}{2}\binom{4}{2}\binom{44}{1}$.

Finally, add the two numbers obtained above.

Remark: Your calculation does multiple counting in various ways. For example, consider the hand $\spadesuit$ K, $\heartsuit$ K, $\diamondsuit$ $7$, $\clubsuit$ $7$, $\heartsuit$ Q. This has been double-counted, for you have counted as different the choice $\diamondsuit$ $7$, $\clubsuit$ $7$, $\spadesuit$ K, $\heartsuit$ K, $\heartsuit$ Q. This is because your first choice of kind, among the $\binom{13}{1}$ could have been K, and your second choice among the $\binom{12}{1}$ could have been $7$, or the other way around. But these give the same hand,

Counting in a way that avoids multiple counting can be initially quite tricky. We naturally think in terms of doing things sequentially, "first" then "second." we have to be careful to make sure that different choices of "first" and "second" do not yield the same final hand.

• your remark helped me to understand, thanks!
– VOid
Sep 27, 2014 at 18:44
• You are welcome. This was not the only multiple counting, for in the $3$ of a kind case, if we already had $2$ Kings and add a third as a fifth card, you could get the same hand in $3$ ways: K of diamonds added at the end to K of spades, K of hearts. Or K of spades added at the end to K of hearts, K of diamonds. Or same with K of hearts added as the fifth card. Sep 27, 2014 at 18:50