In the opening trick of the book, we work with four cards, let’s call them A,B,C,D. Stack them up in your hand, all cards face-down, make note of the bottom card (say X), and perform the following steps:
INIT.Push the top card to the bottom and flip the top card.CUT AND FLIP TWO.Take the top two cards and flip them over. Give the deck a cut anywhere you like. Repeat this step as many times as you want.FINAL.Flip the top card to the bottom, take the next card to the bottom and flip the top card.
The outcome: the card X faces one way and all other cards face the other way, no matter how many times step 2 is executed.
The trick is known as Baby Hummer in magic circles. It was invented by magician Charles Hudson as a variation on an original trick by a truly eccentric genius named Bob Hummer.
Why does this work?
Let’s consider what happens with a stack of ten initially face-down cards when we repeatedly apply the CUT-AND-FLIP-2 action.
Note that the number of face up cards at odd positions and even positions remain equal after each action, assuming that we start with all cards face up. Why?
An Argument
Assume that the claim is true after CATO operations. So we have a deck where the number of face up cards at odd positions is equal to the number of face up cards at even positions. First consider the flip operation on the top two cards. Using 0 to denote a face down state and 1 to denote a face up state, there are four possible scenarios:
00->1101->0110->1011->00
In cases (2) and (3), the number of face up cards at odd positions and even positions remains the same as before. In case (1), the number of face up cards at odd positions increases by one and the number of face up cards at even positions also increases by one. In case (4), the number of face up cards at odd positions decreases by one and the number of face up cards at even positions also decreases by one. Thus equality is maintained.
Now we turn to the cut: depending on where we cut, either every card that was in a even position before remains in an even position and every card that was in an odd position before remains in an odd position; or every card that was in an even position before moves to an odd position and every card that was in an odd position before moves to an even position. In both cases, equality is evidently maintained.
You can extend this argument to scenarios where the start state has a difference in the number of face up cards in even and odd positions, and conclude that CATO operations will always maintain the difference.
A very natural question to ask is what patterns/configurations are reachable from, say, the identity permutation with all cards face up, using only CATO operations.
[Spoiler] Characterization of reachable patterns
Suppose we have a pattern over cards, where is a permutation of and is a bitstring of length (with 0 denoting a face-down state and 1 denoting a face-up state).
For each position , let be the sum . It turns out that we can reach from the identity permutation with all cards face up --- using only CATO operations --- if and only if all have the same parity.
We state this claim here without proof.
Food for thought: what if the starting permutation was different? Do you gain additional reachable permutations if you are allowed to flip any even number of cards?
Session notes
The first chapter of Magical Mathematics by Diaconis and Graham introduces card tricks due to Bob Hummer. Session 1 covered the Baby Hummer and the invariant that underlies the family.
1:58 Four cards, face down; note the bottom card . INIT: push the top card to the bottom, flip the new top card. CATO (“cut and turn over,” Hindi kaato): cut anywhere, then flip the top two as a unit; repeat freely. FINAL: flip top and push it down, push next down unflipped, flip top. faces one way and the other three the other way, wherever ends up. Only INIT and FINAL need memorising; CATO becomes automatic.
13:41 Cut-first or flip-first in CATO? It doesn’t matter – the book flips first and the operations commute in the relevant sense. Vinod asked whether four cards is special: the bottom-card reveal is; larger effects use different INIT/FINAL moves. An even number of cards is convenient; the book addresses odd decks.
17:58 A pattern is a permutation of cards together with a face-up/face-down bitstring: patterns in total. Starting from the identity with all cards face up, the quantity to track is the number of face-up cards in odd positions versus face-up cards in even positions.
18:59 We cut ten cards by amounts called from the chat (7, 9, 2, 4, 1, 2, then 1 repeatedly). The two counts stayed equal throughout. Deepika conjectured that the top two are always face up – false in general. Mohit’s guess, that each flip updates one odd-position and one even-position count, is closer.
23:28 Why the invariant holds. Flipping the top two: and both change the counts equally; a or pair swaps positions and both cards toggle, leaving counts unchanged. A cut by is a cyclic shift: even preserves each card’s position-parity, odd swaps the odd and even position-sets wholesale. Either way the counts stay equal. Induction on CATO operations closes it.
29:27 I had to be more careful about the cut: think of the cards on a circle, where an odd-distance shift flips everyone’s position-parity.
32:08 Sunita observed that the argument extends to flipping any even-sized block from the top; a single-card flip breaks the invariant. 34:19 We checked the pattern by hand.
36:13 Reachability: starting from identity-all-face-up and using only CATO, not all patterns are reachable. A polynomial-time condition on the target decides. Open: how many patterns are reachable, the optimal number of CATO steps to reach a given target, whether cutting exactly two cards is as powerful as cutting any even number.
39:25 Conjectures from the chat: “all face-up cards share a position-parity” – false, the demo produced counterexamples. “The face-up count must be even” – true by the invariant (total odd-position count), but not sufficient; the book gives exactly reachable patterns. “Every face-up card at an odd position implies unreachable” – true by the invariant, unless no card is face up.
48:29 The characterisation: for each position , let , where is the card at position and if it is face up, otherwise. A pattern is reachable iff all share the same parity. Fix the first card’s orientation and parity forces the rest, so each permutation is reachable in exactly two orientations, giving .
50:40 This does not give an algorithm for reaching a target or an optimal move count. Whether patterns are reachable from an arbitrary starting state is also unclear to me. The book notes the reachable set is a subgroup (from identity) and states the characterisation but, as far as I can tell, not a proof; I do not have one either.
52:54 Up next: rigging effects with the invariant – all hearts face up from ten cards; why the four-card trick works (its starting state violates the invariant, making it a specific rig); a four-card version of the reachability game.
To think about
- Design a ten-card setup so a chosen five cards, and only those, come up face up.
- Prove the invariant survives flipping any even-sized block from the top.
- Prove or disprove: a pattern is reachable iff all share the same parity.
- Is cutting two cards as powerful as cutting any even number?
- How many CATO operations does a reachable target require?