Understanding How to Win

The mathematics of card shuffling is not just of interest to inveterate gamblers. It also has important applications in the sciences.

You are the dealer. You know that the top five cards are the ace, king, queen, jack and ten of spades. If you are playing poker with three other people, how can you deal these cards to yourself?

The most elegant way is to do two perfect shuffles. A perfect shuffle – when the pack is cut exactly in half and the cards are then dropped one at a time from alternate sides until the two halves are interleaved evenly – is the crooked gambler’s dream. After one perfect shuffle, the five cards previously at the top of the deck will now be every second card; after two such shuffles, they will be every fourth card.

However, you must remember to do what magicians call “inshuffles”. That is, if you cut the cards and pick up the top half of the pack in your right hand, you must start dropping the cards from the right-hand side. This way, the top card will become the second card, and then the fourth. If you make a mistake and do “outshuffles”, starting instead from the left-hand side, the top card will stay on top, and you will deal the royal flush to the person lucky enough to be sitting to your left.

Perfect shuffles are one way to manipulate cards: to move the ace of spades from the top card to the 13th takes two inshuffles followed by two outshuffles. There is an intriguingly simple procedure for working out the necessary manipulations. Write down the places by which you would like the ace to move – in this case, 12. Then, write the number in its binary format (that is, using only 0s and 1s): for 12, this is 1100. This tells you how to shuffle: inshuffles are represented by 1s, outshuffles by 0s.

Even better, after eight outshuffles in a row the pack returns to the order it started off in (it takes 52 inshuffles to achieve the same result). Strangely, this rule only applies for a pack of 52 cards. The cyclical behaviour of a pack of 48 cards (used for games such as bezique and pinochle) or of 104 cards is different. Moreover, it cannot be predicted using any mathematical formula. Although this sounds like a simple problem, it is in fact an example of a deeply puzzling question in number theory.

The number of outshuffles required to restore any pack of cards to its original order does obey a simple rule. The problem is that one of the variables in the rule cannot be known in advance. So the only way to work out the number of perfect shuffles needed to return a pack to its original order is to do them. There is an exception: when the number of cards in a pack is exactly equal to two raised to the power of a whole number (that is, if the pack has 4, 8, 16, or 32 cards, and so on). Then, the number of outshuffles is the same as the exponent: for a pack of four cards it takes two outshuffles, for a pack of 32 cards it takes five.

More generally, it turns out that the number of outshuffles needed to get a pack back to its starting point is the smallest power of two – call it x such that two raised to the power of x and then divided by a figure that is one less than the number of cards in the pack leaves a remainder of one. For example, in the case of 52 cards, the number of outshuffles needed is eight (28 equals 256, and 256 divided by 51 has a remainder of one). But for all pack sizes that are not powers of two, x cannot be calculated, and the number of outshuffles required to return the cards to their original order cannot be worked out.

The behaviour of perfect shuffles is not just of interest to magicians and card sharps. Engineers and physicists sometimes refer to “perfect-shuffle networks” – networks that look as if they are busily engaged in perfect shuffles. For example, if a parallel computer network consists of an array of simple processors acting in tandem, the way that it manipulates numbers looks remarkably like a pack of cards being shuffled perfectly over and over again.

Mixing It

Fortunately for honest card players, few people are capable of doing even one perfect shuffle; perhaps only 30 people in the world can reliably do eight in under a minute (the sort of speed necessary for it not to be obvious that something peculiar is going on). So when most people shuffle a deck, they mix up the cards. But how long does it take before the deck is really mixed?

For mathematicians and statisticians, a pack of cards is randomly mixed when every card is equally likely to be at all positions in the deck. (A pack of 52 cards has 52-factorial possible arrangements, or 52 multiplied by 51 multiplied by 50 …and so on all the way down to one. This is a large number: 8.065 times 1067.)

According to Persi Diaconis, a magician-turned-mathematician at Harvard University (but currently visiting Cornell), shuffling with “riffle” shuffles – that is, cutting the pack and then dropping cards from each side, but not interleaving them perfectly – is highly effective at mixing up cards. After seven shuffles, the pack is close to being random. In contrast, shuffling overhand – that is, dropping little clumps of cards on to the back of the pack – is ridiculously ineffective. The pack will not be random until the procedure has been repeated 2,500 times.

Moreover, Dr Diaconis (who can do eight perfect shuffles in a row) and his colleagues – Laurent Saloff-Coste, David Bayer, Ron Graham (who also works on the mathematics of juggling) and William Kantor – have recently discovered an even more bizarre phenomenon: in some systems, the switch to randomness is abrupt. In other words, after six riffle shuffles, a pack is still visibly ordered. But after the seventh, it suddenly becomes random.

The presence of this cut-off turns out to be important. Card shuffling, when imperfect, is a good example of something called a “Markov chain”. This is a random process in which the future depends only on the present, not on the past. For instance, what a shuffle does to a pack of cards depends only on the order they are in before that shuffle, not on how they got to be in that order. Or think of a drunkard staggering about. His next step depends only on where he is now, not on where he came from.

