Durango Bill's

Bridge Probabilities and Combinatorics

Bridge Probabilities - How to Calculate Bridge Suit Distribution Combinations

As in most of the
other combinatoric problems for Bridge hands, the first step
in calculating the number of hands for each distribution (and
their probability) is to calculate the total possible number
of different hands. A Bridge hand consists of 13 cards
randomly selected from a deck of 52 cards. Hence the total
number of possible hands is COMBIN( 52,13) = 635,013,559,600.
This number serves two purposes. First we will divide the
numbers that appears in the "Total Hands" column to get the
probability of each of the possible distributions. We also
will add all the numbers in the "Total Hands" column to make
sure the grand total is 635,013,559,600. (It's an "oops" if
they don't match.)

Next, we will show how to calculate the total hands for a particular distribution (e.g. 5, 3, 3, 2), and then expand this into a general rule, which can be used by a computer program.

In our 5, 3, 3, 2 example, the first suit has 5 cards that will be selected randomly from 13 cards. Thus the number of combinations here is COMBIN( 13, 5) = 1,287 combinations.

The second suit has 3 cards that will be randomly selected from another 13 cards. Thus the number of combinations for it is: COMBIN( 13, 3) = 286.

Similarly suits 3 and 4 contribute COMBIN( 13, 3) = 286, and COMBIN( 13, 2) = 78

The total number of combinations from the four suits is thus 1,287 * 286 * 286 * 78 = 8,211,173,256.

Next we have to consider what part the various suits play. The first suit can be any of the 4 suits in the deck, the second suit can be any of the remaining 3, the third can be either of the remaining 2 suits, and the fourth gets what is left over. The total combinations are thus 24. We multiply the 8,211,173,256 by 24 to get 197,068,158,144. If we were calculating a distribution that had 4 different counts for each suit (e.g. 5, 4, 3, 1), this would be the end of the calculations. Unfortunately, our 5, 3, 3, 2 distribution has two suits that have the same length.

To compensate for double counting using these two suits, we have to divide our prior result of 197,068,158,144 by 2 to get 98,534,079,072. This is what we see in the table output. More specifically, we scan the numbers in the suit distribution. If there are two numbers that are the same, we actually divide by "2 Factorial" ( FACT(2) = 2). If we were calculating 7, 2, 2, 2 distribution, we would note that "2" appears 3 times. Then to adjust for double counting we would have to divide by FACT(3) = 6.

We can now form the general rule for calculating suit distribution combinatorics. Given any distribution A, B, C, D where "A", "B", "C", and "D" represent the number of cards in each suit, we first calculate COMBIN( 13, A) * COMBIN ( 13, B) * COMBIN( 13, C) * COMBIN( 13, D). Next we multiply by 24 for permutations of the four suits. Finally, we scan the numbers "A", "B", "C", "D" to see if any number occurs more than once. For each occasion where a number appears twice we divide by FACT(2) = 2. (In this problem there can't be more than 1 pair of matched numbers, but this could occur in other problems). Then, for each set where 3 numbers match (e.g. if we were using 7, 2, 2, 2) we divide by FACT(3) = 6. (These are the only matched sets that can occur in this problem, but more complicated problems would extend this rule).

We now know how to calculate the number of combinations for any suit distribution. The only thing left to do is generate all possible suit distributions, and apply the above rules. Once again it is time to run a program on our friendly computer.

The general algorithm will be:

Note that suit distributions will be generated in the following order:

13, 0, 0, 0

12, 1, 0, 0

11, 2, 0, 0

11, 1, 1, 0

etc.

as shown in the printout. Also note that the numbers are in descending order on each row. This order plays a part in how the numbers are generated in the computer program.

The actual "C" code would be similar to:

And that's it. (It wasn't that difficult after all)

Return to Bridge Combinatorics main page

Next, we will show how to calculate the total hands for a particular distribution (e.g. 5, 3, 3, 2), and then expand this into a general rule, which can be used by a computer program.

In our 5, 3, 3, 2 example, the first suit has 5 cards that will be selected randomly from 13 cards. Thus the number of combinations here is COMBIN( 13, 5) = 1,287 combinations.

The second suit has 3 cards that will be randomly selected from another 13 cards. Thus the number of combinations for it is: COMBIN( 13, 3) = 286.

Similarly suits 3 and 4 contribute COMBIN( 13, 3) = 286, and COMBIN( 13, 2) = 78

The total number of combinations from the four suits is thus 1,287 * 286 * 286 * 78 = 8,211,173,256.

Next we have to consider what part the various suits play. The first suit can be any of the 4 suits in the deck, the second suit can be any of the remaining 3, the third can be either of the remaining 2 suits, and the fourth gets what is left over. The total combinations are thus 24. We multiply the 8,211,173,256 by 24 to get 197,068,158,144. If we were calculating a distribution that had 4 different counts for each suit (e.g. 5, 4, 3, 1), this would be the end of the calculations. Unfortunately, our 5, 3, 3, 2 distribution has two suits that have the same length.

To compensate for double counting using these two suits, we have to divide our prior result of 197,068,158,144 by 2 to get 98,534,079,072. This is what we see in the table output. More specifically, we scan the numbers in the suit distribution. If there are two numbers that are the same, we actually divide by "2 Factorial" ( FACT(2) = 2). If we were calculating 7, 2, 2, 2 distribution, we would note that "2" appears 3 times. Then to adjust for double counting we would have to divide by FACT(3) = 6.

We can now form the general rule for calculating suit distribution combinatorics. Given any distribution A, B, C, D where "A", "B", "C", and "D" represent the number of cards in each suit, we first calculate COMBIN( 13, A) * COMBIN ( 13, B) * COMBIN( 13, C) * COMBIN( 13, D). Next we multiply by 24 for permutations of the four suits. Finally, we scan the numbers "A", "B", "C", "D" to see if any number occurs more than once. For each occasion where a number appears twice we divide by FACT(2) = 2. (In this problem there can't be more than 1 pair of matched numbers, but this could occur in other problems). Then, for each set where 3 numbers match (e.g. if we were using 7, 2, 2, 2) we divide by FACT(3) = 6. (These are the only matched sets that can occur in this problem, but more complicated problems would extend this rule).

We now know how to calculate the number of combinations for any suit distribution. The only thing left to do is generate all possible suit distributions, and apply the above rules. Once again it is time to run a program on our friendly computer.

The general algorithm will be:

Set up a loop system to
generate all possible suit distributions.

Scan the number of cards in each suit to see if there are duplicate quantities in different suits.

Adjust the "24" suit permutation number if duplicates are found

Calculate all the COMBIN() functions

Print a row of results

Repeat for all possible distributions

Scan the number of cards in each suit to see if there are duplicate quantities in different suits.

Adjust the "24" suit permutation number if duplicates are found

Calculate all the COMBIN() functions

Print a row of results

Repeat for all possible distributions

Note that suit distributions will be generated in the following order:

13, 0, 0, 0

12, 1, 0, 0

11, 2, 0, 0

11, 1, 1, 0

etc.

as shown in the printout. Also note that the numbers are in descending order on each row. This order plays a part in how the numbers are generated in the computer program.

The actual "C" code would be similar to:

/* Print the
column labels for the output table.
*/

/* The first suit can have */

for (Suit1 = 13; Suit1 >= 4; Suit1--) { /* anywhere from 4 to 13 cards. */

/* Suit 2 can have as many as */

for (Suit2 = Suit1; Suit2 >= 0; Suit2--) { /* Suit1, or it could be 0 */

TotCards = Suit 1 + Suit2; /* Total cards so far. */

if (TotCards > 13) /* Can't have more than 13 cards. */

/* If over 13 then not a valid hand. */

continue; /* Skip to next attempt. */

if ((Suit1 + 3 * Suit2 ) < 13) /* Same if the remaining suits */

/* can't get to 13 cards. */

break; /* Use to jump out of inner loop. */

for (Suit3 = Suit2; Suit3 >= 0; Suit3--) { /* Loop for the 3rd suit */

TotCards = Suit1 + Suit2 + Suit3; /* Total cards in first 3 suits */

Suit4 = 13 - TotCards; /* Suit 4 gets what's left */

if ((Suit4 < 0) || (Suit4 > Suit3) ) /* For suit 4 to be valid */

continue; /* it must be >= 0 and <= suit 3. */

/* If to here, suit counts are OK */

/* Next, scan to see if suit counts */

for (i = 0; i <= 13; i++) /* have any duplicates. First */

Count[i] = 0; /* clear out any old garbage. */

Count[Suit1]++; /* Increment the count for the nbr */

Count[Suit2]++; /* of cards in each of the four */

Count[Suit3]++; /* suits. */

Count[Suit4]++;

/* Initialize the suit permutation */

SuitComb = 24; /* multiplier. Will check for */

for (i = 0; i <= 6; i++) { /* duplicate quantities up through */

if (Count[i] > 1) /* 6, 6, 1, 0 distribution. */

SuitComb /= FACT(Count[i]); /* Adjust for permutations of */

} /* identical counts */

/* Here comes the big COMBIN() calc */

SuitComb *= COMBIN( 13, Suit1) * COMBIN( 13, Suit2)

* COMBIN( 13, Suit3)* COMBIN( 13, Suit4);

CalcTot += SuitComb; /* This must = COMBIN( 52, 13) */

/* Print a row in the output table. */

/* The format is left to the reader */

printf(" %2d, %2d, %2d, %2d %20lf %g\n",

Suit1, Suit2, Suit3, Suit4, SuitComb, SuitComb/635013559600.0);

} /* End of Suit3 loop */

} /* End of Suit2 loop */

} /* End of Suit1 loop */

/* The first suit can have */

for (Suit1 = 13; Suit1 >= 4; Suit1--) { /* anywhere from 4 to 13 cards. */

/* Suit 2 can have as many as */

for (Suit2 = Suit1; Suit2 >= 0; Suit2--) { /* Suit1, or it could be 0 */

TotCards = Suit 1 + Suit2; /* Total cards so far. */

if (TotCards > 13) /* Can't have more than 13 cards. */

/* If over 13 then not a valid hand. */

continue; /* Skip to next attempt. */

if ((Suit1 + 3 * Suit2 ) < 13) /* Same if the remaining suits */

/* can't get to 13 cards. */

break; /* Use to jump out of inner loop. */

for (Suit3 = Suit2; Suit3 >= 0; Suit3--) { /* Loop for the 3rd suit */

TotCards = Suit1 + Suit2 + Suit3; /* Total cards in first 3 suits */

Suit4 = 13 - TotCards; /* Suit 4 gets what's left */

if ((Suit4 < 0) || (Suit4 > Suit3) ) /* For suit 4 to be valid */

continue; /* it must be >= 0 and <= suit 3. */

/* If to here, suit counts are OK */

/* Next, scan to see if suit counts */

for (i = 0; i <= 13; i++) /* have any duplicates. First */

Count[i] = 0; /* clear out any old garbage. */

Count[Suit1]++; /* Increment the count for the nbr */

Count[Suit2]++; /* of cards in each of the four */

Count[Suit3]++; /* suits. */

Count[Suit4]++;

/* Initialize the suit permutation */

SuitComb = 24; /* multiplier. Will check for */

for (i = 0; i <= 6; i++) { /* duplicate quantities up through */

if (Count[i] > 1) /* 6, 6, 1, 0 distribution. */

SuitComb /= FACT(Count[i]); /* Adjust for permutations of */

} /* identical counts */

/* Here comes the big COMBIN() calc */

SuitComb *= COMBIN( 13, Suit1) * COMBIN( 13, Suit2)

* COMBIN( 13, Suit3)* COMBIN( 13, Suit4);

CalcTot += SuitComb; /* This must = COMBIN( 52, 13) */

/* Print a row in the output table. */

/* The format is left to the reader */

printf(" %2d, %2d, %2d, %2d %20lf %g\n",

Suit1, Suit2, Suit3, Suit4, SuitComb, SuitComb/635013559600.0);

} /* End of Suit3 loop */

} /* End of Suit2 loop */

} /* End of Suit1 loop */

And that's it. (It wasn't that difficult after all)

Return to Bridge Combinatorics main page

Web page generated via Sea Monkey's Composer HTML editor

within a Linux Cinnamon Mint 18 operating system.

(Goodbye Microsoft)