In case anyone’s wondering, here’s a magic trick that I did my class for future secondary math teachers while dressed as Carnac the Magnificent. I asked my students to pull out a piece of paper, a pen or pencil, and (if they wished) a calculator. Here were the instructions I gave them:

- Write down just about any number you want. Just make sure that the same digit repeated (not something like 88,888). You may want to choose something that can be typed into a calculator.
- Scramble the digits of your number, and write down the new number. Just be sure that any repeated digits appear the same number of times. (For example, if your first number was 1,232, your second number could be 2,231 or 1,322.)
- Subtract the smaller of the two numbers from the bigger, and write down the difference. Use a calculator if you wish.
- Pick any nonzero digit in the difference, and scratch it out.
- Add up the remaining digits (that weren’t scratched out).

I asked my students one at a time what they got after Step 5, and I responded, as the magician, with the number that they had scratched out. One student said 34, and I answered 2. Another said 24, and I answered 3. After doing this a couple more times, one student simply stated, “My mind is blown.”

This is actually a simple trick to perform, and the mathematics behind the trick is fairly straightforward to understand. Based on personal experience, this is a great trick to show children as young as 2nd or 3rd grade who have figured out multiple-digit subtraction and single-digit multiplication.

I offer the following thought bubble if you’d like to think about it before looking ahead to find the secret to this magic trick.

What the magician does: the magician finds the next multiple of 9 greater than the volunteer’s number, and answers with the difference. For example, if the volunteer answers 25, the magician figures out that the next multiple of 9 after 25 is 27. So 27-25 = 2 was the digit that was scratched out.

This trick works because of two important mathematical facts.

**(1)** The difference between the original number and the scrambled number is always a multiple of 9. For example, suppose the volunteer chooses 3417, and suppose the scrambled number is 7431. Then the difference is

Each of the numbers in parentheses is a multiple of 9, and so the difference must also be a multiple of 9.

A more algebraic proof of (1) is set apart in the block quote below; feel free to skip it if the above numerical example is convincing enough.

More formally, suppose that the original number is in base-10 notation, and suppose the scrambled number is , where is a permutation of the numbers . Without loss of generality, suppose that the original number is larger. Then the difference is equal to

The transition from the second to the third line work because the terms of the first sum are merely rearranged by the permutation .

To show that is a multiple of 9, it suffices to show that each term is a multiple of 9.

- If , then , and the term in parentheses is guaranteed to be a multiple of 9.
- If , then , and the term in parentheses is guaranteed to be a (negative) multiple of 9.
- If , then , a multiple of 9.

Because the difference is a multiple of 9, we use the important fact** (2)** that a number is a multiple of 9 exactly when the sum of its digits is a multiple of 9. Therefore, when the volunteer offers the sum of all but one of the digits of , the missing digit is found by determining the nonzero number that has to be added to get the next multiple of 9. (Notice that the trick specifies that the volunteer scratch out a nonzero digit. Otherwise, there would be an ambiguity if the volunteer answered with a multiple of 9; the missing digit could be either 0 or 9.)

As I mentioned earlier, I showed this trick (and the proof of why it works) to a class of senior math majors who are about to become secondary math teachers. I think it’s a terrific and engaging way of deepening their content knowledge (in this case, base-10 arithmetic and the rule of checking that a number is a multiple of 9.)

As thanks for reading this far, here’s a photo of me dressed as Carnac as I performed the magic trick. Sadly, most of the senior math majors of 2013 were in diapers when Johnny Carson signed off the *Tonight Show* in 1992, so they didn’t immediately get the cultural reference.

## 3 thoughts on “A mathematical magic trick”