A mathematical card trick

Katie Steckles

Often at this time of year, people are visiting family, and sometimes traditional games and toys come out to occupy your time. If you’ve got a deck of playing cards handy, you can perform a trick to amuse people – and since it’s a mathematical card trick, you don’t need to be a magician to make it work!

The trick

  1. Count out 27 cards from your deck, and put the rest away.
  2. Ask a volunteer to shuffle the 27 cards, pick one, look at it, and return it to the stack (in its original position, or anywhere they like) – all without you seeing the card.
  3. Deal the 27 cards into three face-up piles (placing one card in each pile, then repeating this 9 times). Ask your volunteer to watch for the card they picked – once you’ve finished dealing all the cards, they should tell you which pile it’s in.
  4. Pick up the three piles, and return them to a stack of 27 cards, but making sure you place the stack your volunteer indicated in between the other two.
  5. Repeat steps 3 and 4 two more times, so you’ve done the process three times in total.
  6. Count cards off from the top of the deck and turn over the 14th card (using the excuse that 13 is an unlucky number, so 14 must be a lucky number) – this should be your volunteer’s card.

You can try this trick and make sure it works – if it goes wrong, it’s usually a miscount (check you actually have 27 cards!), or a step somewhere that’s gone wrong, so try again or ask a friend to watch and make sure you’re doing it right.

Why does this work?

Given that you know this is a mathematical card trick, it should make sense that as long as all the steps are followed correctly, you end up with the same result every time. But this trick has some interesting underlying mathematics, which can be used to perform an even more impressive version of the trick. First we need to understand what’s happened in our 14th-card version of the trick. Imagine your volunteer indicates the card is in the left pile.

When the cards are re-stacked, the pile containing your volunteer’s chosen card is placed in the middle. This means that when you deal the second time, you know that the card you’re looking for isn’t in the first nine cards, or the last nine cards. Since we deal the cards across the three piles, this means your chosen card won’t be in the bottom three or top three cards of any of the three piles. (Think about this a bit more if you’re not convinced.)

Now imagine your volunteer indicates the right-hand pile. This tells you which set of three cards (from the middles of the three piles) the card is in – and this set of three, if you place the pile in the middle again, will spread itself out as the middle card in each of the three piles on the third deal.

If the pile pointed out to you the third time is then placed in the middle, the card will be the middle card in the middle pile of three, or in other words, in the middle of the whole stack – which makes it the 14th card. Magic!

Making it more interesting

So the trick works, and it makes sense. True mathematicians will at this point become curious – we placed the pile in the middle each time, but we didn’t have to do that. It could equally have been placed on the top or bottom, on each of the three deals. So what would happen if we did that?

A little thought, and running through the trick with different combinations, reveals the following observations:

  • Placing the chosen pile on the top each of the three times makes the card finish on top of the deck
  • Placing the chosen pile on the bottom each time makes the card finish at the bottom.

With a bit more investigation, the following observations become apparent:

  • Placing the pile on top after the third deal will always result in it ending up in the top third of the deck; similarly placing it in the middle third means it’s in the middle third of the deck, and the same for the bottom third
  • Within each third, the position of the pile after the second deal will determine which third of that third it’s in (top, middle or bottom)
  • Within that third-of-a-third, the position of the pile after the first deal determines whether it’s the top, middle or bottom of those three cards.

This information can be summarised in a table – here the ‘final position’ is the number of cards that will be on top of the chosen card at the end, with 0 cards on top of the top card, and 26 cards on top of the bottom card.

First dealSecond dealThird dealFinal position
toptoptop0
middletoptop1
bottomtoptop2
topmiddletop3
middlemiddletop4
bottommiddletop5
topbottomtop6
middlebottomtop7
bottombottomtop8
toptopmiddle9
middletopmiddle10
bottomtopmiddle11
topmiddlemiddle12
middlemiddlemiddle13
bottommiddlemiddle14
topbottommiddle15
middlebottommiddle16
bottombottommiddle17
toptopbottom18
middletopbottom19
bottomtopbottom20
topmiddlebottom21
middlemiddlebottom22
bottommiddlebottom23
topbottombottom24
middlebottombottom25
bottombottombottom26

This means we have a pattern we can use for finding the combinations of top, middle and bottom we need to put the card in a specific place at the end of the trick. It might seem a little intimidating to memorise all these combinations, but of course mathematics has the answer.

If you’re familiar with binary numbers, you’ll know that it’s possible to represent any number using only ones and zeroes – base 2, which means every digit is one of two options. But if we wanted three options, that’s also possible – using base 3. Ternary numbers, as they’re known, are a way to write any number as a sum of powers of three, and each digit is either 0, 1 or 2.

The table below shows how to write numbers from 0 to 26 in ternary – and it bears a striking resemblance to our other table above – replace 0 with ‘top’, 1 with ‘middle’ and 2 with ‘bottom’ and you have the same table! The columns represent how many 1s, 3s and 9s (reading from right to left) are added together to make each number – for example, 7 = 3+3+1 so it’s written 021, and 12 = 9+3 so it’s written 110.

1s3s9sTotal
0000
1001
2002
0103
1104
2105
0206
1207
2208
0019
10110
20111
01112
11113
21114
02115
12116
22117
00218
10219
20220
01221
11222
21223
02224
12225
22226

We can decide the position we want the card to be in at the end of the trick, look it up in the table, and get a pattern of top, middle and bottom (0, 1 and 2) to put the card in the right position.

As we’ve seen, 111 (middle middle middle) gives 9+3+1=13 cards on top, putting it as the 14th card. 201 (bottom top middle) gives 9+9+1=19 cards on top, putting it as the 20th card. In fact, you could start the trick by asking someone to pick a card, and also casually ask them their age (if you think it’s likely to be less than 27, and not cause offence!) or to pick their favourite number between 1 and 27 – then that would be the number you count to at the end of the trick.

If you put the piles together casually enough, nobody will notice you’re stacking them in a particular order, and the effect can be very impressive. Mathematical magic tricks like this are favourites among professional magicians, as they don’t require any sleight of hand, and always work correctly if you get all the steps right. I personally like this trick because it’s a wonderful application of a nice bit of mathematics!

Der Beitrag A mathematical card trick erschien zuerst auf Heidelberg Laureate Forum.