Magic Trick
When I was a kid, around 10 or so, my father taught me a magic trick
using 21 cards from a regular deck of cards. Of course, I had to write
a computer program to share his magic powers. Enjoy!
Rules of the game:
1. Click the "Play Game" button.
1. Pick a card from the 21 cards displayed.
2. Click on the button beside the pile your card is in. (Don't forget
your card.)
Since the trick depends on card counting, I'm thinking
there is a mathematical proof as to why it works every time. If you
know of one or want to give it a shot, let
me know.
Update of Mathematical Proof (July 14, 2004)
I got an email from someone named Vicki Aka Vajoker (from somewhere
in the world) with a mathematical proof for this trick. This person
pointed me to the book: Mathematics, Magic and Mystery, by Martin
Gardner, where he/she found an explanation of how it works.
It is not magic after all, and the explanation has to do with something
called contraction maps. I guess I now know now my dad didn't
use magic for this trick, but I'm at still hoping that Santa exists.
I want to believe. :)
This is the theorem:
Contraction Mapping Theorem. If (X, d) is a complete
metric space and T : X -> X is a contraction mapping, then T has
one and only one fixed point (i.e., there exists exactly one x belonging
to X such that T(x) = x.
Aside from solving tricks, the Contraction Mapping
Theorem is also used for proving the existence and uniqueness of solutions
of integral and differential equations. Who said Linear Algebra is useless--Mmhh,
Eigenvalues...
If you are interested in a proof, I'm sure you'll find something in google.
Source Code
One last thing
I have to clarify that when I coded the Java applet I didn't know about
the Contraction Mapping Theorem. Thus, the code is stricly following the
rules as they were explained to me by my dad. So the code is neither a
Mathematical proof nor a direct implementation of the Linear Algebra involved.
I'd think Maple would do a better job at visualizing something like this,
rather than a card trick. However, I'm still amazed how everything
is connected and how a simple game can be used to explain complex mathematics. |