Magic trick based on deep mathematics



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 layperson, but for a mathematician it is not very deep. Can anyone do better?

Richard Stanley

Posted 2009-12-25T22:07:11.903

Reputation: 26 417

1Flagged for community wiki. – Harry Gindi – 2009-12-26T00:03:57.970

44I am informed that Persi Diaconis is the correct person to answer this question. – Sam Nead – 2009-12-26T00:09:37.920

18I 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 – 2009-12-26T16:30:43.397

16I'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 – 2009-12-27T13:54:31.517

3I 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 – 2010-01-17T17:06:56.657

1The key part of my comment was "in practice". Empirically, the tricks based on math mostly just don't turn out to be as entertaining to most people as more traditional sleight-of-hand, etc. Or so I've heard Persi say. – Mark Meckes – 2010-01-20T14:28:31.557

1The Fibonacci trick in the question is a great idea. I have computed just how large the initial numbers can be allowed to be so that it provably works. Assuming integers in the range $1$ to $N$ are taken, effectively in increasing order (by the stipulation to add the largest two), and $n$ iterated additions are done, then the requirement is $N<\phi^{n+1}/2+\phi$. This means for $n=10$ one can take $N=101$ (in practice one would allow numbers up to $100$). Indeed the pair $(1,101)$ gives $9044$ after $10$ additions, and $\phi*9044\approx14633.4994$, the next number is $14633$. – Marc van Leeuwen – 2012-03-05T15:38:36.527

Personally, with a bit of thought one can make almost all mathematics "deep." Case in point: Whitehead's and Russell's Principia Mathematica. While it does not contain (I think) any actual tricks, there are some extremely useful and fun things interspersed throughout Math: From the Birth of Numbers by Jan Gullberg that could potentially be developed into magic tricks. – Ian Durham – 2010-02-02T22:36:52.880

Well, how you've put your question is certainly a nice trick to generate much page views. – Gerard – 2012-09-15T14:37:08.517

5Whenever I see this question's title, I can hardly resist opening a complementary "Deep mathematics based on magic tricks" community wiki. – Torsten Schoeneberg – 2013-05-16T07:51:38.897


Steven Rudich is also a good person to ask. He used to begin his undergraduate discrete math / theoretical computer science course with magic tricks.

– Shiva Kaul – 2010-04-26T05:27:41.747

Since someone else bumped this, I removed the "tag-removed" tag, which should not be used in combination with other tags since it means no tag fits. – Douglas Zare – 2010-04-28T02:09:09.263

5Isn't it risky to do magic tricks that require a member of the audience to carry out a computation? What do you do if Alice botches the computation? – bof – 2014-12-08T07:04:24.930

1Concerning the example mentioned in the question: the magician can do better. He can tell Alice which two numbers she started from (once the next number is computed, follow the algorithm backwards). – André Henriques – 2010-06-14T16:34:55.650



"The best card trick", an article by Michael Kleber. Here is the opening paragraph:

"You, my friend, are about to witness the best card trick there is. Here, take this ordinary deck of cards, and draw a hand of five cards from it. Choose them deliberately or randomly, whichever you prefer--but do not show them to me! Show them instead to my lovely assistant, who will now give me four of them: the 7 of spades, then the Q of hearts, the 8 of clubs, the 3 of diamonds. There is one card left in your hand, known only to you and my assistant. And the hidden card, my friend, is the K of spades."

Sam Nead

Posted 2009-12-25T22:07:11.903

Reputation: 10 750

8I have done that trick once. The audience was a high shcool class. When I announced the fifth card, that was an ovation, a success beyond my hopes. Then I explained the combinatorial trick and asked the best-in-maths scholar to reproduce it; and he did! – Denis Serre – 2011-11-10T09:57:57.517

25Martin Gardner gave an interesting variant of this in one of his books, where the volunteer also gets to choose which 4 of the 5 cards the assistant hands to the mathematician. This seems like only 4!=24 pieces of information to convey one of 48 cards: the extra bit is whether the assistant passes the cards right side up or upside down. – David E Speyer – 2010-02-02T13:19:22.270

By the way, your link seems to need a login. Here is the same trick, written up by a different author:

– David E Speyer – 2010-02-02T13:20:13.890

1I've tried to fix the link (again). – Sam Nead – 2010-02-02T15:40:37.750

1So far I've read only the abstract. It strikes me that the assistant can choose not only one of 24 orders in which to hand you the four cards, but also which four to give you. That's additional information. But I still don't know how it's going to work. – Michael Hardy – 2014-07-15T00:44:14.797

4That's a really nifty trick... I wonder if I can find an "assistant" to help me run this soon! – Gwyn Whieldon – 2010-05-16T07:48:55.357


The maintainer of the Numericana page e-mailed me to say that is a more stable link.

– David E Speyer – 2010-10-10T20:27:50.987


This was fascinating for me. Somehow the man takes a bagel and with one cut arrives with two pieces that are interlocked. Whether this qualifies as "magic" I dunno (it's hard to say once the trick's been explained), but it sure seems like it to me.

It doesn't hurt that I love bagels, and have the opportunity to perform this with friends/family/non-math people and can teach a little about problems/topology/counter-intuitive facts about the universe.

Ben Weiss

Posted 2009-12-25T22:07:11.903

Reputation: 1 098

1As soon as I saw the first image in the link I thought "this must be a toral knot of type $(1,1)$ !" (or how knot theorists call those beasts..) – Qfwfq – 2011-11-08T02:26:20.983

14I was amused by the connected bagel that resulted when my friend cut along a Mobius strip instead of a full-twisted strip. – Elizabeth S. Q. Goodman – 2010-02-11T06:50:05.740

@Qfwfd: I think it was a Hopf link on the surface of the bagel, and Hopf's link Seifert surface inside the bagel. – Michael – 2013-09-12T17:00:59.707

@ElizabethS.Q.Goodman: The cut should be full twist to produce 2 interlocked slices. A Mobuis cut would produce a single slice that's twice as long as the bagel. That's because, well, Mobius strip has one side, and therefore both sides of the Mobius cut belong to the same slice. – Michael – 2015-03-02T21:55:35.320

Exactly Michael, unfortunately he didn't know that until after the fact. – Elizabeth S. Q. Goodman – 2015-06-02T04:42:10.160


Five unrelated items:

Mobius strip

One of the best mathematical tricks is what happens when you cut a Mobius strip in the middle. (Look here) (And what happens when you cut it again, and when you cut it not in the middle.) This is truly mind boggling and magicians use it in their acts. And it reflects deep mathematics.

Diaconis mind reading trick

