# Magic of Numbers

### From Mathsreach

**Randomness and coincidence have fascinated Persi Diaconis as a magician and a mathematician.**

**Download article:****The Magic of Numbers**(IMAges Issue 8: May 2010)

Diaconis exhibits the multiple paths one can take to mathematics. He left home and high school in New York at 14 to apprentice himself to travelling sleight-of-hand magician Dai Vernon, and by 17 was making a living on his own as a magician.

The pair hunted down crooked gamblers, also skilful at sleight of hand. Diaconis was seduced by their conversations about calculating odds and bought a book on probability, only to find he couldn’t understand the mathematics.

So he enrolled at night school to learn calculus and made his living as a magician by day. In his mid-20s, he was accepted into Harvard University as a graduate student, despite his lack of high school qualifications and minimal maths skills, partly on the basis of two original card tricks he had submitted to the Scientific American puzzle page.

Now a Professor of Statistics and Mathematics at Stanford University in California, he has specialised in the mathematics of randomness, including card shuffling and coin tossing, and used statistical techniques to test and debunk professional psychics.

Diaconis is still one of about 100 people in the world who can riffle shuffle a deck eight times in under a minute and return the cards exactly to where they started. He also taught himself at 13 to toss a coin so that it always landed as heads.

He and Dave Bayer proved in 1992 that it takes seven riffle shuffles (splitting the pack and interleaving both sets of cards) to randomize a deck, and about four for games like blackjack where suits don’t matter. As a result Nevada changed its laws for casino games and the American Contract Bridge League its rules to require seven shuffles. The maths of shuffling turned out to apply to Markov Chain Monte Carlo simulations, a class of sampling algorithms that use randomness to solve problems in biology, chemistry, physics and linguistics. The methods Diaconis developed to recognize when a dealer can safely stop shuffling cards also tell when a computer can stop running a simulation.

At packed public meetings at Albany and Palmerston North in January, he demonstrated the magic of numbers to academics, magic fans and magicians. He shuffled a pack of cards, wound a rubber band around them and tossed them to someone in the front row.

They tossed it randomly to the back and then he asked five different people to cut the cards and toss them back to him. He asked those people to concentrate on their card (cue laughter from the academics), and then asked those who had cut a red card to stand. He then correctly named all the cards the people had seen. It wasn’t a trick, just simple maths. The deck had been arranged so that every possible combination occurred only once, and the pattern of red cards enabled him to calculate how the deck had been repatterned as it was cut.

He is also fascinated by “problems that are simple enough to say in English but that are hard to do”, and is investigating the maths of the carry numbers used in addition. For example, to add eight and five, we write three down and carry one. “It turns out that carries sit in an esoteric corner of group theory called group cohomology, how groups fit together,” he says.

At this year’s NZIMA maths conference in Hanmer Springs, Diaconis gave three talks about carries, shuffling and their relationship. “New Zealand is terrific at group theory; I posted questions and people suggested things I could try. I made real progress talking with New Zealand mathematicians.”