Divisibility tricks

Based on personal experience, about half of our senior math majors never saw the basic divisibility rules (like adding the digits to check if a number is a multiple of 3 or 9) when they were children. I guess it’s also possible that some of them just forgot the rules, but I find that hard to believe since they’re so simple and math majors are likely to remember these kinds of tricks from grade school. Some of my math majors actually got visibly upset when I taught these rules in my Math 4050 class; they had been part of gifted and talented programs as children and would have really enjoyed learning these tricks when they were younger.

Of course, it’s not my students’ fault that they weren’t taught these tricks, and a major purpose of Math 4050 is addressing deficiencies in my students’ backgrounds so that they will be better prepared to become secondary math teachers in the future.

My guess that the divisibility rules aren’t widely taught any more because of the rise of calculators. When pre-algebra students are taught to factor large integers, it’s no longer necessary for them to pre-check if 3 is a factor to avoid unnecessary long division since the calculator makes it easy to do the division directly. Still, I think that grade-school students are missing out if they never learn these simple mathematical tricks… if for no other reason than to use these tricks to make factoring less dull and more engaging.

A mathematical magic trick

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:

  1. 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.
  2. 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.)
  3. Subtract the smaller of the two numbers from the bigger, and write down the difference. Use a calculator if you wish.
  4. Pick any nonzero digit in the difference, and scratch it out.
  5. 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.

green_speech_bubbleWhat 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 D 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

7431 - 3417 = (7000 + 400 + 30 + 1) - (3000 + 400 + 10 + 7)

= (7000 - 7) + (400 - 400) + (30 - 3000) + (1 - 10)

= 7 \times (1000-1) + 4 \times (100-100) + 3 \times (10-1000) + 1 \times (1-10)

= 7 \times (999) + 1 \times (0) + 4 \times (-990) + 3 \times (-9)

Each of the numbers in parentheses is a multiple of 9, and so the difference D 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 a_n a_{n-1} \dots a_1a_0 in base-10 notation, and suppose the scrambled number is a_{\sigma(n)} a_{\sigma(n-1)} \dots a_{\sigma(1)} a_{\sigma(0)}, where \sigma is a permutation of the numbers \{0, 1, \dots, n\}. Without loss of generality, suppose that the original number is larger. Then the difference D is equal to

D = a_n a_{n-1} \dots a_1a_0 - a_{\sigma(n)} a_{\sigma(n-1)} \dots a_{\sigma(1)} a_{\sigma(0)}

D = \displaystyle \sum_{i=0}^n a_i 10^i - \sum_{i=0}^n a_{\sigma(i)} 10^i

D = \displaystyle \sum_{i=0}^n a_{\sigma(i)} 10^{\sigma(i)} - \sum_{i=0}^n a_{\sigma(i)} 10^i

D = \displaystyle \sum_{i=0}^n a_{\sigma(i)} \left(10^{\sigma(i)} - 10^i \right)

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

To show that D is a multiple of 9, it suffices to show that each term 10^{\sigma(i)} - 10^i is a multiple of 9.

  • If \sigma(i) > i, then 10^{\sigma(i)} - 10^i = 10^i \left( 10^{\sigma(i) - i} - 1 \right), and the term in parentheses is guaranteed to be a multiple of 9.
  • If \sigma(i) < i, then 10^{\sigma(i)} - 10^i = 10^{\sigma(i)} \left( 1-10^{i-\sigma(i)} \right) = -10^{\sigma(i)} \left( 10^{i-\sigma(i)} - 1 \right), and the term in parentheses is guaranteed to be a (negative) multiple of 9.
  • If \sigma(i) = i, then 10^{\sigma(i)} - 10^i = 0, a multiple of 9.

\hbox{QED}

Because the difference D 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 D, 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.

542597_10200255338162345_209138628_n

On joking with students

At some point in recent years, my students lost the ability of discerning when I playfully give them a hard time. To pick just one example of many from last semester…

Student: Did you get my homework that was slid under your door last Thursday?
Me: Oh, so *that’s* what I threw in the trash on Friday.
Student: (groans) I told my friend that she should’ve put it in your mailbox. Is there anything I can do to get my homework to you?
Me: Nope. C’est la vie.

I kept this up for about a minute before telling him that I was only kidding and that I had his homework. And this is just one of several anecdotes I could relate.