I also heard from Mark Gorseky this description of a mathematical based card game

"Mark described a card trick of Diaconis where he takes a deck of cards, gives it to a person at the end of the room, lets this person “cut” the deck and replace the two parts, then asks many other people do the same and then asks people to take one card each from the deck. Next Diaconis is trying to read the mind of the five people with the last cards by asking them to concentrate on the cards they have. To help him a little against noise coming from other minds he asks those with black cards to step forward. Then he guesses the cards each of the five people have.

Mark said that Diaconis likes to perform this magic with a crowd of magician since it violates the basic rule: “never let the cards out of your control”. This trick is performed (with a reduced deck of 32 cards) based on a simple linear feedback shift register. Since all the operations of cuting and pasting amount to cyclic permutations, the 5 red/black bits are enough to tell the cylic shift and no genuine mind reading is required."

I think there is a paper by Goresky and Klapper about a version of this magic and relations to shift registers.

The Link Illusion

I heard a wonderful magic from Nahva De Shalit. You tie a string between the two hands of two people and link the two strings. The task is to get unlinked.

This ties with what I heard from Eric Demaine about the main principle behined many puzzles (Some of which he manufectured with his father whan he was six!)

Symmetry Illusion

Sometimes things are not as symmetric as they may look.

commutators-based magic

(I heard this from Eric Demaine and from Shahar Mozes.) If we hang a picture (or boxing gloves) with one nail, once the nail falls so does the picture. If we use two nails then ordinarily if one nails falls the picture can still hangs there. Mathematics can come for the rescue for the following important task: use five nails so that if any one nail falls so does the picture.

alt text

Gil Kalai

Posted 2009-12-25T22:07:11.903

Reputation: 12 545

1+1 for the Diaconis mind reading trick. – Eric Naslund – 2011-10-13T11:36:25.313


For the hanging trick, there is a spoiler on Alex Eremenko's homepage:

– Margaret Friedland – 2011-11-07T19:56:17.750

The hanging problem is hard to understand correctly unless it is mentioned that the picture is hanged on a rope that goes from one corner to another. And btw, the word "commutator" is a terrible spoiler. – Alexander Shamov – 2012-09-16T14:09:33.047

I haven't heard the term linear feedback shift register, but I think this is equivalent to a de Bruijn sequence:

– Ian Agol – 2010-03-11T21:26:11.143

Look here it is not deBruijn sequences

– Gil Kalai – 2010-03-12T08:09:02.393

It is deBruijn sequences - the "sequence" is a list of five reds or blacks in a row, with red=0, black=1. The deck doesn't have all 52 cards, but (I believe) the 32 cards necessary, arrange in one of the B(2,5) sequences. Persi asks an audience member to shuffle the cards (cyclically) as many times as he or she wants, then hand out five cards (in order) to five people. – Gwyn Whieldon – 2010-05-16T00:31:45.903

4They stand up if they have a red card and stay seated if they have a black card. That'll tell him (for example) that he's looking at the sequence of cards corresponding to 01100 or 11001, etc. He has the cyclic order of the cards he handed out memorized, and just reads of the corresponding card names. – Gwyn Whieldon – 2010-05-16T00:31:51.163

The "Link illusion" link seems to be broken. – S. Carnahan – 2015-10-25T01:40:53.747


I saw this trick demonstrated at a math camp once. When it works, it is extremely impressive to non-mathematicians and mathematicians alike.

Have a volunteer shuffle a deck of cards, select a card, show it to the audience, and shuffle it back into the deck. Take the deck from him, and fling all of the cards into the air. Grab one as it falls, and ask the volunteer if it is his card.

1 in 52 times (this is the deep mathematics part), the card you grab will be the card the volunteer selected. Even most statisticians should be amazed at this feat. Just make sure you never perform this trick twice to the same audience.


Posted 2009-12-25T22:07:11.903

Reputation: 4 918

23 – Ryan Reich – 2011-11-07T20:34:40.663

8Well, 51 in 52 times (this is an equally deep mathematical part), the trick won't work. – Michael – 2013-09-12T17:09:13.190

5This is brilliant! – Qiaochu Yuan – 2010-06-15T10:15:09.363


Persi Diaconis and Ron Graham just published Magical Mathematics. The book contains a plethora of magic tricks rooted in deep mathematics.

Sami Assaf

Posted 2009-12-25T22:07:11.903

Reputation: 1

2Dear Sami, Welcome to MO – Gil Kalai – 2011-11-07T19:42:13.970


Sam Nead

Posted 2009-12-25T22:07:11.903

Reputation: 10 750

Hey! I saw this trick in a book of card tricks when I was a kid... I never knew it was invented by Kruskal! – Vectornaut – 2010-04-26T05:35:01.340


The following trick uses some relatively deep mathematics, namely cluster algebras. It will probably impress (some) mathematicians, but not very many laypeople.

Draw a triangular grid and place 1s in some two rows, like the following except you may vary the distance between the 1s:

1   1   1   1   1   1   1
  .   .   .   .   .   .
.   .   .   .   .   .   .
  .   .   .   .   .   .
.   .   .   .   .   .   .
  .   .   .   .   .   .
1   1   1   1   1   1   1

Now choose some path from the top row of 1s to the bottom row and fill it in with 1s also, like so:

1   1   1   1   1   1   1
  1   .   .   .   .   .
.   1   .   .   .   .   .
  1   .   .   .   .   .
.   1   .   .   .   .   .
  .   1   .   .   .   .
1   1   1   1   1   1   1

Finally, fill in all of the entries of the grid with a number such that for every 2 by 2 "subsquare"

a   d

the condition $ad-bc=1$ is satisfied, or equivalently, that $d=\frac{bc+1}{a}$. You can easily do this locally, filling in one forced entry after another. For example, one might get the following:

1   1   1   1   1   1   1
  1   2   3   2   2   1
.   1   5   5   3   1   .
  1   2   8   7   1   .
.   1   3   11  2   1   .
  .   1   4   3   1   .
1   1   1   1   1   1   1

The "trick" is that every entry is an integer, and that the pattern of 1s quickly repeats, except upside-down. If you were to continue to the right (and left), then you would have an infinite repeating pattern.

This should seem at least a bit surprising at first because you sometimes divide some fairly large numbers, e.g. $\frac{5\cdot 11+1}{8} = 7$ or $\frac{7\cdot 3+1}{11} = 2$ in the above picture. Of course, the larger the grid you made initially, the larger the numbers will be, and the more surprising the exact division will be.

Incidentally, if anyone can provide a reference as to why this all works, I'd love to see it. I managed to prove that all of the entries are integers, and that they're bounded, and so there will eventually be repetition. However, the repetition distance is actually a simple function of the distance between the two rows of 1, which I can't prove.


