Showing posts with label mathematics. Show all posts
Showing posts with label mathematics. Show all posts

Wednesday, November 9, 2011

The Best Card Trick


... is the title of an article [PDF] from the Mathematical Intelligencer I recently came across that, well, discusses a namesake card trick. As  it turned out, the somewhat presumptuous title notwithstanding, the trick happens to be pretty interesting. Not to mention it gives me enough material to to gab about and break out of my posting hiatus (before slipping into another :) ). So, here we go ...


A bit of history

The original article offers close to 1.5 pages of history if you are interested - consider this section a "tl;dr"-ed version.

  • The trick appeared in the book Math Miracles by Wallace Lee, where it is credited to William Fitch Cheney Jr., a.k.a. "Fitch".
  • The article is by Michael Kleber.

Here's where I would have ideally ended this section (a bit of history: check) but Fitch having been the interesting character that he had been, it would be unfair if I didn't mention the following facts about him before we move on:

  1. If a name like "Fitch" inspires the image  of an ordinary performer of card tricks, or worse still, a street magician, you couldn't be more wrong - Fitch was awarded the first PhD in mathematics from MIT in 1927.

  2. As a teacher, Fitch seems to have been unusually entertaining:

  3. "... he enjoyed introducing magic effects into the classroom, both to illustrate points and to assure his students' attentiveness. He also trained himself to be ambidextrous (although naturally left-handed), and amazed his classes with his ability to write equations simultaneously with both hands, meeting in the center at the "equals" sign."
      --- from a description of Fitch by his son, Bill Cheney

Trick, and a mathematical treat

To appreciate how the trick works under the hood, lets start by looking at it from the point of view of the audience. If you were at the receiving end of the trick this is what you would see:

(1) The magician holds out a normal deck of 52 cards to you, and asks you to pick 5 cards.

(2) You do so and hand them over to his assistant.

Say, this is what you pick:


(3) Of the 5 cards handed over to her, she hands 4 of them to the magician. Say, these:



(4) He looks at the 4 cards handed to him, and with < insert favorite dramatic gesture here > announces the 5th card you had selected.




Take a while to think about what happened here. Assuming a normal, well-shuffled deck and no underhand techniques, the objective of the magician seems to be to look at 4 cards, handed to him by his assistant, and infer the 5th. With absolutely no prior knowledge of the selection on part of the magician (in other tricks this is typically arranged for by using a deck with more cards of one kind than another, or stacking it up in some particular way etc), how exactly is the assistant to indicate the rank and suit of the 5th card using the 4 cards she hands over?

What messages can you pass with 4 cards ?

A possible way seems to be arranging 4 cards in a way that identifies the 5th card i.e. you could use the ordering of 4 cards to encode the suit and rank of the 5th card.

But there is a catch here - 4 cards can be arranged in 4! = 24 different ways, whereas the 5th card could be any one of the remaining 52 - 4 = 48 cards. Apparently we do not have enough arrangements of 4 cards to indicate the 5th card. One card more, and we would have been good to go - but, the technique doesn't seem workable as-is.

In essence, the trick is not a sleight-of-hand-ish trick - it boils down to compressing and conveying information. Fitch being a mathematician probably has something to do with this.

So,which 4 cards does the assistant hand over to the magician? And how do these indicate the 5th card?


The workings

