How a magician-mathematician revealed a casino loophole

To rigorously study riffle shuffles, Diaconis used a powerful mathematical tool called the Markov chain.

“A Markov chain is any repeated action where the outcome depends only on the current state and not on how that state was reached,” explains Sami Hayes Assaf, a mathematician at the University of Southern California. This means that Markov chains have no “memory” of what came before. This is a pretty good model for shuffling cards, says Assaf. The result of the seventh shuffle depends only on the order of the cards after the sixth shuffle, not on how the deck was shuffled the five times before.

Markov chains are widely used in statistics and computer science to process sequences of random events, be they shuffling cards, vibrating atoms, or fluctuations in stock prices. In any case, the future “state”—the deck order, the energy of an atom, the value of a stock—depends only on what happens now, not what happened before.

Despite their simplicity, Markov chains can be used to make predictions about the probability of certain events after many iterations. Google’s PageRank algorithm, which ranks websites in their search engine results, is based on a Markov chain that models the behavior of billions of internet users who randomly click web links.

Working with Dave Bayer, a mathematician at Columbia University in New York, Diaconis showed that the Markov chain describing riffle shuffles has a sharp transition from ordered to random after seven shuffles. This behavior, known among mathematicians as the cut-off phenomenon, is a common feature of mixing problems. Think about stirring cream into coffee: as you stir, the cream forms thin white streaks in the black coffee before suddenly and irrevocably mixing.

Knowing which side of the cutoff a deck is on – whether it’s shuffled correctly or whether it still retains a memory of its original order – gives players a distinct advantage over the house.

In the 1990s, a group of students at Harvard and MIT managed to beat the odds at blackjack games in US casinos by using card counting and other methods to determine if the deck was shuffled correctly. Casinos responded by introducing more sophisticated card shuffling machines, shuffling the deck before it was fully played, and increasing player surveillance. But it’s still rare for a deck to be machine shuffled seven times in a casino.

Casino executives may not have paid much attention to Diaconis and his research, but he continues to have a tremendous impact on mathematicians, statisticians, and computer scientists who study chance. At a conference held in Stanford in January 2020 to mark Diaconis’ 75th birthday, colleagues from around the world gave talks on the mathematics of genetic classification, how cereal settles in a shaker box, and of course, shuffling cards.

Diaconis doesn’t believe in gambling himself – he says there are better and more interesting ways to make a living. But he frowns on players trying to gain an advantage by using their brains.

“Thinking is not cheating,” he says. “Thinking is thinking.”

* Shane Keating is a science writer and sSenior Lecturer in Mathematics and Oceanography at the University of New South Wales, Sydney

Join a million Future fans by liking us Facebookor continue to follow us Twitter or Instagram.

If you liked this story, Sign up for the weekly bbc.com features newsletterdubbed ‘The Essential List’ – a hand-picked selection of stories from the BBC future, Culture, work life, Travel and Kitchen sink Delivered to your inbox every Friday.

Leave a Reply

Your email address will not be published. Required fields are marked *