MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am interested in magic tricks whose explanation requires deep mathematics. The trick should be one that would actually appeal to a layman. An example is the following: the magician asks Alice to choose two integers between 1 and 50 and add them. Then add the largest two of the three integers at hand. Then add the largest two again. Repeat this around ten times. Alice tells the magician her final number $n$. The magician then tells Alice the next number. This is done by computing $(1.61803398\cdots) n$ and rounding to the nearest integer. The explanation is beyond the comprehension of a random mathematical layman, but for a mathematician it is not very deep. Can anyone do better?

share|cite|improve this question
I am informed that Persi Diaconis is the correct person to answer this question. – Sam Nead Dec 26 '09 at 0:09
I have discussed this question with Persi. He could not come up with anything significant (though he did not think about it very long). – Richard Stanley Dec 26 '09 at 16:30
I've also heard Persi talk about this subject, and my guess is that he would say that the requirements of "deep mathematics" and "would actually appeal to a layman" are nearly incompatible in practice. – Mark Meckes Dec 27 '09 at 13:54
I don't think they should be incompatible: the deep mathematics are the reason the trick works; you don't have to understand them to be stunned by the trick! – Sam Derbyshire Jan 17 '10 at 17:06
Whenever I see this question's title, I can hardly resist opening a complementary "Deep mathematics based on magic tricks" community wiki. – Torsten Schoeneberg May 16 '13 at 7:51

44 Answers 44

You may ask the person to encode something by RSA, then you decode it (you have the private key)


To divide two 40-digit integers and give you the decimal result to 100 digits, you then use continued fractions to find the original fraction (reduced)


To compute pq and pr where p,q,r are prime, you then find p,q,r by the Euclidean algorithm (no very deep, but it's the best i've got)

share|cite|improve this answer

A variant on Anton Geraschenko answer above- say you are in a fourth grade school that for some reason let these poor kids use calculators. you ask them to pick for themselves a 3 digit number say abc. Tell them to write it twice in their calculator ,i.e., abcabc and then divide by 77. Then by 13. What did you get? do it again with 143 and then by 7? What did you get. again with...

It teaches them about prime decomposition, about the decimal structure, about consecutive division etc.

I learnt it from Avraham Arcavi.

share|cite|improve this answer
The title is, "Magic trick based on deep mathematics." I don't think that was meant to be taken as "deep to 4th graders." – Gerry Myerson Nov 17 '10 at 0:05

Here is a trick much in the spirit of the original number-adding example; moreover I'm sure Richard will appreciate the type of "deep mathematics" involved.

On a rectangular board of a given size $m\times n$, Alice places (in absence of the magician) the numbers $1$ to $mn$ (written on cards) in such a way that rows and columns are increasing but otherwise at random (in math term she chooses a random rectangular standard Young tableau). She also chooses one of the numbers say $k$ and records its place on the board. Now the she removes the number $1$ at the top left and fills the empty square by a "jeu de taquin" sequence of moves (each time the empty square is filled from the right or from below, choosing the smaller candidate to keep rows and columns increasing, and until no candidates are left). This is repeated for the number $2$ (now at the top left) and so forth until $k-1$ is gone and $k$ is at the top left. Now enters the magician, looks at the board briefly, and then points out the original position of $k$ that Alice had recorded. For maximum surprise $k$ should be chosen away from the extremities of the range, and certainly not $1$ or $mn$ whose original positions are obvious.

All the magician needs to do is mentally determine the path the next slide (removing $k$) would take, and apply a central symmetry with respect to the center of the rectangle to the final square of that path.

In fact, the magician could in principle locate the original squares of all remaining numbers (but probably not mentally), simply by continuing to apply jeu de taquin slides. The fact that the tableau shown to the magician determines the original positions of all remaining numbers can be understood from the relatively well known properties of invertibility and confluence of jeu de taquin: one could slide back all remaining numbers to the bottom right corner, choosing the slides in an arbitrary order. However that would be virtually impossible to do mentally. The fact that the described simple method works is based on the less known fact that the Schútzenberger dual of any rectangular tableau can be obtained by negating the entries and applying central symmetry (see the final page of my contribution to the Foata Festschrift).

share|cite|improve this answer

Destination Unknown is a magic trick that makes use of Combinatorics. It really fools people.


share|cite|improve this answer

Although one of the answers mentions Kruskal count, I would like to add more about it. Kruskal count not just works in the case of a paragraph as well. If you start from one of the first ten words of a paragraph, go to the word which is away from the previous word by number of words exactly equal to the letters of the previous word, you'll land up on the same word in the end! For more discussion, you can refer this link

share|cite|improve this answer

My favourite example, the rope and two carabiner trick

I also offer up my variation of the Dirac belt trick

share|cite|improve this answer

