Structure preview

Number magic: 7 card tricks and their mathematical secrets

From 21 cards to Gilbreath and Fitch Cheney: seven selected tricks with explicit preparation, instructions, examples and explanations of why they work.

Section: Logic Updated:
Articles /number-magic-card-tricks-mathematical-explanations
Number magic: 7 card tricks and their mathematical secrets

18 min

Cards can hide a position, conserve a quantity or convey a message through order. These seven tricks use different ideas: we group the 21-card variations together and do not treat a card deliberately put seventh as a mathematical mystery.

Illustration for the Logic section
Section: Logic

Use standard cards without jokers. Where required, use 52 cards, 26 red and 26 black. Each method states whether it needs preparation, an assistant or a particular shuffle. Its proof starts closed: try first, then reveal the mechanism.

Card labels use A = ace, J = jack, Q = queen, K = king. Hearts and diamonds are red; clubs and spades are black. Numerical values of court cards depend on the trick and are always stated.

Continue with the other collection: Number magic: 9 games with dates, birthdays and calendars

1. 21 cards: a shrinking position range

Presentation

A spectator thinks of one of 21 cards and identifies only its column. After three collections it will be eleventh.

How it works

  1. Deal 21 face-up cards by rows, left, middle, right, then start the next row: three columns of seven.
  2. Ask which column contains the card. Put that entire column between the other two when rebuilding the packet.
  3. Preserve each column’s top-to-bottom order as the packet’s top-to-bottom order. Collect bottom card first, placing the cards above it on top. Do not turn the entire packet over during these steps.
  4. Repeat dealing and collection twice more; count from the top and reveal card eleven.

Example. Starting at position 17 gives positions 13, 12, 11. Nine-card and 27-card versions use the same mechanism: two collections to position 5 and three to position 14 respectively.

Deal by rows: 1,2,3, then 4,5,6. The column containing position 17 is 2,5,8,11,14,17,20.
Deal by rows: 1,2,3, then 4,5,6. The column containing position 17 is 2,5,8,11,14,17,20.

Watch out. Deal by rows, not by filling one column first. The outside columns may swap, but the chosen column always goes in the middle. Variations are not separate games.

Why it works: reveal the explanation

For position p, the row is ceil(p/3). Placing that column between two seven-card columns gives new position 7+ceil(p/3). Positions 1–21 shrink to 8–14, then 10–12, then 11. Rather than being read, the selection is forced to one position.

p′ = 7+ceil(p/3)
1–21 → 8–14 → 10–12 → 11
17 → 13 → 12 → 11

2. Three piles and a predicted card

Presentation

A prepared card survives three variable counts and appears at the position equal to the sum of the piles’ starting values.

How it works

  1. In 52 cards, put a known card 33rd from the top, or twentieth from the bottom. Do not shuffle afterwards.
  2. Take the top card as the first pile’s starting value v: ace=1, court cards=10. Add cards while counting v+1,v+2,…,10. A starting 10 needs no additions.
  3. Build two more piles from the remaining packet, retaining the three starting values visibly.
  4. Add those values to obtain S. Count to card S in the unused packet: it is the predicted card.

Example. Starting values 4,8,2 give pile sizes 7,3,9. Nineteen cards have been used and 33 remain. S=14; the fourteenth remaining card was originally card 33.

Watch out. Court cards count as 10 only in this trick. Do not return pile cards to the remaining packet. Preparation is essential, but the revealed position really varies with the three values.

Why it works: reveal the explanation

A pile starting at v contains 11−v cards including its first card. Three piles consume 33−S, leaving R=52−(33−S)=19+S. The known card is still twentieth from the bottom, hence R−19=S from the top. It cannot have been consumed: the piles use at most 30 cards and it started at position 33.

nᵢ = 11−vᵢ; S = v₁+v₂+v₃
R = 52−(33−S) = 19+S
p = R−20+1 = S

3. Reds here, blacks there

Presentation

After genuine shuffling, divide a complete deck into equal halves. Reds in the first half equal blacks in the second, without knowing either number.

How it works

  1. Use 52 cards with 26 red and 26 black; shuffle freely.
  2. Divide into two groups A and B of exactly 26.
  3. Count reds in A and blacks in B: the results match.

Example. If A has 17 red and 9 black cards, B has 9 red and 17 black. The prediction is equality, not specifically 17.

Watch out. The deck must be complete and the groups equal in size. Jokers or unequal groups invalidate this guarantee.

Why it works: reveal the explanation

If A has r reds it has 26−r blacks. Since the whole deck has 26 blacks, B has 26−(26−r)=r blacks. This counting invariant is independent of order and survives any shuffle.

r → 26−r → 26−(26−r) = r

4. Matching face-up cards without looking

Presentation

Ten cards face up occupy unknown positions. Without looking, create two groups containing equal numbers of face-up cards.

How it works

  1. Use 52 cards, exactly 10 face up and 42 face down. The spectator may shuffle without changing orientations.
  2. Without seeing faces, take any ten cards and separate them from the other 42.
  3. Turn over every card in the ten-card group, interchanging face up and face down. Leave the larger group unchanged.
  4. Compare the face-up counts.

