I've read the answer on counting the number of possible two pair hands in poker and I understand it. However, I don't know why my initial approach was wrong. Can someone point to the flaw in my approach.
Here's my logic. I'm going to assume a hand in the particular order XXYYZ, and then divide by 5! to account for the fact that the order of cards can be in any order.
The first card X is any one of the 52 cards. The second card X is any one of the remaining 3 cards that would make the initial pair XX. The third card Y is any one of the 48 cards remaining in the deck that's not X. The fourth card Y is any one of the remaining 3 cards that would make the second pair YY. The fifth card is any one of the 44 cards remaining in the deck that's not X nor Y.
So my answer is: (52*3*48*3*44)/(5!)
This doesn't even end up as an integer. So where did my logic go wrong?
If order matters, you should multiply (not divide) by 5! You generate all possible permutations from a set of different elements.
However, David G. Stork's comment is still legit:
5♢5♠6♣6♡J♣ will generate all permutations including 5♢5♠6♣6♡J♣
6♡6♣5♠5♢J♣ will generate all permutations including 5♢5♠6♣6♡J♣
So, each permutation will be counted 8 times (2!×2!×2!). One 2! comes from permutation inside the first pair, one 2! comes from the second pair and one 2! from permutations between pairs (we could have selected 6 first and 5 second). The number of tuples containing two pairs is then: $$n=\frac12\frac{52\times3}2\times\frac{48\times3}2\times44\times5!=14\,826\,240$$
If we divide by total number of tuples (52!/47!), we will get the probability of two-pair hand: $$p=\frac{n}{52!/47!} = \frac{198}{4165}\approx 4.75\,\%$$