Apart from tricks based on numbers, there are topological objects whose properties can seem quite magical, like the Möbius strip or the unknot.

E.g. take a standard page of paper, show that it has two sides (number them with a pen, show that any straight pen path meets a boundary). Next, cut out a long strip from it (not needed of course, but adds to the drama), and ask the audience "and how many sides does this have?". They reply "two". Then you put the the two small ends of the strip together to form a ring and you ask "and now, how many sides?", they still reply "two!". At this point do a little diversion, like putting a pair of scissors on the table saying out loud "I'll use this in a minute". Now do a half-twist with the strip before putting the small ends together and ask again "for the last time people, how many sides?". They answer "twoo!!", and you say "the magic has worked people, there's only one side!" (you show that now the pen paths along the long direction never meet a boundary and come back). Most laymen are quite bemused. Now do two half-twists and ask again, some won't dare an answer...

share|cite|improve this answer
Have an assistant cut a cylinder in half along its median circle. Then cut a Mobius strip along its median. – Douglas Zare Jan 17 '10 at 23:08

Here's a couple of well-known simple topology tricks:

Tie ends of a long enough piece of rope to your wrists, while wearing a loosely fitting jacket or sweatshirt. With your arms tied like that, take the jacket off your back and put it back on inside out. It's easier to figure out how to do it than to explain it in words, so I'll skip the explanation. The more risque version is to tie the ankles and do the trick with pants.

The other one I haven't tried, but maybe it can be done at a party if you have a stick and some plasticine around.

share|cite|improve this answer

If you are not mathematically inclined, this game can drive you crazy.

share|cite|improve this answer

The "casting out nines" sanity check of calculations is dead simple to use (a small child can do it), but the proof requires a deeper knowledge of mathematics (more precisely of arithmetic ; my own students don't have access to it even though they know what series are and can diagonalize matrices!).

share|cite|improve this answer

i was about the to post another trick based on binary encoding in radices (or hamming codes) which has already been posted (see comment as well)

So i will post another one based on cyclic orderings (known also as "The Fitch Cheney Five-Card Trick")

excerpt (from here):

You hand a deck of cards to an audience and tell them to choose any five cards they wish. You collect the ve cards, look at them quickly, and then ask a volunteer to hide one of the cards after showing it to the audience. You place the remaining four cards face up in a line. You then tell someone in the room to go to the door and fetch your partner, who has been waiting outside. You take a seat in the back of the room somewhere out of sight. Your partner enters, takes a look at the four cards displayed, and correctly calls out the hidden card! Applause follows.

share|cite|improve this answer
Already here,… – Gerry Myerson Mar 1 '15 at 4:54

How about the "Flash Mind Reader"

share|cite|improve this answer
No, that one is dumb. – Harry Gindi Jan 17 '10 at 22:42
No, that one isn't dumb, but it's more about psychology than about mathematics (like most tricks with cards). – Konrad Voelkel Feb 7 '10 at 13:58

Lay out 21 cards face up in three vertical lines. Have a friend pick out any card without telling you which card he/she has chosen. Have your friend tell you which line of cards the selected card is in, and make three stacks of cards, each stack being made from each line of cards. stack the three stacks on top of each other, placing the stack with the selected card between the other two stacks (IMPORTANT!). lay out the cards again in the exact same set up (3 lines of 7 all face up) but here is the trick: when laying out the cards, flip them face up in a line every time. In other words, don't make one line at a time, but put a card in every line one at a time. Have your friend again tell you which line has the selected card. Stack the cards again, the exact same way you did the first time. One more time, lay out the cards the exact same way as the last time, one card per line, and again have your friend tell you which line has the selected card. Stack all the cards again one last time, again placing the line with the selected card between the other stacked cards. now lay out all the cards face down, one at a time. while you're doing this, remember to count, because the 11th card you place down is the selected card. from this point you can do whatever you can think of to make the trick "magical" and shock your friend by suddenly coming up with his/her card.

share|cite|improve this answer

Start with a deck of 32 cards. Then the player should take a card and tell a number $n$ between 1 and 32 then you divide the stack in 2 smaller stacks and the player has to tell which of the stacks contains his chosen card. according to a rule dependend on that number you put that stack above or below the other stack. After repeating this 5 times the chosen card should be exactly at position $n$. The rule has to depend on the way you want to deal cards (whether you turn around the deck and start dealing from the bottom, or you deal from the top and turn each single card around or you deal at first and then turn bost stacks around). In one of the cases the rule was take $N-11$, find the representation in the system with base $-2$ and revert that presentation. ($0$ tells you to put the stack containing the chosen card on top, etc.). I dont remeber this trick properly, it should not be too difficult to express the final position depending on the choices in some formula; but it is the only situation I know, in which the $-2$-system is useful.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.