# 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**

- Count out 27 cards from your deck, and put the rest away.
- 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.
- 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.
- 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**. - Repeat steps 3 and 4 two more times, so you’ve done the process three times in total.
- 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 deal | Second deal | Third deal | Final position |

top | top | top | 0 |

middle | top | top | 1 |

bottom | top | top | 2 |

top | middle | top | 3 |

middle | middle | top | 4 |

bottom | middle | top | 5 |

top | bottom | top | 6 |

middle | bottom | top | 7 |

bottom | bottom | top | 8 |

top | top | middle | 9 |

middle | top | middle | 10 |

bottom | top | middle | 11 |

top | middle | middle | 12 |

middle | middle | middle | 13 |

bottom | middle | middle | 14 |

top | bottom | middle | 15 |

middle | bottom | middle | 16 |

bottom | bottom | middle | 17 |

top | top | bottom | 18 |

middle | top | bottom | 19 |

bottom | top | bottom | 20 |

top | middle | bottom | 21 |

middle | middle | bottom | 22 |

bottom | middle | bottom | 23 |

top | bottom | bottom | 24 |

middle | bottom | bottom | 25 |

bottom | bottom | bottom | 26 |

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.

1s | 3s | 9s | Total |

0 | 0 | 0 | 0 |

1 | 0 | 0 | 1 |

2 | 0 | 0 | 2 |

0 | 1 | 0 | 3 |

1 | 1 | 0 | 4 |

2 | 1 | 0 | 5 |

0 | 2 | 0 | 6 |

1 | 2 | 0 | 7 |

2 | 2 | 0 | 8 |

0 | 0 | 1 | 9 |

1 | 0 | 1 | 10 |

2 | 0 | 1 | 11 |

0 | 1 | 1 | 12 |

1 | 1 | 1 | 13 |

2 | 1 | 1 | 14 |

0 | 2 | 1 | 15 |

1 | 2 | 1 | 16 |

2 | 2 | 1 | 17 |

0 | 0 | 2 | 18 |

1 | 0 | 2 | 19 |

2 | 0 | 2 | 20 |

0 | 1 | 2 | 21 |

1 | 1 | 2 | 22 |

2 | 1 | 2 | 23 |

0 | 2 | 2 | 24 |

1 | 2 | 2 | 25 |

2 | 2 | 2 | 26 |

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.