David Copperfield

David Copperfield and his assistant perform the following magic trick. The assistant offers to a person from the audience to pick 5 arbitrary cards from a regular deck and then hand them back to him. After the assistant sees the cards, he returns one of them to the audience member and gives the rest one by one to David Copperfield. After the magician receives the fourth card, he correctly guesses what card the audience member holds in his hand. How did they perform the trick?

Out of the five cards there will be (at least) two of the same suit, assume they are clubs. Now imagine all clubs are arranged on a circle in a cyclic manner - A, 2, 3, ... J, Q, K (clock-wise), and locate the two chosen ones on it. There are two arks on the circle which are connecting them and exactly one of them will contain X cards, with X between 0 and 5. Now the assistant will pass to David Copperfield first the clubs card which is located on the left end of this ark, will return to the audience member the clubs card which is located on the right end of it and with the remaining three cards will encode the number X. In order to do this, he will arrange the three extra cards in increasing order - first clubs A-K, then diamonds A-K, then hearts A-K and finally spades A-K. Let us call the smallest card under this ordering "1", the middle one "2" and the largest one "3". Now depending on the value of X, the assistant will pass the cards "1", "2" and "3" in the following order:

X=0 -> 1, 2, 3
X=1 -> 1, 3, 2
X=2 -> 2, 1, 3
X=3 -> 2, 3, 1
X=4 -> 3, 1, 2
X=5 -> 3, 2, 1

In this way David Copperfield will know the suit of the audience member's card and also with what number he should increase the card he received first in order to get value as well. Therefore he will be able to guess correctly.