◍ Hidden Spheres · the atlas · exhibit nº14

The Ghost in the Deck

A new deck comes out of the box in perfect order. Riffle it once and the order is not gone, it is braided: two long runs of the old deck, threaded through each other, and anyone who knows how to look can still read them. Riffle again and the ghost splits into four, then eight. Somewhere around the seventh shuffle it is finally too faint to see, and the thing in your hands becomes something the world has never held before.

keys: r · 7 · n

For the curious kid.

How many ways can fifty-two cards be arranged? Fifty-two choices for the first card, fifty-one for the next, fifty for the next… multiply all the way down and you get a number with sixty-eight digits: about 80,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000. That is far, far more than the number of grains of sand on Earth, or stars in the sky, or atoms in our whole galaxy. So here is a strange, true thing. Suppose every person who ever lived had shuffled a deck once a second, all day, every day, for their entire lives. All of humanity, all of history: that is roughly a hundred billion people, and it comes to something like 1020 shuffles. The chance that any of those decks matched the one you just shuffled is about one in 1047. Your shuffled deck is not merely rare. It is, almost certainly, brand new to the universe.

But only if you really shuffled it. Look at the deck above after one riffle: the colors still flow from blue to gold, twice, woven together. The gold threads connect cards that are still standing in their old order: the ghost of the fresh deck. A card magician can read that ghost. Each riffle cuts it in half again: two runs, four, eight, sixteen… After seven, the runs are so short and so many that the ghost has nothing left to say. That is why card players who know the mathematics shuffle seven times.

Deeper.

The shuffle here is the Gilbert, Shannon and Reeds model, the standard mathematical riffle: cut the deck at a binomial point (a fair coin per card decides which packet it joins), then drop cards from the two packets with probability proportional to the packet's size. The arrangement it produces is exactly as likely as any of the 252 cut-and-interleave patterns, a good model of a competent human riffle, though real hands clump cards and cut unevenly, which only makes the ghost more persistent, never less.

In 1992 Dave Bayer and Persi Diaconis found something remarkable: after k riffles, the probability of ending at a given arrangement depends on just one number: how many rising sequences it has, the runs of the original order that survive, drawn above as threads. The formula is short enough to fit on a card: an arrangement with r rising sequences has probability C(2k+52−r, 52) / 252k. One riffle can make at most two rising sequences; k riffles at most 2k. That is the whole ghost: a deck with only eight rising sequences cannot possibly be random, and it takes until 2k comfortably exceeds fifty-two for the count of runs to look like that of a truly random deck (about twenty-six).

From the formula you can compute exactly how far from random the deck is after each shuffle: the total variation distance, the gold curve at lower left. It barely moves for four shuffles (1.000, 1.000, 1.000, 1.000), then collapses: 0.924, 0.614, 0.334, 0.167, 0.085, halving with every riffle thereafter. Randomness doesn't arrive gradually; it arrives all at once around the seventh shuffle: a cutoff, and the discovery that made the front page of the New York Times in 1990 under the headline "In Shuffling Cards, 7 Is Winning Number." Diaconis, who ran away from home at fourteen to travel with the magician Dai Vernon, had spent his teens exploiting precisely this ghost; the trick of finding a chosen card after three riffles by spotting the one card that breaks the rising sequences is a century old (Charles Jordan sold it by mail in 1916).

Honesty notes, museum policy. Every curve on this page is computed from the Bayer and Diaconis formula, never fitted; the histogram at lower right is two thousand fresh decks shuffled in your browser as many times as yours, with the exact law drawn over the bars in blue. Seven is a yardstick, not a law: total variation is the strictest common measure, and for some games far fewer shuffles suffice, while other measures ask for eleven or more. Even after seven riffles the untouched original order is still about ten thousand times likelier than a typical arrangement: the ghost never quite dies, it just falls below any hope of noticing. The "never held before" claim is probabilistic, and its odds are stated above exactly as computed.

Every honest shuffle is a small act of creation. You are holding something that did not exist, and will not exist again.