Magical Mathematics: The Mathematical Ideas that Animate Great Magic Tricks

Persi Diaconis and Ron Graham . Princeton University Press: 2011. 258 pp. $29.95, £20.95

Which came first for you, magic or maths?

Magic came first. When I was five, I found a magic book in the attic and started doing shows. I was a terrible magician but the other kids liked it. In high school I had a good geometry teacher but had no interest in mathematics and never did homework. When I was 13, I met Alex Elmsley, a soft-spoken British computer engineer and magician, at a magic shop in New York City. He showed me that eight perfect shuffles would put a deck back in its original order. His ingenious method for moving the top card to a desired position within the deck was my introduction to binary numbers.

Persi Diaconis. Credit: L. A. CICERO/STANFORD NEWS SERVICE

How did you pursue magic?

The sleight-of-hand artist Dai Vernon invited me to Delaware to do some magic shows when I was 14 — and I never went back home. We found crooked gamblers to learn their techniques. There are often tricky probability questions involved. I didn't have much probabilistic intuition and made every boneheaded mistake you could make. During ten years on the road, I learned the hard way.

Can you describe one of the best tricks you learned?

In 1916 the pioneering US magician Charles Thornton Jordan advertised a trick called 'Long-Distance Mind Reading'. He would mail you an ordinary deck of cards, ask you to cut and shuffle twice, then draw a card and restore it to the middle of the deck. After you shuffled again and returned the deck to him, he would name your card. It is a wonderful trick that fooled everybody and didn't seem mathematical. It works because the deck is arranged in a special order. When you shuffle once, the deck is split into two alternating sequences (or 'chains'). Two shuffles makes four interlocking chains, and three shuffles makes eight chains. When he got the deck back, he would play a sort of solitaire to isolate the one card that was not in any of these chains. That was the chosen card.

How did you come to study shuffling theory?

Jordan's trick led me to ask how many times you have to shuffle a deck of cards to mix them up properly. People often ask why this problem can't be solved by brute force with a computer. But a deck of cards can be arranged in almost as many ways as there are atoms in the Universe. All the computers in the world couldn't run through all the arrangements. We used probability theory, combinatorics and group theory to prove that you need seven ordinary riffle shuffles to mix up a deck randomly. Now we're using the mathematics of shuffling to study turbulence in fluid dynamics, which has many industrial applications, such as determining how long a vat of cookie dough must be blended to ensure that all of the ingredients are mixed.

Are there any other practical applications of card tricks?

Jordan invented a method of ordering a deck such that the pattern of reds and blacks in a series would code for a unique set of cards, allowing him to divine cards on very little information. Such an arrangement is known as a De Bruijn sequence among mathematicians. These sequences have lots of practical applications. They are used to scramble mobile-phone signals, reassemble snippets of DNA and allow a digital pen to identify its position on special paper.

Could science explain what makes a good magic trick?

The psychology of deception is a serious subject, particularly among spy agencies, but I have never seen a convincing study of it. Some magic tricks are viscerally moving and shocking, others are painfully boring. Dai Vernon said that good magic has a way of “ingeniously leading the mind to defeat its own logic”. That sort of thing is not so scientific. Magic is a theatrical experience.

How are secrets treated among magicians?

It is a strange tension. In magic there are still many secrets. I'm famous for keeping them. If someone shows me something, it stays with me forever. When a student asked me recently to talk about card tricks, I declined. But Wikipedia and YouTube are changing things. Someone can find the magician's secret on their phone during a performance. Maybe this will make magicians more inventive, or make people more appreciative.

What kind of maths do you prefer?

I enjoy learning new things. When you start in a new field you have to ask dumb questions. I often say I'm paid for my ability to tolerate feeling stupid. I also like problems that touch the real world, and that you can explain simply, like flipping a coin or spinning a roulette wheel. When I develop a big piece of theory, I feel like I'm slumming: the real discoveries are in the examples. This spring, I will teach a course in the mathematics of magic tricks, in an effort to twist young minds in the right direction.