Main menu


How a magician-mathematician uncovered a casino loophole

featured image

Diaconis used a powerful mathematical tool called the Markov chain to meticulously study riffle shuffles.

“A Markov chain is any repeated action in which the outcome depends only on the current state, 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. Assaf says this is a pretty good model for shuffling cards. The result of the seventh shuffle depends only on the order of the cards after the sixth shuffle, not how the deck was shuffled five times before that.

Markov chains are widely used in statistics and computer science to process random sequences of events, whether it’s card shuffling, vibrating atoms, or stock price fluctuations. In any case, the future “state” – the layout of the deck, the energy of an atom, the value of a stock – depends only on what is 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 search engine results, is based on a Markov chain that models the behavior of billions of internet users randomly clicking on web links.

Working with Dave Bayer, a mathematician at Columbia University in New York, Diaconis showed that the Markov chain that describes riffle shuffles shows a sharp transition from order to random after seven shuffles. Known to mathematicians as a truncation phenomenon, this behavior is a common feature of problems involving mixing. Consider mixing the cream into the coffee: As you mix, the cream forms thin white streaks before suddenly and irreversibly mixing in the black coffee.

Knowing which side of a deck of cards is on the cut—whether it has been shuffled properly or still retains some of its original layout—give gamblers a distinct advantage over the house.

In the 1990s, a group of students at Harvard and MIT were able to beat the odds of playing blackjack in casinos in the US using card counting and other methods of detecting whether the deck was shuffled properly. Casinos have responded by offering more sophisticated card shuffling machines and shuffling the deck before it is fully played, as well as increasing player surveillance. However, it is still rare to see a deck of cards shuffled by the machine the required seven times in a casino.

Casino managers may not have paid much attention to Diaconis and his research, but he continues to have a tremendous influence on mathematicians, statisticians and computer scientists working on randomness. At a conference held at Stanford to honor Diaconis’ 75th birthday in January 2020, colleagues from around the world gave talks about the math of genetic classification, how grains fit into the shake box, and of course, shuffling cards.

Diaconis doesn’t care much about gambling – he says there are better and more interesting ways to make a living. However, he does not shy away from 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 andSenior lecturer in mathematics and oceanography at the University of New South Wales, Sydney

Join one million Future fans by liking us Facebookor follow us excitement or Instagram.

If you liked this story, Sign up for the weekly features newsletterSo-called “Basic List” – carefully selected stories from the BBC The future, Culture, Business life, Travel and pulley Delivered to your inbox every Friday.