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.
first A and B set up a pre determined 1 to 1 correspondance between the integers 1 to 52 and each of the 52 cards in the deck. One such way would be to rank first by value (1=A to 13=K) and then by suit (such as clubs diamonds hearts spades).
For my explanation I will use the 5 cards: 5clubs 6hearts Kdiamonds 8clubs and 10spades
Next they make use of the fact that there are 4 suits but 5 cards picked thus there will always be two of a suite in an pick of five. So A picks at suite that appears at least twice in the 5 cards given, in my example that would be the clubs. Now assign the 2 cards a numeric value with ace being 1 through king being 13. Now take the difference between the greater and lesser of the 2 cards, if this is less than or equal to 6 then discard the greater card, otherwise discard the lesser. Now we are guarentee that there is a integer D from 1 to 6 such that if you add D to the value of the kept card modulo 13 you will get the discarded card. So in our example 85=3<=6 so we would discard the 5. Now if it were a king and a 2 then we would keep the king and have to add 2 to the king to get 2 modulo 13. Now this D will be given using the remaining 3 cards which using the ranking method determined at the begining we can order them in one of 3!=6 ways. So now A and B agree before hand on a numeric value for each possible permutation such as
1: 123 2: 132 3: 213 4: 231 5: 312 6: 321
then simply place the kept card of the 2 first (on top) and order the rest according to the desired value of D. So in my example we would start with the 5clubs then since we need D=3 then we use 213 and that would give us 10spades 6hearts and Kdiamonds.
So using my example working backwards as B we start by looking at the top card, seeing its a club, so we would know the desired card is a club and we need to add a number to 5 to get its value. We look at the other 3 and see it corresponds to D=3 and thus we know the value to be 5+3=8 and thus we would know the discarded card was the 8 of clubs.

Posted by Daniel
on 20090529 14:25:22 