 ## Overview - possible shuffles in the game of blackjack

In determining the possible ways a deck of cards can be dealt, there are 2 terms that we need to familiarize ourselves with: permutations, which take into consideration the order in which the cards can be arranged and combinations, which count any equivalent permutations only once. In order to illustrate the difference, let's create a very simple deck. Let this deck consist of only 3 cards - the K of spades, the Q of hearts, and the ace of diamonds. The number of permutations of this deck is equal to 6. How is this figure computed? We want to know all of unique orders the deck can be arranged in. If we randomly deal 1 card, there will be 3 possiblities, with 2 cards left. Therefore, for the second card, we will have 2 remaining possiblities. After dealing the second card, there will be only 1 remaining possibility. The number of permutations of a 3 card deck = (1st card possibilities times 2nd card possiblities times 3rd card possiblities) = 3*2*1 = 6. 3*2*1 is also known in mathematics as 3 factorial and is denoted 3!. In general for any number, n, the factorial of n = n*(n-1)*(n-2)*.......*1 and is denoted n!. For a deck containing n cards, the number of permutations is n!. For our sample 3 card deck the permutations are -

```     K of spades, Q of hearts, ace of diamonds
Q of hearts, K of spades, ace of diamonds
K of spades, ace of diamonds, Q of hearts
Q of hearts, ace of diamonds, K of spades
ace of diamonds, K of spades, Q of hearts
ace of diamonds, Q of hearts, K of spades
```

Now in blackjack, any picture card or ten are equivalent and known as ten value cards. Similarly any 2 cards of the same rank of 1 to 9 are equivalent, regardless of suit. Therefore, in our simple sample deck the K of spades is equivalent to the Q of hearts when it comes to evaluating our blackjack hand. Let's now just call any ten value card T. Any other card is simply known as its rank. K of spades is now known as T. Q of hearts is also known as T. Ace of diamonds is known as 1. We can now rewrite our permutations as -

```     T,T,1
T,T,1
T,1,T
T,1,T
1,T,T
1,T,T
```

As can be seen, there are 3 duplicates. When we count the number of equivalent permutations only once, we arrive at the number of combinations, which = 3 -

```     T,T,1
T,1,T
1,T,T
```

In order to show in general how to mathematically compute combinations, let's define r1,r2,r3,r4,r5,r6,r7,r8,r9,r10 as the number of cards of each rank, 1 to 10 respectively, present in an n-card deck. What needs to be done is to count the equivalent permutations of each rank only once, so we need to divide overall permutations by the permutations of each rank.

```So,
n = r1+r2+r3+r4+r5+r6+r7+r8+r9+r10 = total number cards in deck
and combinations = n!/r1!/r2!/r3!/r4!/r5!/r6!/r7!/r8!/r9!r10!
```

In other words, combinations = overall permutations / (product of permutations of each individual rank)

For our simple sample deck, there are only 2 ranks, which are tens and aces. The sample deck consists of 3 cards, 2 tens (r10 = 2) and 1 ace (r1 = 1). (r2 through r9 = 0 for the sample deck.) (Note: 0! = 1). Number of cards in the deck = n = (r10 + r1) = (2 + 1) = 3.

```Then sample deck combinations = n!/r10!/r1! = 3!/2!/1! = 3, which agrees with what was enumerated above.
```

Permutations and combinations for a deck consisting of a larger number of cards can be computed similarly to the above.

### Calculations for Permutations and Combinations for 1, 2, 4, 6 and 8 Decks

