# Counting isomorphic combinations

Assume a simplified poker deck (to cut down the # of combinations):

• 4 suits (h, c, d, s)
• 5 ranks (A, K, Q, 7, 2)
• 20 cards

Assume a basic 2-player setup:

• Hand 1 (2 cards)
• Hand 2 (2 cards)
• Flop (3 cards)

There are 16,279,200 combinations of the above setup: choose(20, 2) * choose(18, 2) * choose(16, 3).

Take the following combination:

• Hand 1 = Ad, As
• Hand 2 = Kc, Kh
• Flop = Qd, 7s, 2c

Question: what is the most efficient way to calculate the number of combinations (within the 16,279,200) that are suit-isomorphic with this setup?

For example, the following setup is suit-isomorphic:

• Hand 1 = As, Ac
• Hand 2 = Kh, Kd
• Flop = Qs, 7c, 2h

while this example is not:

• Hand 1 = Ad, As
• Hand 2 = Kc, Kh
• Flop = Qc, 7s, 2d

nor is this example:

• Hand 1 = Kc, Kh
• Hand 2 = Ad, As
• Flop = Qd, 7s, 2c

===Edit ... explaining what I mean by suit isomorphism===

The only isomorphic transformation allowed is one that shifts suits, not ranks. The first example failed example isn't "suit" isomorphic because f(d) isn't a one-to-one map: on the Ace in Hand 1, f(d) = d. On the Queen in the flop, f(d) = c. The second example failed because the ranks within Hand 1 and Hand 2 were swapped.

===Edit ... a more general approach to the question===

The solution shouldn't rely on a specific structure of the problem. For example, in the example I gave, the solution is 24 (i.e. the permutations of the 4 suit symbols). But what happens in the following cases.

• I might start eliminating cards. For example, I might pull the 2c out of the deck.
• I might not use all 4 symbols.
-
I'm not clear about what you mean by "suit isomorphic"...for example, what is the status of: Hand 1 = Ac,As; Hand 2 = Kh,Kd; Flop = Qd, 7s, 2c? And what about Hand 1 = Ac,Kh; Hand 2 =Ad,Ks; Flop = Ah, Kc, Kd? – amWhy May 5 '11 at 20:58
1) Not isomorphic. Neither of the aces (which should be treated as a set ... order doesn't matter) have the same suit as the Queen. So f(d) = d and f(d) = either s or c. My understanding of isomorphism is that it is a one-to-one map, not a one-to-many. – MikeRand May 5 '11 at 21:36
2) Not isomorphic. The ranks are different. The only transformation allowed is on the suits (h, d, c, s). – MikeRand May 5 '11 at 21:36
got it; I wasn't clear if you were providing an "example" or if your examples were defining the isosmorphism...Yes, an isomorphism requires a one-to-one map, but not all one-to-one maps are isomorphic. i.e. being injective is a necessary condition for an isomorphism, but not at all sufficient. – amWhy May 5 '11 at 22:03
Is isomorphism even the right term for what I'm describing? Unfortunately I have no formal math training, so the best I can understand is that I've designed some k-partite (maybe k = 4) graph but am only testing for isomorphism across one of the sets of vertices (i.e suits). – MikeRand May 5 '11 at 23:03

You are asking for an orbit of a group action, where the group is the group of all permutations of the suits, and the action is the action on the setups where a permutation acts on each card individually. The orbit can just be constructed by taking the 24 possibilities and seeing which ones are "allowed" and which are different. 24 is a tiny number.

Sometimes though permuting the suits may not actually change the setup. Consider the example:

• Hand 1: 3♣, 3♠
• Hand 2: 3♢, 3♡
• Flop: 2♡, 4♡, 5♡

Then the permutation that switches ♣ and ♠ but leaves ♢ and ♡ alone actually ends up leaving the setup alone: hand 1 switches the order of the two cards, but that doesn't change the hand; hand 2 and the flop stay exactly the same.

Assuming you don't throw any cards out, the number of isomorphic setups is always a divisor of 24, namely the index of the "stabilizer" of the setup (see the "orbit-stabilizer theorem").

If you start throwing out cards, then basically your problem has no structure. This is not a big problem, because 24 is a tiny number. Just try all 24 and see which are "allowed".

-
Very interesting, never even came across orbits. Quick question: by throwing out cards, do you mean (in your example) if I were to throw the 5d out, for example? – MikeRand May 6 '11 at 10:26
Exactly. Then if there was a 5h in the setup, you'd have to disallow a heart/diamond switch. The set of allowed permutations of the suits might no longer be a group, and then it really is honestly just checking all 24 ways, AFAIK. – Jack Schmidt May 6 '11 at 12:32