I conclude that either:

  1. I’m a world-class comedic straight-man up there with Bud Abbott and “Super” Dave Osborne,
  2. I’ve now old enough to be around the age of my students’ fathers instead of their older brothers, and so the jokes that worked 10 years ago elicit a different response now, or
  3. (more likely) Students have been so conditioned by past experiences with inflexible and uncompromising professors that they react submissively when I feign unreasonableness.

Epsilon

Years ago, when I taught calculus, I’d usually include the following extra credit question on the first exam: “In the small box, write a good value for \varepsilon. A valid answer gets 4 points; the smallest answer in the class will get 5 points.” It was basically free extra credit… any positive number would work, but it was a (hopefully) fun way for students to be a little competitive in coming up with small positive numbers, which is the intuitive meaning of \varepsilon in mathematics. (I still remember when my high school math teacher was giving me directions to a restaurant, concluding “You’ll know you’re within \varepsilon of the restaurant when you see the signs for Such-and-Such Mall.”)

Most students volunteered something like 0.0000001 or 10^{-9999999999999999}. Except for one particularly gutsy student who wrote, “The probability that Dr. Q gets a date on Friday night.” For sheer nerve, he got the 5 points that year.

Also getting 5 points that year was the best answer of the class: “Let x be the smallest answer that anyone else wrote. Then \varepsilon = x/2.” That was especially clever from a calculus student, as that’s the essence of a fairly common technique when writing proofs in real analysis.

Acceleration

The following two questions came from a middle-school math textbook. The first is reasonable, while the second is a classic example of an author being overly cute when writing a homework problem.

  1.  A car slams on its brakes, coming to a complete stop in 4 seconds.  The car was traveling north at 60mph. Calculate the acceleration.
  2. A rocket blasts off. At 10 seconds after blast off, it is at 10,000 feet, traveling at 3600mph.  Assuming the direction is up, calculate the acceleration.

For the first question, we’ll assume constant deceleration (after all, this comes from a middle-school textbook). First, let’s convert from miles per hour to feet per second:

60 ~ \frac{\hbox{mile}}{\hbox{hour}} = 60 ~ \frac{\hbox{mile}}{\hbox{hour}} \times \frac{1 ~ \hbox{hour}}{3600 ~ \hbox{second}} \times \frac{5280 ~ \hbox{feet}}{1 ~ \hbox{mile}} = 88~ \frac{\hbox{feet}}{\hbox{second}}

The deceleration is therefore equal to the change in velocity over time, or

\frac{-88 ~ \hbox{feet/second}}{4 ~ \hbox{second}} = -22 ~\hbox{ft/s}^2

Now notice the word north in the statement of the first question. This bit of information is irrelevant to the problem. I presume that the writer of the problem wants students to practice picking out the important information of a problem from the unimportant… again, a good skill for students to acquire.

green line

Let’s now turn to the second question. At first blush, this also has irrelevant information…  it is at 10,000 feet. So I presume that the author wants students to solve this in exactly the same way:

3600 ~ \frac{\hbox{mile}}{\hbox{hour}} = 3600 ~ \frac{\hbox{mile}}{\hbox{hour}} \times \frac{1 ~ \hbox{hour}}{3600 ~ \hbox{second}} \times \frac{5280 ~ \hbox{feet}}{1 ~ \hbox{mile}} = 5280 ~ \frac{\hbox{feet}}{\hbox{second}}

for an acceleration of

\frac{5280 ~ \hbox{feet/second}}{10 ~ \hbox{second}} = 528 ~\hbox{ft/s}^2

The major flaw with this question is that the acceleration of the rocket completely determines the distance that the rocket travels. While middle-school students would not be expected to know this, we can use calculus to determine the distance. Since the initial position and velocity are zero, we obtain

x''(t) = 528

x'(t) = \int 528 \, dt = 528t + C

x'(0) = 528(0) + C

0 = C

\therefore x'(t) = 528t + 0 = 528t

x(t) = \int 528t \, dt = 264t^2 + C

x(0) = 264(0)^2 + C

\therefore x(t) = 264t^2 + 0 = 264t^2

Therefore, the rocket travels a distance of 264 ~ \hbox{feet/second}^2 \times (10 ~ \hbox{second})^2 = 26400 ~ \hbox{feet}. In other words, not 10,000 feet.

As a mathematician, this is the kind of error that drives me crazy, as I would presume that the author of this textbook should know that he/she just can’t make up a distance in the effort of making a problem more interesting to students.