```1 Deck
Permutations = 52! = 80658175170943878571660636856403766975289505440883277824000000000000
Combinations = 52! / 16! / (4!)9 = 1459243014608741105832394919396033250000000

2 Decks
Permutations = 104! = 1029901674514562762384858386476504428305377245499907218232549177688
78717324752871745427098716838880032359657041416383776951797419791755887247360000000000000
00000000000
Combinations = 104! / 32! / (8!)9 = 13897583953886915916997900322245344374849047779518415
9840824494092122906083362574050000000

4 Decks
Permutations = 208! = 2411110054505276003287178952912926704433581813332627467813915186196
04665145591729660171722514729263966207029657274760829969835101821556548304978870053886400
52306652374956662431346578728511998192426952799840738395468599367902864086948340760688370
74389966872402587064994175352412260139989828878606080923918312486045985724785755863845341
313263206400000000000000000000000000000000000000000000000000
Combinations = 208! / 64! / (16!)9 = 2472998157208866354450720400155283825622865530393258
48132030129489994280849358616244628801207185437515347538030953939073882672085215170734992
98080253794507267201704693795255873250000000

6 Decks
Permutations = 312! = 2102026605126378359351726442119571336270439087200001675367568427286
09276364870071276018632900069284700768301037938261101173961429020590768649673393745350229
36690092972301923774700873772562272674368133181717739831631059892909964095214693918474656
12154342185804767122091647298402187106111419976085560815171141519780785296496757561986779
00973955961088376590768187445187161362720223207506081889280736666374823205851569546732513
46895141199174102965934176251218472530679076992406435225076777327533824767842538455816588
02968389893608764519831912027260955166847768302659934617600000000000000000000000000000000
00000000000000000000000000000000000000000000
Combinations = 312! / 96! / (24!)9 = 1555666597724897046676164210446162756169596852699926
95965585504448949703356721152582664792503202537227671453353435394106973891524702701707241
13933586546200511905549741197226672460494178663440379599088237255909004822898324928866448
390941084378606536318858201682937250000000000000000

8 Decks
Permutations = 416! = 3846313387719957490284353898010643560199216596359526228022425377205
12168301195873760118719511414554948435129744393655570464187000076757247253645283740974262
74437336984117135035840319087095437432094931902980202366306154424773842047575571737037805
74037536278167272351094733275992479962339425829499919055259392377995327738292812192608079
02019560109800365129020080363185630186705031752082868506976217634974657594385726512620596
91891197462920180710682630787009442262814745990335735810444461475006571643055395889497608
86333876372658861525464613576512724191723554849747020074650703089398941014574527094723629
02565773988248631643367759320677558837342635036690741032958377662109483425545346837981662
00789864427317910523544907487561256292196310045039490997277577283556051331131237311106789
49173968426310376742445278822400000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
Combinations = 416! / 128! / (32!)9 = 164944883791287598411943116655903865118824068362983
91400708734708401382919636468084661486566745902296465035586771465207429168259672683143739
75466950565603555407467056375622405011557765675647850225222197042321115950112214580088940
65762070053057540438153207938737327767112605303189053871399047436327387252956448398946650
68189311105518354942178373831442020424406884197134050000000
```

### What can this information be used for?

The number of equivalent ways a deck can be shuffled for a game of blackjack is given by the Combinations figure in the above. As you can see, there are an awful lot of possibilities. One use of this information is to give some context to a blackjack computer simulation. A billion round sim simulates far less than a billion shuffles and even a billion shuffles is a very small portion of the possible shuffles. Therefore, we may ask, "What is the statistical significance of a computer sim?" or "What does a specific computer simulation program do to ensure that it produces statistically significant results given the number of possibilities that exists?" It can be noted that each shuffle resets the shoe to its full state so the starting point for each shoe that is simmed is repeated. At the start of a freshly shuffled shoe there is just one possible shoe consistency. After the first round is dealt from a randomly shuffled shoe there are relatively few combinations possible for the dealt cards and therefore relatively few consistencies for the cards remaining to be dealt. As more cards are dealt more combinations become possible. The maximum number of possible combinations for dealt/undealt cards occurs exactly at mid-shoe so that is where the maximum number of possible shoe consistencies occurs, after which the number of possible combinations starts to decrease. When there are only a few cards remaining to be dealt there are relatively few possible shoe consistencies. Therefore the beginning and end of a shoe would be the portions of a shoe that would be less variable relative to shoe composition than the middle of the shoe in a simulation. This would be true for any number of decks and would be more pronounced as number of decks increases. It can also be noted that any given shoe consistency (shoe composition) could be computed exactly by combinatorial analysis. This would require more computing time (for each trial) than simulating by employing a "brute force" number of trials but would require far less trials. The smaller the number of possible shoe consistencies is, the more accurate the result of simulating in conjunction with combinatorial analysis would be. At the beginning of a shoe there is exactly one shoe composition so in that case combinatorial analysis is 100% accurate. After 1 round is simmed there are more than 1 shoe compositions possible but there still aren't that many so a relatively small number of trials would be highly accurate, (although not 100% as in the case of a full shoe.) As more rounds are simmed accuracy decreases but at least a trend may be evident from the more accurate earlier rounds. Also, another consideration is that as number of cards dwindles, there is a possiblity of running out of cards.

Beyond that, it seems that the number of possible shuffles is just something to know and keep in mind.