We saw how we fall short when we try to use orderings for our purpose; this is where the trick gets interesting. Instead of abandoning the approach completely, it looks deeper at the kind of objects we are dealing with. Each card is marked with a suit and a rank - can these attributes help us in squeezing in more information? Apparently, yes:
  1. Since there are just 4 suits, but you have picked 5 cards, there are at least 2 cards of the same suit in your selection (Hello, pigeonhole principle!). In the above example these are 3 ♠ and 10 ♠ . As per a convention decided upon by the assistant and the magician, the assistant holds back one of the cards with a repeated suit, and in the arrangement of cards he hands to the magician, he positions the other card of the suit as the first card. Looking at the first card, the magician now only needs to guess the rank of the unseen card - the suit is same as that of the first one.

    Look at the cards in step 3 above; 10 ♠ is the first card handed over. The magician knows that the 5th card is also a spade.

    But with the first card used to reveal just the suit, we have only 3 cards left to guess the rank of the 5th card. Which can take on 13 values. But 3 cards can be arranged in only 3! = 6 ways.

    Ouch. Again.

  2. Since our strategy is already piggybacking on the repeating of suits, it's worth asking, among the cards with the repeated suit, is there a good way to pick the card the assistant would be sliding into the first position?

    In the above example, this is equivalent to asking, between 3 ♠ and 10 ♠, which card should be put in the first position?

    Is there an optimal choice here? Optimal in a way that helps us to work around he limitation we encountered above i.e. can choosing the 1st card wisely, lets us use just 3 cards to indicate the rank of the 5th card ?

    Turns out, the answer is yes. Here's a short, math-savvy hint: modular arithmetic.

    In simple words, here, this means that we do not directly indicate the rank of the 5th card, but we indicate what number you should add to the rank of the 1st card to obtain the rank of the 5th card. Except that we agree to a way of handling the addition when it goes beyond 13 - in such cases, we simply start counting at 1 again.

    This can be easily understood by imagining the ranks to be laid out in a circle. Adding x to a number y here is equivalent to going x steps around the circle, clockwise, starting from y.



    So, 10+5 is 2. 13 + 1 is 1. And, of course, 2 + 3 is 5.

    How does this help in working around our earlier limitation? Consider the shorter distance between any 2 points on the circle - its
    never greater than 5. This means that of 2 points in this circle, I could always pick a point, so that you wouldn't need to add a number more than 6 to reach the other point. This is important since the remaining 3 cards - the ones at positions 2nd, 3rd and 4th - can be arranged in 6 different ways.
    Take the points 3 and 10 for example (the ranks of our cards with the suit ♠ ). If you were given 3, you would need to add 7 to get to the point 10. But if you were given the point 10, you would need to add 6 to get to the point 3. This is why the assistant passes 10 ♠ to the magician in our example, and not 3 ♠ (and arranges the other cards to indicate the number - 6 - to be added; we'll get to the arrangement in a while)
    Thus, it turns out that if we pick right the card of the repeated suit to be given to the magician, the ordering of 3 cards is sufficient to indicate the rank of the unseen card. This completes our strategy.

Here, to implement point 2, one could follow any system to encode numbers by orderings, as long as the magician and his assistant have agreed upon it. A simple way could be to use the ordering of suits and ranks used in the game of bridge:
  1. Ordering of suits, highest to lowest: ♠, ♥, ♦, ♣

  2. Within a suit, ordering of ranks, highest to lowest: Ace (A), King (K), Queen (Q), Joker (J), 10, 9, 8, 7, 6, 5, 4, 3, 2.
For our cards in positions 2nd to 4th ( 8 ♥, K ♦, A ♣), this implies the following encoding for all possible arrangements (assuming a "lower" ordering corresponds to a lower number):

  • A ♣, K ♦, 8 ♥ → 1

  • A ♣, 8 ♥, K ♦ → 2

  • K ♦, A ♣, 8 ♥ → 3

  • K ♦, 8 ♥, A ♣ → 4

  • 8 ♥, A ♣, K ♦ → 5

  • 8 ♥, K ♦, A ♣ → 6
Thus, looking at the ordering of these 3 cards, our magician adds "6" to the rank of the first card, which is 10. This tells him that the 5th card has a rank 3 (remember he already knows that the suit is a ♠).


In summary

The following image tries to sum up the reasoning of the magician:


You can blame Google for the crummy resizing.


Stage advice ...

Some practical advice from the article if you are indeed planning on performing the trick:

  1. If trying to determine what number the ordering of the 2nd, 3rd and 4th cards corresponds to in the manner discussed, seems a little clumsy, the author of the article suggests his own variation.

    "... place the smallest card in the left/middle/right position to encode 12/34/56 respectively, placing medium before or after large to indicate the first or second number in each pair"

    As an example, the ordering "A ♣, 8 ♥, K ♦" would imply a rank of 2, since the smallest card, A ♣, is in the first position (so this is either rank 1 or 2) and the medium card, K ♦, follows the large card, 8 ♥ (which makes it rank 2).

  2. This one, straight from Fitch. If you are repeating the trick to an audience, say for more than a few times, there is the risk that someone would notice that one of the cards with a repeated suit is always in the first position. In such a case, place the card that indicates the suit in the (i mod 4)th position for the ith performance (we assume position "0" indicates the 4th position).

    Thus, for the 1st performance this card is in position 1, for the 2nd performance this is in position 2, for the 7th performance, assuming your audience is still around and awake, this goes in at position 3 (since, 7 mod 4 = 3).
Generalization

If you go through the various steps above, the ideas involved seem to just about fit in: simple ordering seems deficient? - repeated suit to the rescue; 3 cards are insufficient to indicate a rank? - modular arithmetic alert.

happy-go-lucky patchwork of clever ideas as it were...

... which, well, really is fair game. However, the key contribution of the article is that it convinces you this is not all that there is to it: it analyzes these seemingly ad-hoc steps rigorously and suggests extensions of the trick. Unfortunately, this is not something I will go into, in this post, since I want to keep it fairly non-technical. For those who are interested, going through the original article is strongly recommended. I intend to follow-up this post with another one focused only on the generalizations, at a later point in time.



Sunday, December 14, 2008

Apocrypha Redux


I recently came across this interesting book “Mathematical Apocrypha Redux”, by Steven Krantz which, as per the cover page, is about “More Stories and anecdotes of Mathematicians and the Mathematical” (the word “more” is used as this is a sequel to the book “Mathematical Apocrypha”, by the same author). Lots of interesting stories, and some not so, but I singled out the following few (often, abridged and restated) for this post:



(1)
The daughter of mathematician Lee Neuwirth, Bebe Neuwirth, played Frasier Crane’s wife in the popular television shows Frasier and Cheers (thanks to Frasier, I can’t enjoy any other sitcom as much – Frasier has definitely raised the bar).




(2)
It is not very widely known that Knuth’s first publication was for the MAD magazine (MAD Magazine 33 (June 1957),36-37). It was called “The Potrzebie system of weights and measures”. The article parodied the established system of weights and measures that we all use. For example, it proposed the fundamental units of length and force to the thickness of MAD Magazine #26 and "whatmeworry" respectively. It also suggested the "yllion" notation for large numbers: one myllion is one myriad myriad (l08) and one centyllion is 102102. "Potrzebie" is a word that publisher William Gaines lifted from a Polish aspirin bottle; it is the locative form of a Polish noun meaning "need."


(3)
Erdos had a friend working on harmonic analysis in Oxford, England. The poor man was hopelessly schizophrenic. When Erdos once visited him, the fellow just opened the door of his office a little bit and said, "Please come another time and to another person."


(4)
John von Neumann (1903-1957) once owned a dog named "Inverse". Rene Descartes (1596-1650) owned a dog named "Monsieur Orat," which means "Mr. Scratch".


(5)
Of the many incidents of mathematicians over thinking mundane life, this takes the cake. Or bread rather. Henri Poincare (1854-1912) was in the habit of buying a 1 kilo loaf of bread daily from a local baker. After a year of record keeping, he determined a normal distribution of the weights of the loaves with mean at 950gms. He called the police and informed them of the dishonesty on the part of the local baker. The cautious baker began serving him the biggest loaf in their store for the next year. He was clearly surprised therefore, when, after a year, Poincare again summoned the police : his records, this time, showed a bell-shaped curve with the minimum at 950 grams but truncated on the left side.


(6)
This is an old one. Niels Bohr (1885-1962) had a horseshoe nailed outside his house, over his door. One day, when asked incredulously by a friend whether he really believed that the thing would bring him luck, he replied, "I don't. But, I understand that it brings you luck whether you believe it or not."


(7)
Q: What do you get when you cross a mosquito with a mountain climber?
A: Silly! You can't cross a vector and a scaler.

(8)
This one is of potentially immense practical use to me (and fellow researchers I am sure). Often, after a presentation on an abstract subject, when the speaker requests enthusiastically for questions from the audience, he is greeted by embarrassing silence (due to the fact that no one but the speaker has the remotest idea of what is going on). As a remedy for such situations, Desmond MacHale, a author and a mathematician, has compiled the following set of questions, which a member of the audience might confidently put forth to the speaker, irrespective of whether he understands the subject matter or not:

  • Can you produce a series of counterexamples to show that if any of the conditions of the main theorem are dropped or weakened, then the theorem no longer holds? What inadequacies of the classical treatment of this subject are now becoming obvious?
  • Can your results be unified and generalized by expressing them in the languag e of Cat egory Theory?
  • Isn't there a suggestion of Theorem 3 in an early paper of Gauss?
  • Isn't the constant 4.15 in Theorem 2 suspiciously close to 4n/3?
  • I'm not sure I understand the proof of Lemma 3-could you outline it for us again?
  • Are you familiar with a joint paper of Besovik and Bombialdi which might explain why the converse of Theorem 5 is false without further assumptions?
  • Why not get a graduate student to perform the horrendous calculations mentioned in Theorem 1 in the case n = 4?
  • Could you draw us a simple diagram to show what the situation looks like for n = 2?
  • What textbook would you recommend for someone who wishes to get students interested in this area?
  • When can we expect your definitive textbook on this subject?
  • Why do you think there was such a flurry of activity in this area around the turn of the century and then nothing until your paper of 1979?
  • What are the applications of these results?
(9)
When Emmy Noether (1882-1935) applied for the position of a faculty member at Gottingen, she faced a lot of opposition – as part of then prevalent prejudices against women. David Hilbert (1862- 1943), strongly defended her stance, and is known to have uttered the following words when addressing the council of the university: : "I do not see why the sex of the candidate should be an argument against her appointment as Privatdozent; after all, we are not a bath-house ..."


(10)
When Bertrand Russell had, by his second wife, a first child, a friend accosted him with,"Congratulations, Bertie! Is it a girl or a boy?" Russell replied, "Yes, of course, what else could it be?"


(11)
That the bridges of Konigsberg were studied by Euler, which led to the foundations of graph theory and topology, is a popular mathematical trivia. Lesser known is the name of the seven bridges: Kramer, Schmiede, Holz, Hohe, Honig, Kottel, and Grone..



(12)
During class one day, while Lowell Coolidge (1873-1954), a member of the Harvard math faculty in the 1930s, twirled his watch on its chain, the chain broke and the fob watch flew out the window. Coolidge exclaimed, "Ah, gentlemen, a perfect parabola."

Coolidge was a geometer.


(13)
A student of Plato (428 B.c.-348 B.C.) once asked the great master, "What practical use do these theorems serve? What is to be gained from them?" Plato's answer was immediate and peremptory. He turned to one of his slaves and said, "Give this young man an obol [a small Greek coin] that he may feel that he has gained something from my teachings. Then expel him."


(14)
Does God play dice with the universe?

"God does not play dice with the universe." - Albert Einstein

"Who are you to tell God what to do?" - Niels Bohr
"God not only plays dice, but sometimes throws them where they cannot be seen." - Stephen Hawking


(15)

The episode “Treehouse of Horror”, from the sixth season of Simpsons, revealed the following counterexample to Fermat’s Last Theorem:
Take your TI -83 calculator and compute
[1782 12 + 184112 ](1/12)
You will find the answer to be 1922. Thus
178212 + 184112 = 192212 .

Why do you think this works?(Think about the round off error)



(16)
John Horton Conway was once asked to find the next number in the sequence:
1 3
1 1 1 3
3 1 1 3
1 3 2 1 1 3
1 1 1 3 1 2 2 1 1 3

Conway gave up after a couple of weeks worth effort. But you might want to try it … its not as difficult as it might seem- its just, well, a bit different. Hint: This sequence is called the “Look and say sequence”. The next few lines describe the solution in white font – select it to view it.

You read a number aloud, grouping identical consecutive digits together. This gives you the next number in the sequence. For ex we start with “1 3”. We read this number aloud by saying “1 one , followed by 1 three”. So the next number in the sequence becomes “1 1 1 3”. We now read this aloud, saying “3 ones (followed by) 1 three” – so the next number becomes “3 1 1 3”.And so on. Although Conway did fail to initially understand the sequence, he subsequently contributed a lot of ideas to aid in understanding certain properties of this sequence (and other such sequences, often called “atomic sequences”).

(17)

The trivia game ‘Six Degrees of Kevin Bacon’ is based on the small world assumption, and consists of trying to connect any actor to Kevin Bacon through his her roles with him, or with someone who has acted with him, or through any number of such intermediary actors.


Surprisingly, Paul Erdos has a Bacon number of 4. This is the provenance:
  • Paul Erdos was in N is a Number (1993) with Gene Patterson
  • Gene Patterson was in Bo x of Moon Light (1996) with John Turturro;
  • John Turturro was in Cradle Will Rock (1999) with Tim Robbins
  • Robbins was in Mystic River (2003) with Kevin Bacon
This Bacon number would come down to 3 once "Frost/Nixon" is released (slated to be released on 26th December,2008):
  • ErdÅ‘s was in N is a Numbe r with Gene Patterson.
  • Patterson was in Box of Moon Light (1996) with Sam Rockwell.
  • Sam Rockwell will be in Frost/Nixon (2008) with Kevin Bacon

Both the above linkages are disputed because the Gene Patterson in “N is a Number” might not be the same as the Gene Patterson in “Box of Moon Light” (1996)
Again, quite interestingly, Pope John Paul II has a Bacon umber of 3. Here’s how:
  • Pope John Paul II was in Padre Pio — Tra cielo e terra (2000) with Giovanni Lombardo Radice.
  • Giovanni Lombard o Radice was in The Omen (2006) with Vee Vimolmal
  • Vee Vimolmal was in Where the Truth Lies (2005) with Kevin Bacon
It turns out that apparently only 12% of all actors cannot be linked to Kevin Bacon at all. You can check whether an actor/actress is linked to Kevin Bacon here : http://oracleofbacon.org – for starters you might want to check out the Bacon numbers for Sachin Tendulkar, Aishwarya Rai and Amitabh Bachchan :).

The game also defines the concept of a “center of the Hollywood Universe” to be a person with a very low average “personality” number – which is calculated as the weighted average of the degree of separation of all the people that link to that particular person. The current best centre is Rod Steiger, followed by Christopher Lee, Dennis Hopper and Donald Sutherlannd. Karen Black is the highest ranked female center in the list.




(18)
Joe Kohn likes to say that there is no such thing as strong coffee. There are only weak men.

(19)
Jon von Neumann was once on a train and found that he was quite hungry. He asked the conductor to send the man with the sandwich tray to his seat. The busy and impatient conductor said, "I will if 1 see him." Johnny's reply was, "This train is linear, isn't it?"

(20)
W. Sierpinski (1882-1969) was once asked by his wife to watch their trunks when they were moving. She had pointed out that there were 10 trunks – but was surprised when Sierpinski told her upon her return, that there were only nine. And he promptly justified it by counting the trunks aloud: “Zero, one, two …”

(21)
Paul Erdos was an itinerant scholar. He never owned nor rented a home, didn't have a driver's license, didn't have a credit card. He habitually would show up on the doorstep of a friend or a collaborator-anywhere in the world!-declare that "My brain is open. "-and expect to be fed and housed and clothed. His motto was, "Another roof, another proof"


(22)
A popular modem off-Broadway musical is entitled Fermat s Last Tango.
It is quite extraordinary in that (i) it is about serious mathematics and (ii) it actually has lines that formulate serious mathematical thoughts.

Some examples are:
I knew, I swore,
That elegant symmetry
Of x squared plus y squared
Is square of z
Could not be repeated if n were three,
Or more!

At one point, Fermat himself appears, singing :
Elliptical curves, modular forms,
Shimura- Taniyama,

It's all made up, it doesn't exist,
Algebraic melodrama!


(23)
And finally, a compilation of the "inside interpretation" of various things said in the mathematical community (I think its just not the mathematical community - these are true for any research community :) ):


What's SaidWhat's Meant
This is trivial. I forget the proof .
This is obvious. You forget the proof.
This is a calculation. Let's all forget the proof.
Send me your preprints. Please go away.
Send me your reprints. Please stay away.
Read my book. I don't know.
That problem is intractable. I can't do the problem so neither can you.
He's one of the great living mathematicians. He's written five papers and I've read two of them.
What are some applications of your theorem? What is your theorem?
I don't understand that step. You goofed.
How do you reconcile your theorem with this example? You're dead.
Your theorem contradicts my theorem. I'm dead.
Where do you teach? Do you have a job?
Your talk was very interesting. I can't think of anything to say about your talk.
Have you had many students? Do you have any social diseases?
I read one of your papers. I wrapped fish with one of your papers.


On the whole, the book is more than an engrossing read if you are interested in mathematics and mathematicians - with around 300 pages of anecdotal trivia, that's hard to come across otherwise, its a rare treat.




Sources:
Mathematical Apocrypha Redux”, by Steven Krantz
http://www.en.wikipedia.org
michaelweening.spaces.live.com/blog/cns!97D2E88D450D7724!1783.entry