Hoare, T., Shankar, N. (2010). Unraveling a Card Trick. In: Manna, Z., Peled, D.A. (eds) Time for Verification. Lecture Notes in Computer Science, vol 6200. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-13754-9_10
In one version of Gilbreath’s card trick, a deck of cards is arranged as a series of quartets, where each quartet contains a card from each suit and all the quartets feature the same ordering of the suits. For example, the deck could be a repeating sequence of spades, hearts, clubs, and diamonds, in that order, as in the deck below.
The deck is then cut into two (not necessarily equal) half-decks, possibly as ⟨5♠⟩,⟨3♡⟩,⟨𝑄♣⟩,⟨8♢⟩,⟨𝐾♠⟩⟨5♠⟩,⟨3♡⟩,⟨Q♣⟩,⟨8♢⟩,⟨K♠⟩ and ⟨2♡⟩,⟨7♣⟩,⟨4♢⟩,⟨8♠⟩,⟨𝐽♡⟩,⟨9♣⟩,⟨𝐴♢⟩⟨2♡⟩,⟨7♣⟩,⟨4♢⟩,⟨8♠⟩,⟨J♡⟩,⟨9♣⟩,⟨A♢⟩.
The order of one of the half-decks is then reversed. Either half-deck could be reversed. We can pick the smaller one, i.e., the first one, and reverse it to obtain ⟨𝐾♠⟩,⟨8♢⟩,⟨𝑄♣⟩,⟨3♡⟩,⟨5♠⟩⟨K♠⟩,⟨8♢⟩,⟨Q♣⟩,⟨3♡⟩,⟨5♠⟩. The two half-decks are then shuffled in a (not necessarily perfect) riffle-shuffle. One such shuffle is shown below, where the underlined cards are drawn from the second half-deck.
The quartets in the shuffled deck are displayed to demonstrate that each quartet contains a card from each suit. This turns out to be inevitable no matter how the original deck is cut and the order in which the two decks are shuffled. The principle underlying the card trick can be proved in a number of ways. We present the argument as a series of transformations that demystify the trick and describe its formalization.