A card trick from Diaconis and Graham

I previously wrote about some mathematics of the I Ching that I got from Diaconis and Graham’s book Magical Mathematics.

Diaconis and Graham write (p. 184) that “We have occasionally taught a class on mathematics and magic tricks.” (An aside: this book has the annoying habit of using the mathematical “we” in situations where it’s clear that one author or the other is meant. So I was not sure whether Diaconis and Graham taught this class jointly. But Graham’s vita indicates that he has never been at Harvard, while Diaconis has, so I assume “we” refers to Diaconis.)

Anyway, there’s a well-known trick named Miraskill. The original version of the trick is something like this YouTube video. Shuffle a deck of cards and turn over two at a time. Each red-black pair is put in the center; each red-red pair to the left; each black-black pair to the left. Then the number of red-red and black-black pairs are the same.

The explanation is simple — the number of red cards and the number of black cards in the deck are the same, so the number after removing the mixed pairs is the same as well.

Diaconis and Graham tell how Joe Fendel, at the time a Harvard undergrad, suggested the following variation. Start with a deck of 27 cards, labeled with the twenty-seven possible triplets of rock, paper, scissors. Shuffle the deck and remove one card, and set it aside.

Then go through the deck two cards at a time, looking at the first symbol on each card. Each time the two symbols are the same, discard. Each time the two symbols are not the same, the losing symbol (under the usual rock-paper-scissors rules) scores a (negative) point. After running through 26 cards (13 pairs), two of the three symbols will have scores with the same parity (even or odd). The one of these that defeats the other at rock-paper-scissors is the first symbol on the card set aside. Run through the deck again looking at the second symbols, and then the third symbols.

For example, say the twenty-six cards, in order, have first symbols

RR PS PP RP SP RP SS RP RS PS SP RS SR.

Then mark the loser of each pair in bold (for example, in “PS”, scissors beats paper) to get

RR PS PP RP SP RP SS RP RS PS SP RS SR.

There are 4 P’s, 3 R’s, 3 S’s. The two 3s have the same parity. Rock beats scissors, so the first symbol on the missing card must be rock. And indeed if you count the symbols I gave, there are 8 rocks, 9 papers, and 9 scissorses, so the missing symbol is rock.

I’m not convinced it makes a good trick — there’s too much bookkeeping — but figuring out how it works is a nice little exercise.

Say, for example, the missing symbol is rock. Then there will be 8 rocks, 9 papers, and 9 scissorses among the 26 symbols that we see. After we remove the tied pairs, there will be an even number of rocks, and an odd number each of papers and scissorses.

Now let r be the number of rock-paper pairs that appear; let p be the number of paper-scissors pairs; let s be the number of scissors-rock pairs. (In each case the letter is chosen to correspond to the losing symbol, which gets the point.) Then since the total number of rocks is even, r + s is even; similarly r + p and s + p are odd.

Since r + s is even, r and s have the same parity; p has the opposite parity. (Formally, we’re solving the system r+s = 0, r+p = 1, s+p = 1 over \mathbb{Z}_2, and noting that it has exactly two solutions.) Finally, rock beats scissors. If the missing symbol is scissors or paper we just permute the symbols.

I’m still not convinced it makes a good magic trick. I suspect my bar for interesting “self-working” magic tricks (the magician’s term of art for tricks that work based on some principle such as this, instead of sleight-of-hand) is high; if I instantly feel that I could figure out how something works, it’s not that interesting.

Not that I could perform the trick well; that takes some showmanship that I don’t have. But I know enough probability to know that I shouldn’t count cards – I’d be no good at it. And I know enough discrete mathematics to not be impressed by this trick

One thought on “A card trick from Diaconis and Graham

Leave a comment