Posted 2009-12-25T22:07:11.903

Reputation: 2 361


The fact you are looking for is that, in a finite type cluster algebra, if you mutate each vertex once in the order given by the orientation of the Dynkin diagram, the resulting operation has period h+2, where h is the Coxeter number. See

– David E Speyer – 2010-02-02T13:28:29.823

7I'm not sure what level you want an answer on. My preferred proof for this particular case is to notice that the numbers you are getting are the Plucker coordinates of a point in G(2,n), and that presentation makes it obvious that they will be periodic modulo n. – David E Speyer – 2010-02-02T13:31:31.677


For those who might be interested in information about the mathematics of "freeze patterns" you can start with the references here:

and there are additional ones via Mathscinet.

Perhaps surprisingly this circle of ideas is related to triangulated plane polygons.

– Joseph Malkevitch – 2010-02-06T17:09:26.530

Worth noting long after the fact: a version of this frieze pattern also works with nim-addition rather than multiplication (i.e., $a\oplus d = (b\oplus c) + 1$) and can acutally be applied to computing the values of positions in Welter's game; this shows up, IIRC, in On Numbers And Games. – Steven Stadnicki – 2016-06-07T00:14:01.360


A late addition: The Fold and One-Cut Theorem. Any straight-line drawing on a sheet of paper may be folded flat so that, with one straight scissors cut right through the paper, exactly the drawing falls out, and nothing else. Houdini's 1922 book Paper Magic includes instructions on how to cut out a 5-point star with one cut. Martin Gardner posed the general question in his Scientific American column in 1960.

For the proof, see Chapter 17 of Geometric Folding Algorithms: Linkages, Origami, Polyhedra. We include instructions for cutting out a turtle, which, in my experience, draws a gasp from the audience. :-)

Joseph O'Rourke

Posted 2009-12-25T22:07:11.903

Reputation: 79 882


The coffee mug trick

Give a coffee mug (full if you're brave) to someone and ask them to rotate 360 degrees without spilling the (real or imaginary) coffee, so that their hand ends up in the same position.

This is impossible, so you get to smirk while they contort themselves and become more and more baffled (this works better with more than one person since it turns into a kind of "competition")

Finally, take the cup and show that while it's impossible to turn it once (as has been "proven"), it's possible to turn it twice (!) and end up in the same position.

Has to do with the fundamental group of SO(3) being $\mathbb{Z}/2\mathbb{Z}$, and when we require the cup to stay upright we end with a non-trivial loop.

Adam Gal

Posted 2009-12-25T22:07:11.903

Reputation: 433

4And then, you pretend that the mug is an electron and your arm tracks its spin. – Elizabeth S. Q. Goodman – 2011-11-08T07:04:45.567

8An easier solution than the plate trick: Stand up, pick up the mug, and walk in a circle around it. – Sam Nead – 2012-04-07T14:44:31.883

1Sometimes called the "plate trick" or the "belt trick". – Sam Nead – 2010-10-11T08:54:47.187


Here is a general trick that you can use to make yourself look like you have an amazing memory.

Start with a finite abelian group $(G,+)$ in which you are comfortable doing arithmetic. Be sure to know the sum $$g^* = \sum_{g \in G} g.$$

Take a set $S$ of $|G|$ physical objects with an easily computable set isomorphism $$ \varphi : S \longrightarrow G.$$ Allow your audience to remove one random element from $a \in S$ and then shuffle $S$ without telling you what $a$ is. [Shuffling means we need $G$ to be abelian.]

Now inform your audience that you are going to look briefly at each remaining element of $S$ and remember exactly which elements you saw, and determine by process of elimination which element of $S$ was removed.

Now glace through all the remaining elements of $S$ one by one and keep a "running total" to compute $$ \varphi(a) = g^* - \sum_{s \in S-\{a\}} \varphi(s).$$

Finally apply $\varphi^{-1}$ and obtain $a.$

Note that $\varphi$ is not "canonical" in the sense there are definitely choices to be made. On the other hand in should be "natural" in the sense that you should be very comfortable saying $s = \varphi(s).$

The prototypical example is to take $G$ to be $\Bbb Z / 13 \Bbb Z \times V_4,$ $S$ to be a standard deck of 52 cards, and $\varphi(s)$ to be $( \text{rank}(s) , \text{suit}(s) )$.

Jamie Weigandt

Posted 2009-12-25T22:07:11.903

Reputation: 2 373

am I missing something or is $\sum_{g\in G}g$ always the unit element in the abelian group $(G,+)$? – Toink – 2013-05-12T19:37:50.810

2The sum of all elements of a finite abelian group is non-zero if and only if the 2-Sylow subgroup of this group is a nontrivial cyclic. – Anton Klyachko – 2013-05-12T22:39:12.433

What's the obvious group operation on suits? – Qiaochu Yuan – 2010-06-15T10:08:18.927

It's not canonical, but once you choose an identity e there is a unique operation isomorphic to the Klein four group. Use the following rules about working in V_4. 1. a + e = e + a = a for all a in V_4. 2. a + a = e for all a in V_4. 3. If a and b are distinct nonidentity elements then their sum is the third distinct nonidentity element. This does the trick. I usually take e to be Spades, but it doesn't really matter. – Jamie Weigandt – 2010-06-18T22:56:53.133


This trick exploits the thinness of coins.

Patrick Tam

Posted 2009-12-25T22:07:11.903

Reputation: 1

2I remember this - a nice trick! Very similar to betting someone "I can walk through this piece of paper." [Holding up a piece of letter paper]. So this is a real mathematical trick; it uses the interaction between length and area. Is there a way to make a deeper version? – Sam Nead – 2010-01-17T14:38:53.077


You can use hamming codes to guess a number with lying allowed. For example, here is a way to guess a number 0-15 with 7 yes-or-no questions, and the person being questioned is allowed to lie once. (The full cards are here).


Posted 2009-12-25T22:07:11.903

Reputation: 11

i was going to post a similar "mind-reading" card trick which uses binary encoding (in radices) and finds the user card in 3-4 questions. But there is a variation of this trick as in here for example where the trick is that the original cards are totaly different from the final cards shown (so it will always work), But they look alike because they share some of the same bits (e.g color or card symbol)

– Nikos M. – 2015-03-01T01:59:02.313


Here is a card trick from Edwin Connell's Elements of Abstract and Linear Algebra, page 18 (it can be found online). I always do this trick to my undergraduate number theory class in the first minutes of the first day. A few weeks later, after they've learned some modular arithmetic, we come back to the trick to see why it works. I quote from Connell:

"Ask friends to pick out seven cards from a deck and then to select one to look at without showing it to you. Take the six cards face down in your left hand and the selected card in your right hand, and announce you will place the selected card in with the other six, but they are not to know where. Put your hands behind your back and place the selected card on top, and bring the seven cards in front in your left hand. Ask your friends to give you a number between one and seven (not allowing one). Suppose they say three. You move the top card to the bottom, then the second card to the bottom, and then you turn over the third card, leaving it face up on top. Then repeat the process, moving the top two cards to the bottom and turning the third card face up on top. Continue until there is only one card face down, and this will be the selected card."

When I do this trick, I always use big magician's cards (much easier for an audience to see), but a regular deck works too. To get to the trick faster, I skip the first part and just pick 7 cards myself, showing them all the cards so they see nothing is funny (like two ace of spades or something). I then spread the cards in one hand face-down and let a student pick one and show it to everyone else but me before I take it back face down. When the student is showing the cards to the class I move the rest of the cards behind me so that before I get the card back I already have the rest behind my back.

You need to make sure students at the side of the room won't be able to see what you're doing behind your back (namely, putting the mystery card on the top of the deck), so stand close to the board. Practice this with yourself many times first to be sure you can do it without screwing up. The hard part is remembering to keep the last card you reached in the count on the top of the deck; that same card will be used when you start the count in the next round. If you stick it on the bottom before counting off cards again then you'll mess everything up. For instance, if someone picks the number 3 then I start counting from the top of the deck and say (with hand movements in brackets) "One [put it under], two [put it under], three [turn it over, put it on top FACE UP and stop]. This [show face-up card to everyone] is not your card. [Put it back face-up on top] One [now put it under], two [put it under], three [turn over and put on top FACE UP and stop]. This etc. etc."

Connell advises telling people to pick up a number from 1 to 7 but not allow 1. In practice there's no need to tell people not to pick 1. They never do (it's never happened to me). They don't pick 7 either. And if they did pick 1, well, just turn over the top card and you're done! Again, that never really happens.


