User:Doug Bell/Poker probability (rank and suit sets)

In poker, the probability of many events can be directly calculated by enumerating the frequency of the event occurring relative to the number of possible outcomes. Complications often arise when enumerating frequencies involving rank sets that turn into straights and straight flushes when combined with additional cards. To a lesser degree, complications also arise when enumerating frequencies involving suit sets that turn into flushes and straight flushes when combined with additional cards.

A rank set is a set of distinct card ranks chosen from the possible ranks {ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, king} which are sometimes indicated using the abbreviations {A, 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K}. A suit set is a set of distinct card suits chosen from the possible suits {club, diamond, heart, spade} which are sometimes indicated using the abbreviations {C, D, H, S} or the symbols {♣,  ♦ ,  ♥ , ♠}. Sometimes it is useful to consider a rank multiset which is a set of card ranks where each rank appears in the set zero or more times; or a suit multiset which is a similar collection of card suits.

While the application of rank and suit sets is common in determining probabilities in poker, there are also applications in other card games that employ runs (suited or unsuited rank sequences) such as gin rummy.

Rank sets and straights
The are several interesting questions relevant to poker probabilities that can be posed regarding rank sets and straights:


 * How many rank sets of n ranks exist?
 * How many rank sets of n ranks form a straight of x sequential ranks?
 * How many rank sets of n ranks form a straight of x sequential ranks when combined with r addional ranks?
 * How many rank sets of n ranks form a straight of x sequential ranks when exactly m ranks in n are combined with x − m ranks?
 * Given the rank set R, how many rank sets of n cards will form a straight of x sequential ranks when combined with R? (More formally, how many rank sets A with a cardinality of n exist such that the union R ∪ A forms a rank set that contains a straight of x sequential ranks?)

Frequency of rank sets by cardinality
A rank set of $$n$$ ranks is formed by choosing $$n$$ distinct ranks from the 13 ranks, which is:


 * $${n \choose 13}$$

The number of ways to choose the ranks from a multiset of card ranks depends on the multiplicity of each rank element of the set. When choosing from a standard deck of cards, the multiplicity of each rank is four. If the multiplicity of each element in a set is infinite, then for the multiset $$A$$ with the cardinality $$|A|$$, the number of multisubsets of cardinality $$n$$, where $$1 \le n \le |A|$$, is given by the binomial theorem as the binomial coefficient:


 * $${|A| - 1 \choose n - 1}$$

This gives the upper bound for the number of multisubsets for multisets with non-infinite multiplicities and gives the exact number when $$n$$ is less than or equal to the minimal multiplicity of $$A$$. For an infinite multiset, the number of multisubsets of size $$k$$>, where $$1 \le k \le |A|$$, is:


 * $$\sum_{n=1}^k{|A| - 1 \choose n - 1}$$

For example, the number of rank multisubsets of size 4 that can be formed from a deck multiset with 13 ranks and four cards of each rank is:


 * $$\sum_{n=1}^4{4 - 1 \choose n - 1} = {3 \choose 0} + {3 \choose 1} + {3 \choose 2} + {3 \choose 3} = 1 + 3 + 3 + 1 = 8$$

For purposes of enumerating rank multisets in poker, multiset sizes of from 1 to 7 ranks are sufficient. These