Mathwords logoMathwords

Riffle Shuffle — Definition, Formula & Example

A riffle shuffle is the familiar way of shuffling cards: you cut the deck into two packets and let the cards drop back together, interleaved. The Gilbert-Shannon-Reeds (GSR) model turns this into an exact probability rule, so you can calculate how random a deck is after a given number of shuffles.

In the GSR model of a deck of nn cards, cut off the top kk cards with probability (nk)/2n\binom{n}{k}/2^n. Then drop cards one at a time from the bottoms of the packets. If the packets currently hold AA and BB cards, the next card comes from the first packet with probability AA+B\frac{A}{A+B}. As a result, each of the 2n2^n pairs (cut, interleaving) is equally likely. A single GSR shuffle produces only permutations with at most 2 rising sequences, which are maximal runs of consecutive values i,i+1,…i, i+1, \dots that appear left to right in the deck.

Key Formula

Pm(π)=(2m+n−rn)2mnP_m(\pi) = \frac{\dbinom{2^m + n - r}{n}}{2^{mn}}
Where:
  • Pm(π)P_m(\pi) = Probability that the deck is in arrangement π\pi after mm GSR shuffles of a deck that starts in order
  • nn = Number of cards in the deck
  • mm = Number of riffle shuffles performed
  • rr = Number of rising sequences in π\pi

Worked Example

Problem: A 4-card deck starts in order 1, 2, 3, 4. After one GSR riffle shuffle, what is the probability that the deck reads 3, 1, 4, 2? How does that compare with the probability that the deck is still in order 1, 2, 3, 4?
Step 1: Count the rising sequences in 3, 1, 4, 2. Card 2 sits to the right of card 1, so 1, 2 is one run. Card 3 sits to the left of card 2, so a new run starts at 3, and card 4 lies to its right. That gives two runs, {1, 2} and {3, 4}. This is a cut into 1, 2 | 3, 4 followed by an interleaving.
r=2r = 2
Step 2: Apply the formula with n=4n = 4, m=1m = 1, r=2r = 2.
P1=(2+4−24)24=(44)16=116P_1 = \frac{\binom{2 + 4 - 2}{4}}{2^{4}} = \frac{\binom{4}{4}}{16} = \frac{1}{16}
Step 3: The ordered deck has one rising sequence, r=1r = 1. Many different cuts can each drop back into the original order, so this arrangement is the most likely. By contrast, 4, 3, 2, 1 has r=4r = 4 and probability (24)/16=0\binom{2}{4}/16 = 0.
P1(identity)=(54)16=516P_1(\text{identity}) = \frac{\binom{5}{4}}{16} = \frac{5}{16}
Answer: The probability of 3, 1, 4, 2 is 116\frac{1}{16}. The probability that the deck stays in order is 516\frac{5}{16}, five times larger and far above the uniform value 124\frac{1}{24}. One shuffle is nowhere near random.

Why It Matters

Bayer and Diaconis (1992) used this formula to show that a 52-card deck stays far from random until about 7 riffle shuffles. After that, the total variation distance to uniform drops off sharply. The result is a standard example of the cutoff phenomenon in Markov chain mixing times. It is the standard reference point for anyone who tests whether a shuffling procedure is fair.

Common Mistakes

Mistake: Assuming one riffle shuffle can produce any arrangement of the deck.
Correction: One shuffle reaches only permutations with at most 2 rising sequences. That is 2n−n2^n - n orders, or just 12 of the 24 orders for 4 cards. For 52 cards, 252−522^{52} - 52 is tiny compared with 52!52!, so you need repeated shuffles.

Related Terms