This is a magic trick performed by two magicians, A and B, with one regular, shuffled deck of 52 cards. A asks a member of the audience to randomly select 5 cards out of a deck. the audience member  who we will refer to as C from here on  then hands the 5 cards back to magician A. After looking at the 5 cards, A picks one of the 5 cards and gives it back to C. A then arranges the other four cards in some way, and gives those 4 cards face down, in a neat pile, to B. B looks at these 4 cards and then determines what card is in C's hand (the missing 5th card). How is this trick done?

Note 1: There's no secretive message communication in the solution, like encoded speech or ninja hand signals or ESP or whatever ... the only communication between the two magicians is in the logic of the 4 cards transferred from A to B. Think of these magicians as mathematicians.
Note 2: This magic trick is originally credited to magician and mathematician Fitch Cheney.
Any 5 cards will contain at least 2 of the same suit. Out of those 2 cards, counting A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K..., one card will be at most 6 after the other. Take that card out of the pile. Play the other card of the same suit first. There are 6 ways to arrange the remaining 3 cards. Let the order be clubs, diamonds, spades, hearts. The 3 cards can be ordered 1, 2, 3. Then, their order will tell you how many cards (16) after the first card the missing card is.
123>1
132>2
213>3
231>4
312>5
321>6
Example:8 of spades, K of hearts, 3 of clubs, 7 of clubs, 9 of diamonds
There are two clubs. 7 is 4 after 3, so take out 7 and play 3 first. The order of the other 3 cards is 9 of diamonds, 8 of spades, K of hearts. The 4th ordering is 8 of spades, K of hearts, 9 of diamonds.
Play:3 of clubs, 8 of spades, K of hearts, 9 of diamonds
If there is more than one pair of the same suit, then you can pick any pair.
Example:2 of hearts, Q of hearts, 3 of spades, 4 of spades, 5 of hearts
There are many pairs, so I will pick the Q of hearts and 5 of hearts. 5 is 6 after Q, so take out 5 and play Q first. The order of the other 3 cards is 3 of spades, 4 of spades, 2 of hearts. The 6th ordering is 2 of hearts, 4 of spades, 3 of spades.
Play:Q of hearts, 2 of hearts, 4 of spades, 3 of spades
Edited on July 12, 2013, 7:10 pm

Posted by Math Man
on 20130712 14:31:17 