Posted 2009-12-25T22:07:11.903

Reputation: 27 105

Couldn't you just say 2 to 7? – PyRulez – 2015-07-15T13:01:45.790

I wouldn't because that sounds artificial. – KConrad – 2015-07-18T14:19:50.607

So does 1 to 7 except 1. – PyRulez – 2015-07-19T01:15:42.807

Sure, and I wouldn't say that either. Read again what I wrote in the last paragraph of my answer: when doing the trick I tell people to pick a number from 1 to 7. They've never picked 1. – KConrad – 2015-07-19T08:32:54.753


The coffee mug trick is also called the Philipine Wine Trick and should be related to the Dirac String Trick, which you can find by a web search, for example here and also in my presentation Out of Line, where rotations in 3-space are related to the Projective Plane.

A knot trick, I am not sure you would call it magic, has been shown to children and academics in many places. It requires a pentoil knot of width 20" (say 100cm) made of copper tubing, about 0.25" (7mm) diameter (made by a university workshop) shown in the following diagram, but without the arrows and labels:


It also needs some nice flexible boating rope. The rope is wrapped round the $x,y$ pieces according to the rule $$R=xyxyxy^{-1}x^{-1}y^{-1}x^{-1}y^{-1} $$ and the ends tied together, as in the following picture:


A member of the audience is then invited to come up and manipulate the loop of rope off the knot, starting by turning it upside down. This justifies the rule $R=1$. Of course the rule is the relation for the fundamental group of complement of the pentoil, which can, for the right audience, be deduced from the relations at each crossing given by the diagram


and can be easily demonstrated with the knot and rope. (The picture has no base point and so seems to me related more to the notion of fundamental groupoid than fundamental group.)

It is also of interest to have a copper trefoil rather than pentoil around to compare the relations. One warning: the use of rope does not really model the fundamental group or groupoid, so be careful with a demo for the figure eight knot!

I did the demo for one teenager and he said:"Where did you get that formula?" This demo knot has been well travelled, for many different types of audience; on one occasion the airline lost my luggage with the rope and I had to ask the taxi from the airport to to stop at a hardware store for me to buy d=some clothesline. I devised this trick for an undergraduate course in knot theory in the late 1970s.

You can also see a Knot Exhibition whose aim is to use the notion of knot to explain some basic methods of mathematics to the general public.

Ronnie Brown

Posted 2009-12-25T22:07:11.903

Reputation: 9 589


Audience asked to choose an integer from 0 to 1000. Ask to give remainder when divided by 7, 11, and 13 respectively.

Magician gives original integer by Chinese Remainder Theorem.

Works because 7×11×13=1001.


Posted 2009-12-25T22:07:11.903


1You mean 13, not 3. 13x7x11 = 1001. – Jason DeVito – 2009-12-26T03:41:14.740

2I've changed the 3 to a 13. @Jason: since the post is Community Wiki, you could have changed the 3 to a 13 as well. – Anton Geraschenko – 2009-12-26T06:56:32.400

I'm still not used to the community wiki mode - but I'll try to keep it in mind for the future. Thanks! – Jason DeVito – 2010-01-04T02:42:07.390


I gave a talk about card shuffling to a general audience recently and wanted to memorise a "random-looking" deck so as to motivate a correct definition of what it means for a deck to be random. Most magicians actually use memory tricks to learn off the deck but I thought it would be much cleverer to order the cards in the obvious way, and then find a recursive sequence of length 52 containing all of 1 to 52. In the end, caught for time I settled on using the Collatz recursive relation with seed 18 --- this allowed me to name off 21 distinct cards effortlessly and when I held up the deck prior to the demonstration, the audience voted that the deck was random. Can anyone think of a suitable recursive sequence with the desired property? We can either take a random-looking order and a "regular" recursive sequence but I think it would be much better to find an easy to compute recursive sequence that "looks random" when using a more canonical order simply because if we can remember a "random looking order" we're pretty much going to have to remember the whole deck --- the problem I'm exactly trying to avoid.

PS: I did one of the simpler Diaconis tricks. A deck is riffle shuffled three times, the top card shown to the audience, inserted into the deck, and after laying the cards out on the table the top card can be easily recovered by looking at the descents. The key is that the order of the deck is known beforehand --- a simple demonstration that three shuffles does not suffice to mix up a deck of cards (with respect to variation distance).

Jp McCarthy

Posted 2009-12-25T22:07:11.903

Reputation: 104


