Gilbert–Shannon–Reeds model

From HandWiki

In the mathematics of shuffling playing cards, the Gilbert–Shannon–Reeds model is a probability distribution on riffle shuffle permutations that has been reported to be a good match for experimentally observed outcomes of human shuffling,[1] and that forms the basis for a recommendation that a deck of cards should be riffled seven times in order to thoroughly randomize it.[2] It is named after the work of Edgar Gilbert, Claude Shannon, and J. Reeds, reported in a 1955 technical report by Gilbert[3] and in a 1981 unpublished manuscript of Reeds.

The model

A riffle shuffle permutation of a sequence of elements is obtained by partitioning the elements into two contiguous subsequences, and then arbitrarily interleaving the two subsequences. For instance, this describes many common ways of shuffling a deck of playing cards, by cutting the deck into two piles of cards that are then riffled together. The Gilbert–Shannon–Reeds model assigns a probability to each of these permutations. In this way, it describes the probability of obtaining each permutation, when a shuffle is performed at random. The model may be defined in several equivalent ways, describing alternative ways of performing this random shuffle:

  • Most similarly to the way humans shuffle cards, the Gilbert–Shannon–Reeds model describes the probabilities obtained from a certain mathematical model of randomly cutting and then riffling a deck of cards. First, the deck is cut into two packets. If there are a total of [math]\displaystyle{ n }[/math] cards, then the probability of selecting [math]\displaystyle{ k }[/math] cards in the first deck and [math]\displaystyle{ n-k }[/math] in the second deck is defined as [math]\displaystyle{ \tbinom{n}{k}/2^n }[/math]. Then, one card at a time is repeatedly moved from the bottom of one of the packets to the top of the shuffled deck, such that if [math]\displaystyle{ x }[/math] cards remain in one packet and [math]\displaystyle{ y }[/math] cards remain in the other packet, then the probability of choosing a card from the first packet is [math]\displaystyle{ x/(x+y) }[/math] and the probability of choosing a card from the second packet is [math]\displaystyle{ y/(x+y) }[/math].[2]
  • A second, alternative description can be based on a property of the model, that it generates a permutation of the initial deck in which each card is equally likely to have come from the first or the second packet.[2] To generate a random permutation according to this model, begin by flipping a fair coin [math]\displaystyle{ n }[/math] times, to determine for each position of the shuffled deck whether it comes from the first packet or the second packet. Then split into two packets whose sizes are the number of tails and the number of heads flipped, and use the same coin flip sequence to determine from which packet to pull each card of the shuffled deck.
  • A third alternative description is more abstract, but lends itself better to mathematical analysis. Generate a set of [math]\displaystyle{ n }[/math] values from the uniform continuous distribution on the unit interval, and place them in sorted order. Then the doubling map [math]\displaystyle{ x\mapsto 2x\pmod{1} }[/math] from the theory of dynamical systems maps this system of points to a permutation of the points in which the permuted ordering obeys the Gilbert–Shannon–Reeds model, and the positions of the new points are again uniformly random.[2][4]

Among all of the possible riffle shuffle permutations of a card deck, the Gilbert–Shannon–Reeds model gives almost all riffles equal probability, [math]\displaystyle{ 1/2^n }[/math], of occurring. However, there is one exception, the identity permutation, which has a greater probability [math]\displaystyle{ (n+1)/2^n }[/math] of occurring.[5]


The inverse permutation of a random riffle may be generated directly. To do so, start with a deck of n cards and then repeatedly deal off the bottom card of the deck onto one of two piles, choosing randomly with equal probability which of the two piles to deal each card onto. Then, when all cards have been dealt, stack the two piles back together.[2]

The effect of repeated riffles

(Bayer Diaconis) analyzed mathematically the total variation distance between two probability distributions on permutations: the uniform distribution in which all permutations are equally likely, and the distribution generated by repeated applications of the Gilbert–Shannon–Reeds model. The total variation distance measures how similar or dissimilar two probability distributions are; it is zero only when the two distributions are identical, and attains a maximum value of one for probability distributions that never generate the same values as each other. Bayer and Diaconis reported that, for decks of n cards shuffled [math]\displaystyle{ \tfrac{3}{2}\log_2 n+\theta }[/math] times, where θ is an arbitrary constant, the total variation distance is close to one when θ is significantly less than zero, and close to zero when θ is significantly greater than zero, independently of n. In particular their calculations showed that for n = 52, five riffles produce a distribution whose total variation distance from uniform is still close to one, while seven riffles give total variation distance 0.334. This result was widely reported as implying that card decks should be riffled seven times in order to thoroughly randomize them.[6][7][8]

Similar analyses have been performed using the Kullback–Leibler divergence, a distance between two probability distributions defined in terms of entropy; the divergence of a distribution from uniform can be interpreted as the number of bits of information that can still be recovered about the initial state of the card deck. The results are qualitatively different: rather than having a sharp threshold between random and non-random at [math]\displaystyle{ \tfrac{3}{2}\log_2 n }[/math] shuffles, as occurs for total variation distance, the divergence decays more gradually, decreasing linearly as the number of shuffles ranges from zero to [math]\displaystyle{ \log_2 n }[/math] (at which point the number of remaining bits of information is linear, smaller by a logarithmic factor than its initial value) and then decreasing exponentially until, after [math]\displaystyle{ \tfrac{3}{2}\log_2 n }[/math] shuffles, only a constant number of bits of information remain.[9][10]


  1. Group representations in probability and statistics, Institute of Mathematical Statistics Lecture Notes—Monograph Series, 11, Hayward, California: Institute of Mathematical Statistics, 1988, ISBN 978-0-940600-14-0 .
  2. 2.0 2.1 2.2 2.3 2.4 "Trailing the dovetail shuffle to its lair", The Annals of Applied Probability 2 (2): 294–313, 1992, doi:10.1214/aoap/1177005705, .
  3. Gilbert, E. (1955), Theory of shuffling, Technical memorandum, Bell Labs 
  4. Lalley, Steven P. (1999), "Riffle shuffles and their associated dynamical systems", Journal of Theoretical Probability 12 (4): 903–932, doi:10.1023/A:1021636902356 .
  5. This follows immediately from Theorem 1 of (Bayer Diaconis) together with the observation that the identity permutation has one rising sequence and all other riffle permutations have exactly two rising sequences. (Lalley 1999) instead states erroneously that all permutations are likely.
  6. Austin, David (December 2010), How Many Times Do I Have to Shuffle This Deck?, AMS Feature Columns, .
  7. Numb3rs 519: Animal Rites, Numb3rs Math Activities, Cornell University Department of Mathematics, .
  8. Kolata, Gina (January 9, 1990), "In Shuffling Cards, 7 Is Winning Number", New York Times, .
  9. "How many shuffles to randomize a deck of cards?", Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 456 (2002): 2561–2568, 2000, doi:10.1098/rspa.2000.0625, Bibcode2000RSPSA.456.2561T .
  10. Stark, Dudley; Ganesh, A.; O'Connell, Neil (2002), "Information loss in riffle shuffling", Combinatorics, Probability and Computing 11 (1): 79–95, doi:10.1017/S0963548301004990 .