# Secret number magic trick

Welcome to the magic show. First the magician is blindfolded. Now the assistant asks 4 members of the audience to write 4 distinct numbers between 1 and 9 (inclusive) on the back of 4 cards. The numbers are shown to the assistant and the audience. Now the audience is asked to hide one of the cards. The blindfold is taken off the magician. The assistant gives them the remaining 3 cards in some specific order. After some deliberation, the magician names the number on the missing 4th card. They are correct and the audience is stunned! The audience asks the magician to repeat the trick with a different set of 4 numbers (between 1 and 9). They do it again!

How did the magician and their assistant perform the magic trick?

Notes:

• The magician knows that all numbers are distinct and are between 1 and 9, inclusive.
• There are no tricks like hidden cameras, or extra communication between the magician and the assistant - this is a pure puzzle in logic / mathematics.
• See A five card trick - How does it work? for the classic version with 5 playing cards from a 52 card deck, but where the assistant chooses which card to retain. Feb 29 at 8:09
• rot13(Gurer ner fvk crezhgngvbaf bs guerr ivfvoyr pneqf 'pubvpr(1,3)' naq fvk uvqqra pneqf fb jr fubhyq or noyr gb rfgnoyvfu n bar-gb-bar rapbqvat urer jvgu gur crezhgngvba beqre. Vf gurer zber gb vg guna gung?) Feb 29 at 20:19

This seems a little too obvious, so maybe I'm missing something:

There are six possibilities for the missing number, and there are six ways for the assistant to order the remaining three cards.
So all the magician and assistant need to do is agree on a mapping from card order to unshown numbers.

E.g: If we call the numbers on the revealed cards S(mall), M(edium) and L(arge), and label the possibilities for the missing number from A (smallest) to F (largest). Then the following mapping works:

Card order  Missing number
S,M,L       A
S,L,M       B
M,S,L       C
M,L,S       D
L,S,M       E
L,M,S       F

• Wow that was super quick! Perhaps it was too obvious. Anyway well done. Feb 28 at 14:41