I would like to thank all the contributors on this page. I have been putting together a new Math-a-Magic show for the 9-12 grade level and have found some fantastic material here. If I get a decent video of the show I'll be sure to post a link here so you can play the "What concept is behind this trick?" game.

I have modified some of your ideas severely. For example. Craig Feinstein's suggestion was a commercial effect that asks the volunteer to pick one of a hundred different cities typed out on ten cards. The volunteer finds the city's name on two different cards which the magician looks at casually. You can then instantly tell him the name of the city he has mentally picked.

In my version, I instruct him not to ever let me see the city's name on the cards and yet I can still easily predict his choice!

Here is my favorite trick based on the deep principal of Set theory. Ok, maybe it is not too deep but the results are astounding!

Taking a deck of cards, you mention you have a prediction about these cards. That means it is very important important to give the cards a really random shuffle. You then give your volunteer half the deck and you both shuffle your half decks thoroughly. Tell your volunteer to take a small amount(5-15) of cards from his half of the deck, turn them upside down and give them to you. you do the same to him (doesn't matter how many cards you turn upside down as long as there is some left in your hand) You then both shuffle the cards you have received into the deck in your hands in there upside down state. so at this point both people will have some cards right side up some cards upside down. You will follow the same procedure two more times. It doesn't matter how many or what cards he or you are turning upside down and giving away. After all this is done put both half decks of cards together again (IMPORTANT: turn your entire half deck over when you place it on top of his) Now you spread the cards out across a table top. They should be a seemingly random mix of upside down and rigtside up cards. You then unfold your prediction slip which says something like: 11 cards will be black, 15 cards will be red, 6 will be clubs and 5 will be hearts and the hearts will also form a royal Flush!

They will be astounded by your amazingly detailed prediction. What happens is that all the face up cards are the ones that were originally in your half deck. This trick is self working. All you do is to pick out which cards you want in your half of the deck and place them at the top of the deck to start. Then just give him the random bottom half of the deck and you keep the pre-set ones.

Any questions? Just email me at

Magic Maniac

Posted 2009-12-25T22:07:11.903

Reputation: 1


I hope this is contribution is appropriate; I think that a nice puzzle based on Hamming codes discussed a little here:

is the following:

A room contains a normal 8×8 chess board together with 64 identical coins, each with one “heads” side and one “tails” side. Two prisoners are at the mercy of a typically eccentric jailer who has decided to play a game with them for their freedom. The rules are the game are as follows.

The jailer will take one of the prisoners (let us call him the “first” prisoner) with him into the aforementioned room, leaving the second prisoner outside. Inside the room the jailer will place exactly one coin on each square of the chess board, choosing to show heads or tails as he sees fit (e.g. randomly). Having done this he will then choose one square of the chess board and declare to the first prisoner that this is the “magic” square. The first prisoner must then turn over exactly one of the coins and exit the room. After the first prisoner has left the room, the second prisoner is admitted. The jailer will ask him to identify the magic square. If he is able to do this, both prisoners will be granted their freedom

Oliver Nash

Posted 2009-12-25T22:07:11.903

Reputation: 611


Two persons, A and B, perform this trick. The public (or one from the public) chooses two natural numbers and give A the sum and B the product. A and B will ask each other, alternatively, the only single question "Do you know the numbers?" answering only yes or no until both find the numbers. There is a strategy such that for any input and only doing this, A and B will manage to find the original numbers.

I have never seen magicians actually performing this, but is perfectly doable.

This was a problem in the shortlist of the proposed problem for some international mathematical olympiad. Unfortunately I don't remember which. If someone remembers or finds it. Tell us please. i would also like to know.

Anna Taurogenireva

Posted 2009-12-25T22:07:11.903

Reputation: 368

Are the yes-or-no answers by A and B required to be truthful? Or could they just use them to tell each other, in binary, the sum or product that they know? – Andreas Blass – 2011-11-10T14:16:03.423

@Andreas: Yes, and more than truthful, they should be well thought. So when one of them answers 'no' it means that he has not enough information to deduce the two numbers. Yes, there are many ways of cheating if they agree to do so beforehand. But it is probably hard to agree saying the numbers in binary by only saying 'yes' or 'no' and asking if the other knows the numbers. I don't remember if the original wording of the problem had something to avoid cheating but the cool thing is that they can actually deduce the two numbers, fairly, just from the answers. – Anna Taurogenireva – 2011-12-16T18:54:34.773

Any hints on solving this problem? – Ostap Chervak – 2013-01-19T18:47:55.110

Haha, my friend and I barely managed to work through the logic with the audience choosing the numbers 2 and 3! – Philip Engel – 2013-05-14T22:33:14.640

i think this is an application of arithmetic mean/geometric mean (AM/GM) inequality and convergence towards same number (but rate of convergence can vary) – Nikos M. – 2015-03-01T01:51:17.610

1I fail to see how this is true. I don't see that $A$ and $B$ can manage to find the numbers in case that the numbers are $3$ and $4$. This is even assuming that it's common knowledge that the given numbers are distinct. Without this simplification, I believe that there's a smaller counterexample: the numbers $3$ and $3$. What am I missing? – Ingo Blechschmidt – 2016-08-12T19:06:45.293

1If "the public" consists of mathematicians/wiseguys, the two natural numbers might have a few million digits, and it might take A and B a while to complete the trick. – Gerry Myerson – 2010-07-13T04:52:46.930

Well, you don't need to be mathematician or wise to have that guess. Now, remember that one guy has the product and as soon as he know the numbers the guy with the sum gets lots of information. For that one, what it matter is the number of factors. – Anna Taurogenireva – 2010-07-13T11:28:03.747


Here is a simple trick based on group theory. Ask a person to choose four numbers from 1 to 9 and write them in a row on a piece of paper. Pause for a moment and then write a number on a piece of paper without letting the other person see what it is. Turn the paper over and place it on the table.

Now ask the person to choose two of the numbers from the list and put a line though them. Ask the person to compute a*b + a + b and put it in the list to replace the two chosen numbers.

Continue to do this until there is only one remaining number. Turn over the paper and show that the numbers match.

The simplest way of explaining this is to show that a * b + a + b is isomorphic to multiplication using the transform T(x) = x + 1. (a*b + a + b) + 1 = (a + 1)(b + 1). If we denote the operation a * b + a + b as a & b, this means that a & b is commuative and associative, just as multiplication is. For any list of numbers ai, the final number can be computed as the (a1 + 1)(a2 + 1)...(an + 1) - 1.

Martin Cohen

Posted 2009-12-25T22:07:11.903

Reputation: 1

I did not understand what the oter person should do after replacing $a,b$ in the first column with $ab+a+b$. Also, what number do you write down? – Filippo Alberto Edoardo – 2012-09-16T00:54:33.527


Here's another Fibonacci trick, from Benjamin & Quinn's "Proofs that really count".

The magician hands a volunteer a sheet of paper with a table whose rows are numbered from one to ten, plus a final row for the total. She asks him to fill in the first two rows with his favorite two positive integers. She then asks him to fill in row three with the sum of the first two rows, row four with the sum of row two and row three, etcetera... She then hands him a calculator and asks him to add up all ten numbers together. Before he's able to finish that, the magician has a quick look at the sheet of paper and announces the total. The magician then asks the volunteer to divide row 10 by row 9, and cut up the answer to the second decimal digit. The volunteer performs the division and says: 1.61. And the magician: "Now turn over the paper and look what I've written". The paper says: "I predict the number 1.61".

The first part of the trick uses the following well-known Fibonacci identity:


Indeed, call $x$ the number in row 1 and $y$ the number in row 2. Then for $n \geq 3$, the number in row $n$ is $F_{n-2} x+F_{n-1} y$, where $F_n$ is the $n$-th Fibonacci number. So the number in row 7 is $F_5 x + F_6 y=5x+8y$ and the total is $$x+y+\sum_{i=3}^{10} (F_{i-2} x+F_{i-1} y)= F_{10} x + F_{11} y=55x+88y$$ by the Fibonacci identity mentioned at the beginning. Therefore all the magician has to do to find the total is multiply row 7 by the number 11.

The second part of the trick uses an inequality for the freshman sum ;-) of two fractions. That is, given positive fractions $\frac{a}{b}$ and $\frac{c}{d}$ such that $\frac{a}{b}<\frac{c}{d}$ we have:

