The most inspiring math teacher I had in college was Persi Diaconis, who, before becoming a Harvard math professor, was… a card magician. This made him legendary around the math department, because his path into higher math (he started to learn calculus because it would help him invent even more awesome card tricks) was not exactly the most traditional way of getting into the subject. By the time I met him, Persi was already a leading mathematician and statistician (he’s the guy who proved that you need seven riffle shuffles to randomize a fifty two-card deck, among other things), but he still kept his interest in magic. And while I only got a rough idea of what math-driven magic tricks were like when I studied with him, I finally got a better sense a few years ago, when he published an absolutely, well, magical book devoted to the subject. It’s called Magical Mathematics.
I read the book soon after it came out, and showed my kids a few of the tricks I learned from it. They didn’t get the math, but they liked the tricks. And that was about it, until sometime last year, when my older son started learning card tricks too, via YouTube videos. For a while he was mostly doing traditional sleight-of-hand stuff, but this weekend he showed me a trick that’s very mathematical! It’s simpler than most of the tricks in Persi’s book, but very much in the same spirit. You should see it too. Here goes:
We start with a deck of cards, cut as many times as you like. I hand you the deck, asking you to cut it one last time. Then I show you the top and bottom card in the deck. I’m not going to know what they are, so you need to remember them. Follow along:
We’ll put the two cards back in the deck, say on top, and I ask you to cut the deck again, multiple times if you like, so we lose your cards in the deck:
The trick is to find them again. First, we deal the cards out into four piles:
Next, we combine these piles into two by joining together alternating piles (first and third into one single pile, second and fourth into another). Finally, we flip over one of the piles and riffle shuffle the two piles together. (My son’s been doing all the steps to this point, but I’m going to take over for this step because he hasn’t learned to riffle shuffle yet:)
Now let’s spread out our cards:
Notice that all the cards facing up have the same color… except one. That’s one of your cards!
Flip the deck over. Again, all the cards facing up have the same (other) color. There’s one exception: your other card!
How did we do that?
Unlike magic tricks based in sleight of hand, we didn’t hide anything: what you see is what you get. Except for one thing: you probably didn’t know that the original deck we started with looked like this:
The deck was set up to alternate red and black cards: one red, one black, one red, one black… Knowing that, stop for a moment and try to step through each step of the trick. Can you see how it works? If you can, congratulations! If not, let’s walk through it together:
We started by cutting the deck multiple times. That’s meant to make the audience think we’re making things random, but in fact it just cycles the deck around, and leaves the basic alternating red-black structure in place.
Now the key step: we took off the top and bottom cards, showed them to the audience, and put them back on top — almost, but not exactly, how we found them. That almost is the key to the trick. The point is that those two cards are now in opposite order to the rest of the deck. For example, say the top card was red. At that point, the deck must have been ordered as red (top), black, red, black, and so on, with black (the other card we picked up) on the bottom. After we take off the top and bottom card, the remainder of the deck is ordered as black (left on top), red, black, and so on, with red now on the bottom. And when we put our two cards on top, the order becomes red, black, black, red, black, red, black, red, and so on, with red still at the end. What’s special about our two cards is that they are out of phase with the others. And wherever they happen to go in the deck now, after we cut the cards, that’s how we’re going to find them again.
The way we find them by separating the reds from the blacks, which is what dealing the cards into piles was designed to do. For example, say that after we cut the cards, red was on top. Follow the cards into piles: red (1st pile), black (2nd pile), red (3rd pile), black (4th pile), red (back to the 1st pile), black (2nd pile), and so on. Each pile has all the same color cards — except the two out of phase cards! So piles 1 and 3 will be all red cards, with one exception, which is one of your cards. And piles 2 and 4 will be all black cards, also with one exception, which is your other card. Here’s how it looks under the hood:
Q (you might be asking): Why four piles? Since the colors alternate, wouldn’t two piles be enough?
A: Good math observation! Only it’s harder to keep track of what you’re doing with just two piles (I tried it). Since just one misdeal messes up the color separation, using four piles makes the trick more secure.
Now of course at this point we could just pick up the red pile and the black pile separately, find the off color card in each pile, and be done with things. But… that isn’t very theatrical, is it? So instead we flip one of the piles over, and shuffle them together. Which has exactly the same effect, but looks way cooler!
Again, this isn’t in Persi’s book, but it’s a good introduction to math-based tricks. If you like it, or know some kids who might, I’d very much encourage you to check Magical Mathematics! You can see a couple sample chapters online at the Princeton University Press site:
And if you know more tricks in this spirit, my son and I would love to see them!