## Pi Day Magic 2010

*On Sunday the 14th of March 2010 a mathematician and a magician teamed up to perform what they believed to be the world’s largest live magic trick. Distinctly mathematical in nature, the trick involved volunteers from the around the world picking numbers with a seemingly free choice. And yet, even if the volunteer was across the globe, the mathematician and the magician were still able to read your mind.*

I was the mathematician in this partnership. Unfortunately, many people think mathematics is a difficult or dry subject. But not for me; for me mathematics is full of colour and beauty and magic.

So I work with the Millennium Mathematics Project (http://mmp.maths.org), part of Cambridge University. I travel the country, and the world, in the attempt to challenge those misconceptions and to bring mathematics to life. And I do much the same in my free time, making videos online (http://singingbanana.com). It was one of my followers here who suggested a massive online event: the world’s largest magic trick.

Soon it would be World Pi Day, a day to celebrate of all things mathematical. Pi Day happens every year on the 14th of March, the date being 03.14 – the first few digits of Pi, and most often celebrated by baking a large number of pies.

The date also happened to fall directly in the middle of the Cambridge Science Festival (http://cambridgescience.org). So what better date to perform my mathematical magic trick. An event we called Pi Day Magic 2010.

I immediately got in contact with Brian Brushwood, award-winning US magician and host of his own internet series Scam School (http://www.scamschool.tv). All our viewers had to do was to follow the event on Twitter using the hashtag #pidaymagic, where they would be able to see the trick unfold from wherever they were in the world.

**You can now learn how to perform the trick yourself. It goes like this:**

1. First take a calculator. Any calculator, maybe the one on your phone, or even Google will do.

2. Next, ask your volunteer to multiply single digit numbers together, and to mix them up as much as possible. So that might be something like 2 x 6 x 5 x 6 x …

3. Finally, stop when the result is a number that is six or seven digits long.

**Your volunteer has a completely free choice when making this number. So now this is where the magic starts.**

**You ask your volunteer to look at the number they’ve made, to pick one of the digits, and to keep it to themselves. This is their chosen number. Now ask them to give you the remaining digits and, here is the killer, they may do so in any order.**

**Now ask them to concentrate on their chosen number.**

**Remember, not only did your volunteer have a completely free choice when multiplying single digits together, generating a completely random number, but they also had a free choice when recalling the remaining digits. Yet, you are able to read the volunteer’s mind and pick out their chosen number.**

**How is it done? With a little mathematical fact called ‘casting out nines’.**

It can be proved that the digital sum of all multiples of nine always add up to nine. In fact the opposite is also true; if the digital sum of a number adds up to 9 then it is a multiple of nine.

So by adding up the digits of *6727374 *I can instantly tell it is a multiple of nine.

This idea of casting out nines was used by both accountants and schoolchildren in the days before calculators as a way to check their arithmetic. As a quick appeal to intuition, adding 9 to any number is the same as adding 10 and subtracting 1. That means adding 1 to the tens column and subtracting 1 from the units column, thus the digital sum does not change at all. Adding any number from 1 to 8 will add to or subtract from the digital sum, but adding 9 is like adding zero to the digital sum.

The upshot of all this is that any calculation may be checked by performing the same calculation with the digital sums, and if correct the final answers must agree. For example;

**How does this help with our trick? Well, since I asked you to multiply single digits together I was relying on you making a multiple of nine, by either hitting the 9 at least once, or maybe hitting 3 or 6 twice. Either way, we instantly have a multiple of nine. And, assuming that’s true, by using the method of casting out nines I can tell you which is the missing digit.**

For example, 4 x 6 x 8 x 7 x 3 x 2 x 7 x 5 = 282240

**Since our multiplication has a 6 and 3, this will be a multiple of nine. And if we check, the digital sum adds up to 18, a further multiple of nine, as expected.**

**So if our volunteer chooses the number 8, he might return the digits 2 2 2 0 4. Since this adds up to 10 we may assume the missing number is 8.**

This is a brilliant and effective mathematical trick, although my presentation has two drawbacks.

First, we cannot tell the difference between a zero and a nine. So in the example above, the volunteer may return the digits 2 2 2 8 4. These add up to 18 and we cannot tell if the chosen digit was a 0 (to make a digital sum of 18) or a 9 (to make a digital sum of 27). Here a little patter is needed. Ask your volunteer to concentrate on their number, are they thinking of nothing? A knowing smile from your volunteer will tell you they are thinking of zero, otherwise it’s a nine. Or more directly ask them if their number is even, if they say no they chose the number nine, if they looked slightly confused it will be a zero. (However they need not be confused; zero is an even number).

And secondly, what if the volunteer doesn’t hit a 9 or a pair of 3s or 6s? The resulting number will not be a multiple of nine. This might happen 10% of the time, and the trick will not work. In my instructions I ask the voulunteer to mix up the numbers, possibly implying this makes the trick harder. However, if the trick still fails it can be saved. Just ask your volunteer to reverse their number and then subtract their original number, this will instantly give you a multiple of nine and you can try again.

The idea of casting out nines is a special case of something called Modular Arithmetic. In fact we all use modular arithmetic everyday.

Imagine a clock, just an ordinary 12 hour clock. If I start at 2 o’clock and add 3 hours, it’s 5 o’clock. Easy. If I start at 2 o’clock and add 12 hours, why it’s 2 o’clock again (am or pm). But if I start at 2 o’clock and add 15 hours, then it’s 5 o’clock. So adding 15 hours is the same as adding 3 hours.

Or think of a calandar. If it’s a Monday and I add 7 days, it’s a Monday again. If it’s a Monday and I add 8 days, it’s a Tuesday. This is like having a clock of size 7 rather than 12. For this reason Modular Arithmetic is sometimes called Clock Arithmetic.

Often division with remainder is something you do when you’re very young, but soon gets replaced once you start learning about fractions and decimals. Yet, division with remainder makes a bit of a comeback in higher mathematics.

Consider this division:

17 / 5 = 3 rem 2

Seventeen divided by five is three, with two left over. Ok, how about these three divisions by 12;

60 / 12 = 5 rem 0

27 / 12 = 2 rem 3

59 / 12 = 4 rem 11

In the first number, 60, has no remainder after dividing by 12 as it is a multiple of 12; as are 12, 24, 36 etc.

On the other hand, 27 has remainder 3 after division by 12. Other numbers with remainder 3 after division by 12 are 3 itself, then 15, 27, 39, 51 and so on.

The same can be said for those numbers which leave remainder 11 after division by 12, i.e. 11, 23, 35, 47…

In fact you can put all integers into one of 12 sets; those that leave remainder 1 after division by 12, those that leave remainder 2 after division by 12; and so on until we get to those that leave remainder 11 after division by 12 and then those that leave remainder 12 after division by 12. The last set being exactly the same as the multiples of 12, the numbers which leave no remainder after division by 12.

These 12 sets act just like the 12 numbers on a clock, such that a number with remainder 3 plus a number with remainder 11 will give you a number with remainder 2. So in the above examples, 27 + 59 = 86 will have remainder 2.

For our trick, imagine of clock of size 9. In fact the digital sum of a number is just a quick way to find its remainder after division by 9. And the idea of casting out nines is a simple method to check whether the remainders after division by 9 are consistant, where multiples of nine have no effect since they have no remainder after division by 9.

*This is a beautiful and simple result in number theory, which illustrates the power and elegance of mathematics.*

*It can also be used for cheap tricks.*