$$\frac{a}{b} < \frac{a+c}{b+d} < \frac{c}{d}$$

Just note that the number in row 9 is $13x+21y$ while the number in row 10 is $21x+34y$. Hence:

$$ 1.615 \dots =\frac{21x}{13x} < \frac{21x+34y}{13x+21y} < \frac{34y}{21y}=1.619 \dots $$

Santi Spadaro

Posted 2009-12-25T22:07:11.903

Reputation: 1 858


Ask someone to lay out the 52 cards in a deck, face up, in 4 rows of 13 cards each, in any order the person wants. Then you can always pick 13 cards, one from each column, in such a way as to get exactly one card of each denomination (that is, one ace, one deuce, ..., one king).

As a trick, it's not up there with sawing a woman in half, but its explanation does require Hall's Marriage Theorem.

Gerry Myerson

Posted 2009-12-25T22:07:11.903

Reputation: 27 804

Is there a way to perform it as a trick? Hall's Marriage Theorem is rather non-constructive. – Victor Protsak – 2010-05-16T02:06:19.550

Well, it's a finite problem, so exhaustive search is always an option, albeit not a very entertaining one. In practice, it's not too hard to pull it off with just a little bit of (mental) backtracking. – Gerry Myerson – 2010-05-17T01:07:24.707

What if all four aces and all four kings are in the same column? – orlp – 2017-07-07T20:42:51.423

@orlp, each column has only four cards in it. – Gerry Myerson – 2017-07-08T08:50:42.517

@GerryMyerson Ah oops, I missed that. – orlp – 2017-07-09T11:00:29.983

3Actually, Hall's Marriage Theorem has a constructive version: the augmenting-paths algorithm for finding a perfect matching in a bipartite graph, which runs in polynomial time. The existence of this algorithm might help explain why the problem isn't so hard in practice... – Scott Aaronson – 2010-07-13T04:35:04.873


Here's an example of a magic trick that works with high probability, based on a careful analysis of the riffle shuffle, in which an audience member performs a number of riffle shuffles and then moves a single card, and the magician guesses which card has been moved.


Posted 2009-12-25T22:07:11.903

Reputation: 4 918


Place $K$ faced-down cards on a table, blindfold yourself and ask him/her for a number $1 < n < K$. Allow him/her to flip $n$ random cards up. Cover the cards with an opaque box that has two holes for you to put your hands in and claim that you can split the cards into 2 stacks, each with same number of faced-up cards.

Based on a well known logic puzzle: Modified the process to make it harder for audience to figure out what you did and used cards so that they will not think that you did it by differentiating the surface of the coins.

Ng Yong Hao

Posted 2009-12-25T22:07:11.903

Reputation: 245


Not so much a magic trick as a math trick, in that I can prove it works in theory but I have never tried it in practice.

Take a very long one-dimensional frictionless billiard table, with a wall at one end. Away from the wall, place a billiard ball with mass $10^{2n}$ for $n$ positive. Between that ball and the wall, place another billiard ball with mass $1$. Then start the heavy ball rolling slowly towards the light one. Of course, they bounce, setting the light one traveling quickly towards the wall, which it bounces off, and then it hits the heavy ball, etc., until all the momentum from the heavy ball has been transferred and it starts rolling away.

Assume that all collisions are perfectly elastic. Then at the end of the day, there will be finitely many collisions. Indeed, the number of collisions will calculate the digits of $\pi$, in the sense that there will be $\lfloor \pi \times 10^n \rfloor$ collisions.

I prefer this method of calculating $\pi$ much better than the probabilistic one.

Theo Johnson-Freyd

Posted 2009-12-25T22:07:11.903

Reputation: 27 932


The original source seems to be G Galperin, Playing pool with $\pi$, Regular and Chaotic Dynamics 8 (2003) 375-394, MR 2004j:37064. It's at The author only claims that it works for $n\lt10^8$; truth for all $n$ depends upon unproven hypotheses about diophantine properties of $\pi$.

– Gerry Myerson – 2010-11-17T03:17:59.357

@Gerry Myerson: "truth for all $n$ depends upon unproven hypotheses about diophantine properties of $\pi$." The problem is equivalent to a point-particle in two dimensions bouncing in a wedge with angle $\theta$ where $\tan \theta = 10^{-n}$ (work in coordinates position/square root of mass). But then $\theta = 10^{-n} + \epsilon$, where $\epsilon$ is roughly $10^{-3n}$. There are $\lfloor\pi/\theta\rfloor=\lfloor\pi(10^n-10^{-n}+\dots)\rfloor$ bounces, by moving the wedge around the circle and thinking of the particle moving straight by crossing rays. – Theo Johnson-Freyd – 2010-11-17T19:13:18.377

So, I guess, $\lfloor\pi(10^n-\delta)\rfloor$ where $\delta\approx10^{-n}$ could differ from the stated estimate of $\lfloor\pi 10^n\rfloor$ by one, if $\pi\delta$ miraculously rounds you down --- maybe this is what @Gerry is referring to. So I guess I should have only asserted that I could calculate the first $n-1$ digits of $\pi$ this way, not the first $n$ of them. – Theo Johnson-Freyd – 2010-11-17T19:16:05.493

