The kind of magic that grabs (and enchants) me is fantasy-literature magic, not stage-magic, but this month I’ll make an exception to talk about a new math trick inspired by Art Benjamin’s fun-packed book “The Magic of Math: Solving for x and Figuring Out Why”.
After you read this essay, you’ll be able to compute the answer to questions like “What’s the remainder when you divide 123456789 by 9?” or “What’s the sum of the digits when you multiply 123456789 by 9?” without setting pencil to paper, purely through the power of your mind. But before I explain that, I’d better address the question many of you are asking: why would anyone want to learn how to do this sort of thing? (Short answers: to stay sane, to balance their checkbook, and/or to become fame-ish.)
But first, a few words about numbers, rapidity, and mental math.
I HATE NUMBERS1
Do I hate numbers? No, actually, I don’t. In fact I like numbers a lot. What I hate is the way an impoverished view of numbers, fixated on basic arithmetic, has become synonymous with mathematics for so many people. “You’re a mathematician? Don’t they already know all the numbers?” That sort of thing.
“Math is not about numbers!”, I want to shout to the world. Except, of course, a lot of it is about numbers. Or rather, it’s about the beautiful things that lie behind the numbers, and the myriad connections between all those different things. The domain of math is like a vast curiosity shop, with numbers as the front window display. Some people (like the kid I once was) find the display arresting, and others find it repellent, but people who haven’t entered the shop don’t realize that the best stuff can’t be seen through the front window.
When numbers are all that people see, too many people conclude that that’s all there is.
Many mathematicians share my attitude toward numbers. For instance, I just watched a video in which Cliff Stoll exclaims “If you think math is about numbers, you probably think that Shakespeare is all about words.” Well said! My only complaint about Stoll’s complaint is that the video was on a YouTube channel about math that could have been called Mathophile but is actually called, yeah, Numberphile. Sigh.
It also saddens me that people confuse what mathematicians mean by “numbers” with what mathematicians consider mere representations of numbers. “Five is prime” is an eternal verity; “Five is a single-digit number” is a parochial assertion whose truth depends on what base representation system you’re using. But the public is mostly aware of how numbers are represented, not what lies behind them.
Consider a recent math news story featured on the BBC: the story of South African ten-year-old Sibahle Zwane. It’s great that the kid can mentally multiply 78,000 by 550 instantly (it took me a full half minute!2), but this kind of feat bears the same relationship to mathematics that being an expert speller bears to writing literature. Media outlets should by all means report on lightning mental calculators; the reports make great human interest stories, and these people’s achievements highlight one aspect of math. But the media shouldn’t suggest that this is central to what math is about.
Whew! Now that I’ve gotten that off my chest, I can talk about tricks for doing mental arithmetic in base ten.
I said that mental calculation can keep you sane. Here’s the example I was thinking of.
Jakow Trachtenberg was a Russian-Jewish engineer who, after moving to Germany, got on Hitler’s bad side through his anti-fascist activities and ended up in a concentration camp.3 In the words of the book “The Trachtenberg Speed System of Basic Mathematics” (page 10):
To keep his sanity, Trachtenberg moved into a world of his own — a world of logic and order. … He did not have books, paper, pen, or pencil. But his mind was equal to the challenge.
Trachtenberg came up with a method of doing complicated arithmetic problems in one’s head, without over-taxing one’s short-term memory. Trachtenberg survived, and after World War II ended, he set up an Institute in Zurich to teach children and adults the methods he had come up with. The book describes a typical moment in a class:
A small girl with beribboned braids was asked to find the solution of 735352314 times 11. She came up with the correct answer — 8088875454 — in less time than you can say multiplication table.
Here the trick is to string together all sums obtained by adding two consecutive digits, from left to right (tacking on the first digit of the given number at the beginning and the last digit at the end), like this:
7, 7+3, 3+5, 5+3, 3+5, 5+2, 2+3, 3+1, 1+4, 4
= 7, 10, 8, 8, 8, 7, 5, 4, 5, 4.
When a sum is 10 or larger, we reduce it by 10 and carry a 1 to the left:
Those are the digits of the answer. To see why the method works, multiply 735352314 in the conventional way, and compare.
It’s fitting that Trachtenberg, the victim of a regime led by madmen who refused to ask the question “But what if I’m wrong?”, incorporated checking for errors as one of the pillars of his method. Trachtenberg didn’t make the mistake of assuming that people never make mistakes. Instead, he prescribed procedures that, most of the time, catch the sorts of mistakes that people tend to make when doing arithmetic (such as failing to do carrying and borrowing properly). Trachtenberg’s technique for catching errors was the ancient method of digital roots, also called the method of casting out nines.
If n is a positive integer, the (base ten) digital root of n is the number you get by adding all the digits of n, unless that sum is bigger than 9, in which case the digital root of n is the sum of all the digits of that number, unless that number is bigger than 9, in which case … well, you get the idea. For instance, the digital root of 345 is 3 because 3+4+5 = 12 and 1+2 = 3.
What makes digital roots useful for checking addition of positive integers is that the digital root of the sum of two numbers is the digital root of the sum of the digital roots of the two numbers. That’s a mouthful, so let’s do an example with a = 457 and b = 368, whose sum is c = 825. The digital roots of a, b, and c are 7, 8, and 6. If you sum the digital roots of a and b you get 15, and if you take the digital root of 15 you get 6, which, sure enough, is the digital root of c.
I won’t give an explanation of why this principle works (for that, see Gardner’s article “Digital Roots”), but I can part the curtains a little bit by telling you that when n is a multiple of 9, the digital root of n is always 9, and that when n isn’t a multiple of 9, the digital root of n is the remainder you get when you divide n by 9.
Digital roots show their worth when a mistake happens. Suppose we miscalculated 457+368, obtaining c‘ = 725 instead of 825. The digital root of 725 is 5, which is not the digital root of the sum of the digital roots of a and b. This discrepancy alerts us that something has gone wrong.
The appearance of this discrepancy in this case was no accident. If you perform any single-digit alteration of the correct value of a + b (other than replacing a 0 by a 9 or vice versa), obtaining some incorrect answer c’, the digital root of c‘ won’t equal the digital root of the sum of the digital roots of a and b, so you’ll be able to detect that c’ is a wrong answer.
The use of digital roots to check calculations is over a thousand years old; the Indian mathematician and astronomer Aryabhata described the method in his Mahâsiddhânta, written around 950. Ten centuries before the invention of error-correcting codes and fault-tolerant methods of computation (not to mention check-sum schemes for detecting mis-entered or bogus credit card numbers), digital roots enabled human calculators to catch their errors a high proportion of the time.
In computing the digital root of n, there are lots of shortcuts that make the computation more like a game of solitaire. As you add up the digits, you can ignore all the 9’s, and whenever you see two or more digits that add up to 9, you can ignore them as well. (Hence the popular name “casting out nines”.) Also, when your running sum of digits gets bigger than 9, you can subtract 9. Or you can choose not to! Like Exploding Dots, casting out nines gives you lots of freedom. But no matter what choices you make along the way, you’ll always arrive at the same single-digit number, namely the digital root of n. (I won’t explain why these shortcuts work; readers in search of deeper understanding might want to read the Math Forum article mentioned in the References.)
Casting out nines also works for sums of more than two numbers. This is useful when you’re adding a column of numbers numbers. Being able to check your sums is pretty handy when it comes to checking, where by “checking” I mean writing checks and all that! I balance my checkbook by hand, and often use casting out nines to catch mistakes.
Casting out nines also works for multiplication problems involving positive integers, because the digital root of the product of two (or more) numbers is the digital root of the product of the digital roots of the numbers.
DIVIDING BY NINE
When the digits of a number n add up to less than nine, there’s a nice way to divide n by nine in your head, getting both the quotient and remainder right. For instance, take the number 4121. Using the trick I’m about to show you, I can determine in my head that 4121 divided by 9 is 457 with a remainder of 8, or if you prefer an exact fractional answer, 4121/9 equals 457 plus 8/9. How did I do it? I computed successive partial sums of the digits of 4121, from left to right:
4 = 4
4 + 1 = 5
4 + 1 + 2 = 7
4 + 1 + 2 + 1 = 8
The last sum (the sum of all the digits) gives the remainder, and the earlier sums give the successive digits of the quotient.
James Tanton, in his video “Dividing by Nine: Something Cute”, gives a beautiful proof of this using infinite decimals. For instance, to apply his argument to 4121/9, he would have us construct the decimal expansion of (4000+100+20+1)/9 by adding the decimal expansions of 4000/9, 100/9, 20/9 and 1/9:
(If that went by too fast, see Tanton’s video for more details.)
If the digits of the original number add up to 9 or more, then some modifications of the trick are required. For instance, consider the number 4122, whose digits add up to 9. Applying the preceding method, we find that 4122 divided by 9 is “457 remainder 9”, but the right answer is 458 remainder 0. Tanton’s video gives an example where the sum of the digits is larger than 9. It seems in such cases that one needs to use more working memory (either in one’s head or on a piece of paper). Does anyone know of a good way to mentally divide positive integers with large digit-sum by nine?
MULTIPLYING BY NINE
I don’t know of a good trick for mentally multiplying a positive integer n by nine (the method given by Trachtenberg seems hard to me). But mathematician David Einstein came up with a trick for mentally computing the sum of the digits of the product 9n. (It was new to me. If any of you have seen this before, please let me know!)
Because 9n is a multiple of 9, we know ahead of time that the sum of the digits of 9n must also be some multiple of nine, but which? It turns out that there is a rule for determining the sum of the digits.
The rule is easiest to describe in the case where no two consecutive digits of n are equal. Then the sum of the digits of 9n is always 9(d+1), where d is the number of descents in n. Here a descent is defined as a pair of successive digits with the second digit smaller than the first.
For instance, consider n = 31415926535. There are five descents: 31, 41, 92, 65, and 53. So by Einstein’s formula, the sum of the digits of 9n is 9 × 6, or 54.
(See Endnote 4 for a discussion of the general case.)
Notice that if n has no descents, the sum of the digits of 9n is exactly 9(0+1) = 9. This fact — a special case of Einstein’s observation — was pointed out in print in an article by Felix Lazebnik. Art Benjamin mentioned the fact in his book, which is how I came across it. It’s interesting to compare this fact with what we learned in the preceding section. Suppose we have a number n whose digits sum to exactly 9. Such a number must be a multiple of 9, so let’s write n = 9m. We have a procedure for computing the digits of n/9 by computing partial sums of digits, so the resulting sequence of digits will be weakly increasing (with each digit at least as large as the one before). But such a sequence of digits will have no descents, so when we multiply m by 9, we get a number whose digits sum to 9(0+1) = 9; and that’s what we’d better get, since multiplying m by 9 gives us n again, and we started from the assumption that the sum of the digits of n is exactly 9!
To turn this mathematical fact into a bit of mathematical stage magic, you could call a random member of the audience up on stage, give them cards numbered 1 through 9, instruct them to shuffle the cards and deal out them out in a row, and have them write the resulting 9-digit number on the board. You ask them to multiply that number by 9 and compute the sum of the digits of the product. Meanwhile, unbeknownst to your audience, you mentally count the descents, add 1, and multiply by 9, to arrive at the same number in less time than it takes the audience-member to multiply the number by 9 on a calculator and add the digits.
I mentioned Einstein’s trick to Art Benjamin, and he replied:
The cleanest way to perform the trick would be to give them 9 cards, the ace through 9 and have them mix up the cards. Explain that you will race them in the following calculation: they are to quickly deal the cards face up (from left to right or right to left) then multiply the resulting 9-digit number by 9 and add the digits. You will have the total as soon as they deal the last card.
For an extra touch of flair, announce the result of the same calculation when the cards are read off in the reverse order (switching left and right), and have the audience member check that this total too is correct. And then, for the coup de grace, point to a sealed envelope that’s been resting on the table throughout the trick. You announce that it contains the sum of the two totals. And sure enough, it does!
How could you know the sum in advance? The secret is that if a sequence of nine distinct digits has d descents, the reverse sequence has 8−d descents, and 9(d+1) + 9(8−d+1) = 9×10 = 90, regardless of the value of d.
Art Benjamin has made a name for himself in the worlds of math and magic by developing and perfecting tricks like this. His 2005 TED talk “A performance of Mathemagic” has been viewed nearly nine million times. So if you get good enough at tricks like this, there are people who’ll pay good money to see you, or who will at least watch you on their lunch break.
Thanks to Art Benjamin, David Einstein, Sandi Gubin, Christian Lawson-Perfect, Felix Lazebnik, Evan Romer, Shecky Riemann and James Tanton.
Next time: Who Mourns the Tenth Heegner Number?
#1. I don’t care for Numb3rs, but that’s a rant for another time.
#2. 78 × 55 is 39 × 110 (you don’t change the product of two numbers if you halve one factor and double the other). I know from Trachtenberg (the wonderful multiplying-by-eleven trick) that 39 times 11 is “three hundred and twelvety-nine”, which sensible people call four hundred and twenty-nine. Since 39 × 11 is 429, 39 × 110 is 4290. So 78 × 55 is 4290. 78,000 is 78 with 3 extra zeroes added at the end, and 550 is 55 is 1 extra zero at the end, so 78,000 × 550 is 4290 with 3+1=4 extra zeroes added at the end, or 42,900,000.
#3. I learned about Jakow Trachtenberg’s work in short weekly bursts, over the course of years, sitting in my piano teacher’s waiting room. Leah Siegel had a bunch of things for curious kids to ponder, three of which made a permanent impression on me: a trammel of Archimedes, a book of cartoons by Charles Addams, and the book “The Trachtenberg Speed System of Basic Mathematics”, which tells the story of Trachtenberg’s system up to 1960.
As far as I can tell, nobody uses his system anymore; the Institute he founded seems not to exist. I would guess that, as calculators and computers became more widespread, and as educators of human children rightfully began placing less emphasis on the sorts of things computers are good at (such as calculation) and more emphasis on the sorts of things humans are good at (such as conceptual understanding), it became harder and harder to justify the widespread adoption of Trachtenberg’s methods. But perhaps the true story of the decline of Trachtenberg’s methods is a more interesting one. Do any of you know? Please let me know in the Comments. (By the way, speaking of speedy calculation, whatever happened to Speed Reading courses? That was a craze from the 1960s that seems to have disappeared.)
#4. Einstein writes: “For the fully general trick start with zero, then add one if the least significant digit is nonzero, add zero otherwise. Then scan the pairs of digits starting from the least significant pair. If the digits are unequal add one if they are a descent, add zero otherwise. If the digits are equal add whatever you did last time. Then multiply the total by nine. For example: if the number is 221120 then we count the 22 the 21 and the 20 to get 3, so the total digit sum of 9 × 221120 = 1990080 is 27.”
Art Benjamin, “The Magic of Math: Solving for x and Figuring Out Why”. Benjamin is also the author of “Mathemagics: How to Look Like a Genius Without Really Trying” and “Secrets of Mental Math: The Mathemagician’s Guide to Lightning Calculation and Amazing Math Tricks”.
Ann Cutler and Rudolph McShane (translators/adaptors), “The Trachtenberg Speed System of Basic Mathematics”.
Martin Gardner, “Digital Roots”, in “The Second Scientific American Book of Mathematical Puzzles and Diversions”. Gardner’s article contains a concise informal proof of the validity of casting out nines.
Martin Gardner, “Dollar Bills”, in “Mathematical Circus”. This essay contains some other tricks based on what magicians call the “nine principle”.
Felix Lazebnik, Surprises, Mathematics Magazine (Vol 87, No 3, June 2014).
Math Forum, Why Casting Out Nines Works.
James Tanton, “Dividing by Nine: Something Cute”.