But at the start of a random process, it takes a while before a system actually becomes random. When the drunkard first sets off from the pub, he is not immediately likely to be anywhere between the pub and his house: he will be close to the pub. Likewise with card shuffling. Buy a new pack of cards, and it obviously takes a bit of shuffling before the cards are mixed up.

With the advent of powerful computers, which make big random simulations much easier, Markov chains have become popular in fields from statistics to biology. Most simulations start at some fixed position, but eventually reach an equilibrium state of randomness. But it is often important to know how long this takes. Otherwise, the results of the model may be affected by the state that the system started out in. In the case of a pack of cards, without enough shuffles (particularly if shuffling overhand) the current order will still partly depend on the original one.

Mathematicians have long been able to predict how close a system is to being random after a large number of steps – for example, how likely the drunk is to be anywhere after he has taken lm steps, or how likely a pack of cards is to be mixed after 20,000 shuffles. But this says nothing about how long it takes to become random from a fixed starting point.

This is where the cut-off comes in. Dr Diaconis and his colleagues have worked out methods for identifying which systems have such sudden breaks – these can drastically speed up the approach to randomness – and for working out where they are. Systems that do not have a cut-off – the drunkard’s walk is one – will approach a state of randomness gradually. Some of them can take a long time to do so. For instance, if the space the drunkard is walking in is large, it will be a long time before he is equally likely to be anywhere within it.

Dr Diaconis argues that this information is crucial. For the users of Markov models, it can prevent embarrassing errors. For everybody else, perhaps it is just handy to know that seven imperfect riffle shuffles are enough to mix up a pack of cards.

Source: The Economist 12 October 1996

• American Roulette. by Tom McCormack
• American Roulette: How I Turned the Odds Upside Down—My Wild Twenty-Five-Year Ride Ripping Off the World’s Casinos by Richard Marcus
• Basic Roulette by Bert Walker
• Basics of Winning Roulette, 2e by J. Edward Allen
• Beat the House: Sixteen Ways to Win at Blackjack, Roulette, Craps, Baccarat and Other Table Games by Frederick Lembeck
• Beating the Casinos at Their Own Game : A Strategic Approach to Winning at Craps, Roulette, Slots, Blackjack, Baccarat, Let It Ride, and Caribbean Stud Poker by Peter Svoboda
• Casino gambling: A winner’s guide to blackjack, craps, and roulette by Robert J Hutchinson
• Gamble to Win: Roulette by R. D. Ellison
• Gambling Times Guide to Roulette by Scott Lang
• Get the Edge at Roulette: How to Predict Where the Ball Will Land! by Christopher Pawlicki and Frank Scoblete
• How to Win at Cards (21 & poker), Dice, Races, Roulette by Mike Goodman
• How to Win at Online Roulette by Samuel Blankson
• How to win at roulette and blackjack by Roy Ward Dickson
• How to win at roulette and other casino games by Sidney H Radner
• How To Win At Roulette by N. H. , B.A.LL.B. Moos
• How to Win at Roulette by Norman Squires
• How to Win At Roulette the Outstanding Book of Systems by Norman Squire
• Insider’s Secrets for Winning at Roulette: Tips, Techniques & Strategies for Beating the Casinos at Their Own Game by Donald Currier
• John Patrick’s Roulette: A Pro’s Guide to Managing Your Money and Beating the Wheel by John Patrick
• Playing Roulette As a Business: A Professional’s Guide to Beating the Wheel by R. J. Smart
• Roulette a Game You Can Win at … by Iwan Toowin
• Roulette for the Casual Gambler by Jack Short, Norma H. Short, and Lissa Poincenot
• Roulette for the Weekend Gambler: How to Get In, Make Your Hit and Get Out a Winner by J. R. Miller
• Roulette Fortune Bookie by Serena Lee Ng
• Roulette Handbook American and European Styles New Selected Winning Plays Based on Adjoining Numbers Combinations With Complete Table Layouts of by Jim Franklin Deberry
• Roulette Secrets Revealed by John C. Steele
• Roulette: Playing to Win by Brett Morton
• Roulette: Playing to Win; A Humorous and Informative Gaming Guide (Playing to win) by Tony Korfman
• Secrets of Winning at Casino Roulette by Lawrence Lowrey
• Secrets Of Winning Roulette, 2nd Edition by Marten Jensen
• So You Want to Be a Gambler: Advanced Roulette (So You Wanna Be a Gambler Series) by John Patrick
• Spin Roulette Gold: Secrets of Beating the Wheel by Frank Scoblete
• The Infallible Roulette System by Don Young
• The Julian Strategies in Roulette by John F. Julian
• The Roulette Formula: How to Predict the Exact Number by Kimo Li
• The roulette system tester by Erick St. Germain
• The Wheel segment method of playing roulette by W. W Adams
• Win at Roulette (Oldcastle Gambling Series) by Gordon Cromwell

Posted in Winning.