@Theo, if you want to know for sure what I was referring to, I did give a link which should get you to the paper to see for yourself. Also, isn't it the case that if the miraculous round-down occurs at a place where $\pi$ has $k$ zeros, you will only get the first $n-k$ digits? – Gerry Myerson – 2010-11-18T03:38:23.070

@Gerry: No, you're right. I mean, it's only bad if all the digits in spots $n-k$ through $2n$ are all zero. But, yes, I can't prove that this doesn't happen, and I'll easily believe that it's open. – Theo Johnson-Freyd – 2010-11-18T07:08:34.340

7This reminds me of a joke that ends in a mathematician explaining his solution to a real world problem starting with "let $C$ be a spherical chicken..." – Mariano Suárez-Álvarez – 2010-01-04T04:07:52.300

@Mariano: Thanks :) I was hoping that "Take a very long one-dimensional frictionless billiard table" would have the same effect. – Theo Johnson-Freyd – 2010-01-04T04:16:50.693

Do you have a reference for this? I recall having seen it somewhere before, but I can't remember the exact reference anymore, maybe it was a book by Tabachnikov? – Kevin H. Lin – 2010-01-04T13:15:32.447


Another trick for calculating $\pi$;, observed by David Boll ( and proven by Aaron Klebanoff (, is the following. Let $z_0 = 0$; then let $zj = z{j-1}^2 + c$ where $c = -.75 + \epsilon i$ for some small number $epsilon$. Then for $k \lt \pi/\epsilon + O(1)$, $z_k$ is in a circle of radius 2 around the origin; for larger $k$ it's not. (Boll came across this while investigating the Mandelbrot set. There are other points near the boundary of the set that behave similarly.)

– Michael Lugo – 2010-01-04T16:39:31.120

@Kevin: Sorry, I don't have a reference, although it's not actually that hard of an exercise, at least if you have lots of mechanics problem solving tricks (I've never done any Physics Olympiads, but it's basically math-olympiad level in mechanics rather than math). I learned it in a talk as the warm-up for a much harder question, which was understanding how a ball bounces in 3-space with some collection of infinite rectangular cylinders removed (and replaced by walls). – Theo Johnson-Freyd – 2010-01-04T17:24:15.417


So two points of note.

I did not read all the posts above in detail but did do a search for the Faro Shuffle and got no results... So:

This is a shuffle where all the cards interweave absolutely perfectly (so a perfect riffle shuffle). There's quite a lot of maths behind this. For instance, 8 shuffles takes you back to the order you started shuffling the cards in. Martin Gardner talked about this a bit in at least one of his SA columns. The problem with the faro shuffle is it takes a long long time to learn... personally well over a year, and that was with the benefit of having been a practicing amateur magician for along time. Still if interested the book to look for is The Collected Works of Alex Elmsley, this really lays the foundations for mathematical faro work...

Another trick I came across whilst working towards an Ergodic Theory exam uses the Birkhoff Ergodic Theorem at its core. You can read about it in these notes:



Posted 2009-12-25T22:07:11.903

Reputation: 73


This is a trick that I designed years ago and I have used it in many different occasions for amusement only or educational purpose or both. It is indeed the finial difference method to find a polynomial. Ask the person to write down a polynomial without you knowing the polynomial and even the degree of the polynomial. To keep your life easy, it would be better to keep the degree less than or equal 3. (It wouldn't be hard to let a layman know what a polynomial is just by giving two or three examples). Then you ask for some information that is essentially the value of the polynomial for 0, 1, 2, 3. As soon as you take one of the value you should calculate the difference. And in a few seconds after taking the last information, you announce not only the degree of the polynomial but also the exact polynomial.

Note 1: Finding the degree is a very important part of this trick since it convinces more knowlegable persons that you are not just solving a simultaneous equation quickly.

Note 2: I used this trick in my Calculus classes to give this seemingly paradoxical idea that "if you don't know what the function is, try to figure out how it changes."

Note 3: Of course, one can use it in many different classes for different purposes.

Note 4: I've just search the internet to see if Martin Gardner ever introduced this trick. Damn it! The answer was yes, here: "The calculus of finite differences". However, I still love to keep the credit of telling the degree for my self :)

Amir Asghari

Posted 2009-12-25T22:07:11.903

Reputation: 1 157


It is similar to Shamir's secret sharing:

– Margaret Friedland – 2013-05-15T20:50:43.520

1If you instruct the person writing down the polynomial to only use nonnegative coefficients, then in fact two evaluations (at integral points) suffice for you to uniquely infer the polynomial, irrespective of its degree. – Ingo Blechschmidt – 2016-08-12T20:02:10.753

Please do not include any foul language in any of your posts. – 35093731895230467514051 – 2017-12-31T00:39:24.787

1@JosephVanName I usually don't and I am sorry for the D-word in my answer above. Thank you for reminding me :) – Amir Asghari – 2017-12-31T14:25:44.840


My favourite example, the rope and two carabiner trick

I also offer up my variation of the Dirac belt trick

G Taylor

Posted 2009-12-25T22:07:11.903

Reputation: 1


I forgot the historical name for this and I'm pretty sure this is classical and well-known.

Consider a circular disk and remove an interior circular region, not necessarily concentric. In this annulus we play the following game. Start at any point $p_{1}$ of the outer boundary and draw a line through this point which is tangent to the inner circle. This line intersects the outer circle at another point $p_2$. Now repeat the same procedure with $p_2$ and get $p_3$. Iterating this procedure ad infinitum we either conclude that these sequence of points are periodic or not. What's true is that the periodicity or lack of it is independent of the starting point $p_1$.

I believe there is a proof involving Lefschetz fixed point theorem involving the torus but any details on this and the history of this is more than welcome.

Somnath Basu

Posted 2009-12-25T22:07:11.903

Reputation: 2 073


I believe you are referring to Poncelet's theorem.

– Gjergji Zaimi – 2009-12-26T00:50:21.613

Yes! That's it. Thanks! – Somnath Basu – 2009-12-26T01:02:11.727

12It is hard to see how this idea can be turned into an actual trick. It requires either infinite accuracy (if the procedure is done by drawing on paper) or lots of complicated computation. Moreover, generically there is no periodicity, and the audience will not be very impressed by the prediction of non-periodicity. – Richard Stanley – 2009-12-26T16:37:36.457

1I'm not sure I agree. Choosing the circles so that the periodicity is very low, say 3 or 4, and letting a computer do the calculation at the touch of a button for audience-member-chosen initial points (a bit of a pain but definitely something you can accomplish nowadays), you can definitely turn this into something pretty interactive and fun. – Emilio Pisanty – 2012-06-22T11:27:37.577


Peter Suber writes:
By the way, the single best knot trick I've ever found is at pp. 98-99 of Louis Kauffman's On Knots, a mathematical treatise listed below with the books on knot theory. I'm sure you've seen the trick in which someone ties an overhand knot by crossing their arms before picking up the cord, and then uncrossing them. Kauffman shows you how to do the same trick without crossing your arms first. The version of this trick in Ashley #2576 and Budworth 1977 [p. 151] is not nearly as good.
Work out how it is possible for yourselves! A link to the book is here.

[Edit: This magic trick does not rely on mathematics -- instead it violates an important mathematical fact, that the trefoil is not unknotted! The Chinese rings have a similar feel, but the mathematics violated (linking number) is less deep.]

Daniel Moskovich

Posted 2009-12-25T22:07:11.903

Reputation: 12 674


Here's a video of that trick: Actually, I've tried to reproduce this trick many many times, but I've never succeeded. The trick also seems to imply that the trefoil knot is trivial, which is weird...

– Kevin H. Lin – 2009-12-26T17:26:47.423

@ Kevin - If you look at Kauffman's book then there is a point where some disconnection takes place (8th picture on page 99). I guess in the video you pointed out, she's smooth enough to hide this switch when she shakes both her hands. Thereafter, when she pulls it we see a trefoil. But it's a nice trick nonetheless. – Somnath Basu – 2009-12-26T18:21:24.960

Where does the non-triviality of the fundamental group of SO(3) come in? – Kevin H. Lin – 2009-12-27T02:28:12.237

There's a Dirac string trick when he takes the string all the way around, but it's indeed irrelevant (nothing is framed). I wrote nonsense. I'll edit. – Daniel Moskovich – 2009-12-27T02:46:37.770

Re: Sam Nead's edit -- I think the nontriviality of the trefoil and the nontriviality of the Hopf link are about equal in mathematical depth, no? – Kevin H. Lin – 2009-12-28T14:35:57.247

1Kevin Lin- I would argue that nontriviality of the trefoil is deeper, because nontriviality of the Hopf link can be detected by the Gauss linking integral, which was known earlier and is less deep than anything needed to prove nontriviality of the trefoil. – Daniel Moskovich – 2009-12-29T12:18:54.050


Magician: "Here is a deck of 27 cards. Select one, memorize it, put it back and shuffle at libitum. Now name a number between 1 and 27 inclusive (=: N)." Then the magician deals the cards face up into three heaps. You have to tell him in which heap the selected card lies, and he quickly ramasses the three heaps. This is done three times, then he hands you the deck, and you have to count N cards from its back. The N'th card is flipped over, and it turns out to be the card you have originally selected.

Christian Blatter

Posted 2009-12-25T22:07:11.903

Reputation: 1


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


Craig Feinstein

Posted 2009-12-25T22:07:11.903

Reputation: 821


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)


Posted 2009-12-25T22:07:11.903

Reputation: 1


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


Posted 2009-12-25T22:07:11.903

Reputation: 101

Link seems to have rotted. – Willie Wong – 2017-11-27T22:15:25.137


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.


Posted 2009-12-25T22:07:11.903

Reputation: 398

1The 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 – 2010-11-17T00:05:47.133


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).

Marc van Leeuwen

Posted 2009-12-25T22:07:11.903

Reputation: 1 403


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.


Posted 2009-12-25T22:07:11.903

Reputation: 61

The one with the plasticine is more of an exercise for mathematicians to figure out what is wrong with the method. – Adam Gal – 2010-07-13T06:37:38.093


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

Jim B

Posted 2009-12-25T22:07:11.903

Reputation: 51


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...

Thomas Sauvaget

Posted 2009-12-25T22:07:11.903

Reputation: 1 535

I agree that the Mobius strip is magic. But it is not a trick! – Sam Nead – 2009-12-28T14:21:30.150

Someone posted something similar earlier, but I guess they deleted it. My complaint was that, while it is perhaps counter-intuitive at first sight, it isn't very deep mathematically. – Kevin H. Lin – 2009-12-29T16:10:59.753

1Have an assistant cut a cylinder in half along its median circle. Then cut a Mobius strip along its median. – Douglas Zare – 2010-01-17T23:08:25.537

How is orientability not a deep mathematical concept? – Emilio Pisanty – 2012-06-22T11:31:19.140


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!).