Example. If the ten chosen cards initially include 3 face up, the rest contain 7. After turning the small group over, it too has 7 face up.

Watch out. Know the initial face-up count. Group sizes need not match, but every card in the small group must have its orientation reversed.

Why it works: reveal the explanation

Let x of the ten face-up cards enter the small group; 10−x remain face up in the large group. Flipping the ten selected cards makes their 10−x face-down cards face up. The counts match without knowing x. More generally, with K initially face up, select and flip exactly K cards.

5. Eight perfect shuffles restore the order

Presentation

A precisely shuffled 52-card deck returns to its original order after eight perfect out-shuffles. Practise with eight cards, which return after three.

How it works

  1. Split cards 1–8 into ordered halves 1,2,3,4 and 5,6,7,8.
  2. Interleave one from the first half, then one from the second: 1,5,2,6,3,7,4,8. First and last cards stay at the ends.
  3. Repeat with the new halves: the second order is 1,3,5,7,2,4,6,8; the third is 1–8 again.
  4. For 52 cards, the same out-shuffle restores all cards after eight repetitions.

Example. For 52 cards, 2⁸=256=5×51+1. For eight cards, 2³=8=1×7+1. This is a precise permutation’s period, not random shuffling.

Watch out. Alternation must be perfect and start from the first half. A random riffle or an in-shuffle has a different result. Handling a full deck this accurately takes practice.

Why it works: reveal the explanation

Number positions 0 to N−1. The last stays fixed; other positions i move to the remainder of 2i divided by N−1. After k shuffles the multiplier is 2ᵏ. The order returns when this leaves remainder 1: the first such k is 8 for N=52 and 3 for N=8.

iₖ = (2ᵏ i) mod (N−1), 0 ≤ i < N−1
N=52: 2⁸ = 256 = 5×51+1
N=8: 2³ = 8 = 1×7+1

Mathematics Awareness Month · Perfect Shuffles

6. Gilbreath: disorder preserves the pairs

Presentation

After even an irregular interleaving, each consecutive pair is one red and one black. You need not alternate one card from each packet.

How it works

  1. Prepare 52 cards alternating red and black throughout.
  2. Deal any 1–51 cards from the top, one by one into a new packet. This reverses their order: simply lifting a block is not equivalent.
  3. Interleave the packets, taking any number of successive cards from either, while preserving order inside both. Perform just this one shuffle.
  4. Reveal pairs from the top, positions 1–2,3–4,5–6,… : each is mixed-colour.

Example. From colours R,B,R,B,R,B,R,B, dealing three produces R,B,R and B,R,B,R,B. One allowed interleaving is R,B | B,R | B,R | R,B. Global alternation has disappeared, yet every pair remains mixed.

Watch out. No internal randomisation, arbitrary second shuffle or starting pairs at card two. Reversing the first block is an essential condition.

Why it works: reveal the explanation

After dealing, both packets alternate and their top colours are opposite. Two output cards either come from one packet, giving opposite colours, or one from each, again opposite. Removing a pair leaves opposite top colours: either one packet advanced twice or both advanced once. Repeat; if one packet runs out, the alternating remainder has even length.

P. Diaconis, R. Graham · Magical Mathematics, Gilbreath

7. Five cards, one hidden: Fitch Cheney

Presentation

A spectator selects five cards. An assistant hides one and shows the other four in order; a decoder identifies the hidden card. An informed assistant is essential.

How it works

  1. Choose two of the same suit. On the circular ranks A=1,…,J=11,Q=12,K=13, orient them so moving from base to hidden card takes 1–6 forward steps. Show the base first.
  2. Rank the other three by value, breaking ties with ♣<♦<♥<♠. Call them L, M, H.
  3. Show them in the table’s permutation for that distance. The decoder adds the distance to the base rank, wrapping K to A, and keeps its suit.

Example. With 3♥,8♥,2♣,Q♦,9♠, hide 8♥ and show 3♥ first. Distance 5 uses H,L,M: show 3♥,Q♦,2♣,9♠. The decoder obtains 8♥.

L = low · M = middle · H = high. Compare rank first, then break ties with ♣<♦<♥<♠.

DistanceOrder of the three cards
1L M H
2L H M
3M L H
4M H L
5H L M
6H M L

Watch out. The spectator selects five cards, but the assistant chooses which one to hide. Agree on the ordering and code first. Court ranks here are 11,12,13, not 10.

Why it works: reveal the explanation

Five cards in four suits force a same-suit pair. The two forward circular distances add to 13, so one is between 1 and 6. Three remaining cards have 3!=6 orders, enough to communicate the distance.

d ∈ {1,2,3,4,5,6}; 3! = 6
h = 1+[(b−1+d) mod 13]

M. Kleber · The Best Card Trick · C. Mulcahy · Fitch Cheney’s Five Card Trick · S. Santorico · Mathemagical Card Tricks

Before performing, test each trick face up and check every step. An unauthorised shuffle, lost order or mistaken convention may destroy the guarantee. The wonder lies in understanding a surviving constraint, not hiding the conditions from someone learning the trick.

Continue with the other collection

Sources and further reading