# Vegas Street Magician Math Trick

I went walking with a friend of mine in Las Vegas last week. We turned a corner and saw a street magician doing some tricks for a crowd of 12-15 people. In most of his tricks, the magician would make a little money by getting the crowd to bet on something he had set up, such as which cup a ball was hidden under.

On one of the tricks, someone in the crowd won a quick $50. Anyway, after 10-15 minutes of watching him, we volunteered for the next trick. He handed each of us a pen, a small piece of paper, and a calculator. As he turned his back to us so that he couldn't see, we were each told to secretly, legibly write down any 5-digit number, so we did. He told me to 1. Add together all the digits in my number 2. Subtract that sum from the original number to get the final number and he told my friend to 1. Rearrange the digits in her number to make another number 2. Subtract the smaller number from the larger number to get the final number Then, he told us to add our two final numbers together, write the sum large and legibly on a piece of paper, and circle it. Lastly, we were told to choose exactly one non-zero digit in that final answer and underline it. We did that, and he then said he would ask us to read off to him, in any order, all of the digits except the one that we underlined, and then he would tell us which digit we had underlined. A guy behind us bet him$20 that he would not be able to guess the number in a single guess. He took the bet, and asked if there were any more bettors.

Should we have made a bet? Is there a way for the magician to know the digit for sure?

• Someone won $50.... his buddy won 50. – blankip Apr 7 '15 at 21:02 • Every time I see this question I read the title as "Vegan Street Magician Math Trick"! :-p – Rand al'Thor Apr 8 '15 at 0:22 • Regardless of whether or not there's any math behind it, the right answer is "No, don't bet against the street magician". He's not out there to give out money, so you can bet that the deck is stacked heavily in his favor, even if he resorts to cheating like having a compatriot slyly look over your shoulder while you're writing your 'secret' number. – Johnny Apr 8 '15 at 1:13 • You didn't actually do this, did you? – Joe Z. Apr 8 '15 at 1:44 • I believe the correct term is "mathemagician". – Ian MacDonald Apr 21 '15 at 21:32 ## 3 Answers He shouldn't have made the bet. We need one simple lemma. Lemma 1 - The remainder of a number when divided by 9 is equal to the remainder of the sum of its digits when divided by 9. Let our number be$n = d_k + 10d_{k-1} + \dots + 10^{k-1}d_1$where$d_i$is the$i^{\mathrm{th}}$digit from the left. Since we are interested in the remainder on division by 9, we can discard the parts that are surely divisible by 9. So we write, $$n = (d_k + \dots + d_1) + 9(d_{k-1} + 11d_{k-2} + \dots + 1\dots1d_1)$$ and thus we can discard the second parenthesis and we are left with the sum of$n$'s digits, proving the lemma. As a direct corollary, any number having the exact same digits as$n$and thus the same sum of digits will have the same remainder upon division by 9, and as the remainder of the difference between two numbers is the difference between their remainders, your friend ended up with a number that is divisible by 9. Similarly, when you added the digits of your number you got a new number that by the lemma has the same remainder upon division by 9 as your original number, and thus the difference is divisible by 9. By adding both of the results, we get a final number which is also divisible by 9. Now upon removing a digit, we subtract that digit from the sum of digits, and so the new remainder will be$9-d$. By calculating the remainder (adding the digits we read to him), the magician can easily find$9-d$and thus$d\$.

• There's one case where this doesn't entirely work - if the digit you remove is either a 0 or a 9, the mathemagician can't determine which it is. Simple example: 189 and 810 - you provide him with 1 and 8, the sum of which is already divisible by 9 – LogicianWithAHat Apr 23 '15 at 7:32
• @LogicianWithAHat, We are not allowed to remove a 0. – Ben Frankel Apr 23 '15 at 9:50
• My bad, missed that part. Sorry! – LogicianWithAHat Apr 23 '15 at 10:03

You should not have made a bet; the magician is guaranteed to know your number.

No matter the initial numbers, both you and your friend will end with numbers evenly divisible by 9. Since they're both divisible by 9, so will their sum be.

If a number is divisible by 9, the sum of its digits is also divisible by 9. The magician can sum the digits you tell him, then he knows the remaining digit is the one that will add to that sum to produce a multiple of 9.

I am posting this answer because the accepted answer sounds very "mathy". So, this answer is geared toward those who are less "mathy".

Number theory tricks that this puzzle uses:

1. When you sum the digits of any integer, and then subtract that sum from that integer, the result is always a multiple of 9.
2. When any integer's digits are rearranged, and then the smaller is subtracted from the larger, the result is always a multiple of 9.
3. If a number is a multiple of 9, then its digits always sum to a multiple of 9.

Example:
Person A picks 72,492
The digit sum is 7 + 2 + 4 + 9 + 2 = 24
72,492 - 24 = 72,468 (a multiple of 9, by #1 above)

Person B picks 80,331
The rearrangement is 30,831
80,331- 30,831 = 49,500 (a multiple of 9, by #2 above)

Person A and Person B add their resulting numbers together, which results in a larger multiple of 9 (by common sense):
72,468 + 49,500 = 121,968

Since 121,968 is a multiple of 9, then the digits must add up to a multiple of 9 (by #3 above)

So, the magician simply needs to add up the digits as they are being told to him, and the underlined (missing) digit is the number that would make the sum a multiple of 9.

For example, if we underlined the 6 in the above 121,698, then the magician would add up the other digits that we read to him, 1 + 2 + 1 + 9 + 8 = 21, and the next multiple of 9 is 27, which means that the missing number must be a 6, since 21 + 6 = 27.