Julien Puydt

Posted 2009-12-25T22:07:11.903

Reputation: 1 463

I wouldn't consider "casting out nines" deep mathematics, and it should be relatively easy giving your students access to it, if you wanted. Certainly it would fit well into a first abstract algebra course. – Todd Trimble – 2012-09-15T12:18:35.327

First, notice I didn't write it was deep mathematics -- I wrote "deepER" ; I explained that it can be used by children, but understanding why it works is more difficult. So I stand by my statement as I wrote it :-)

Second, I definitely can't do arithmetic with my students : I'm teaching in a scientific CPGE, so the quotient (syllabus content)/(time to cover it) is already very high [see: -- where they mention the years as "intensive" which is quite an understatement].

– Julien Puydt – 2012-09-15T18:43:06.273

Don't worry; I noticed. :-) As for the rest, that's too bad. I was thinking that it's something that could be easily explained in a few minutes to a bright and curious youngster during office hours, but maybe those opportunities don't exist for your situation? – Todd Trimble – 2012-09-16T15:30:32.977

Those opportunities are rare enough that I would like to move on and get back to university... :-/ – Julien Puydt – 2012-09-16T19:34:37.420


How about the "Flash Mind Reader"

Gerald Edgar

Posted 2009-12-25T22:07:11.903

Reputation: 25 496

1No, that one is dumb. – Harry Gindi – 2010-01-17T22:42:20.170

1No, that one isn't dumb, but it's more about psychology than about mathematics (like most tricks with cards). – Konrad Voelkel – 2010-02-07T13:58:40.167


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.

Damian Ramirez

Posted 2009-12-25T22:07:11.903

Reputation: 1


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.


Posted 2009-12-25T22:07:11.903

Reputation: 4 554


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.

Nikos M.

Posted 2009-12-25T22:07:11.903

Reputation: 139


Already here,

– Gerry Myerson – 2015-03-01T04:54:45.780

@GerryMyerson, oops seems i missed it – Nikos M. – 2015-03-01T11:55:33.370