?

Log in

No account? Create an account
"Mathemagics" explained - Arvind Narayanan's journal [entries|archive|friends|userinfo]

"Mathemagics" explained [Jan. 20th, 2008|03:33 am]
Arvind Narayanan
[Tags|, ]

In a highly entertaining TED talk, Arthur Benjamin performs his "mathemagics" routine using his powers of mental arithmetic. There is one act in particular that might appear astounding and significantly harder than the others, but in fact there is a catch that makes it more akin to a party trick than a display of mental prowess. While the basic trick might be simple enough to latch on to, it takes some probabilistic reasoning to understand why it works. (Watching the first half of the video is recommended, but not required, to make sense of the analysis below.)

The set-up is as follows: Benjamin starts from a random-looking 4-digit number, and asks each of four volunteers with calculators to multiply said number with a (secret) 3-digit number of their choosing. Each volunteer then calls out all but one of the digits in the product, in any order, whereupon correctly Benjamin guesses the digit that they left out. His reply is instant and correct each time.

His performance is very smooth (he has apparently presented his talk over a thousand times!) and the routine above comes at the end of a series of increasingly impressive mental calculations. So it's easy to miss the trick, as I did the first time I watched the video. But pay close attention to the 4-digit number that he started with: 8649, which is divisible by 9. A-ha. It follows that any product of this number is also divisible by 9, and therefore the sum of the digits of the product. All Benjamin has to do, then, is to compute the sum of the digits presented to him modulo 9 and respond with the complement of that sum.

Well, there are two little problems with that explanation. First, the chance that a random number is divisible by 9 is only 1 in 9; what does he do the other 8 times out of 9? Well, notice that I said random-looking, not random! The number is in fact chosen from a list of squares of two digit numbers called out by audience members in the previous act. The chance that a random square is divisible by 9 is 1 in 3, and he had 4 numbers to work with, so the chance of a hit is pretty solid. (In fact, the way that the previous act likely works is that he has audience members call out random 3-digit numbers until one of them is divisible by 3!)

The second problem is what happens when the digits of the product that the volunteer calls out sum to a multiple of 9, leaving two possibilities (0 and 9) for the final digit. There is indeed no way to know for sure what the remaining digit is, but random guessing would give him an overall chance of 9 in 10 of guessing correctly. That's because there are only two problematic choices out of ten for the final digit if we make the simplifying assumption that each digit is uniformly distributed.

Those odds don't look too bad, but there's a crucial assumption hidden in there, that the volunteer picks a random digit to leave out. Someone who is quick enough to figure out what's going on, or someone who's seen the talk before can turn the tables on the trickster, however, by deliberately choosing to leave out a 0 or a 9! There is, after all, a 77% chance that the a random product generated as above contains a 0 or a 9. It is amusing to think of this in cryptographic terms as a security vulnerability caused by malicious input coming from an untrusted adversary.

Finally, to confirm that the act wouldn't work if it were not for the rule-of-nines trick, a quick simulation based calculation shows that if you start from a number not divisible by 9, then the probability that there is exactly one possibility for the remaining digit is only 33%. That is, two-thirds of the time, the set of digits that were called out could have been obtained from at least two different 3-digit multiplicands with different possibilities for the remaining digit, and no amount of calculation can produce the correct answer with more than a 50% probability.

Of course, this post is not meant to suggest that the whole of Benjamin's routine is trickery. In his last act, for instance, he walks the audience through his thought process as he squares a 5-digit number. He uses a some kind of phoneme-based mnemonic system for remembering large tables; the use of such funny looking techniques (the journey system is another one) is necessitated by the way memory works. This is a subject that fascinates me (I have dabbled in mnemonics myself) and if I can find the motivation I might do a follow-up post on "human calculators" and other mental feats.

Update: Welcome, Carnival of Math readers. If you like my posts you might want to subscribe to my feed or just the math posts.
LinkReply

Comments:
(Deleted comment)