Casting Out Nines: What and How

This old technique for checking arithmetic is both easy and hard to describe: easy to explain in advanced terms, but hard to explain in elementary terms. We’ll try to do it all here, but a fuller explanation of the “why” will come next week.

What it is

We’ll start with a question from James in 1998:

Casting Out Nines

I am trying to find a reference which defines this mathematical operation ["casting out nines"].  I have looked in multiple texts in library and book stores without success.  A definition would be a start for me to try and understand the concept.  Thanks

Doctor Rob answered:

Casting out nines is the name of a technique for checking arithmetic.  It depends for its use on the idea of the digital sum of a number.  The digital sum of any positive integer (or whole number) is gotten by adding up all the digits of the number.  If the result has more than one digit, repeat this, until the result is a one-digit number.  That digit is the digital sum of the starting positive integer.


  9974 -> 9+9+7+4 = 29 -> 2+9 = 11 -> 1+1 = 2,

so 2 is the digital sum of 9974.

Let's write s(9974) = 2.

If you are familiar with modular arithmetic, the digital sum of a number is the smallest nonnegative representative of its congruence class modulo 9.

Another way to say that last bit is that the digital sum turns out to be the remainder (almost) when you divide the number by 9. For example, if you divide 9974 by 9, you get a quotient of 1108 and a remainder of 2, because \(9974=9\times1108+2\). Adding digits is a quick way to find this remainder.

The number that is here called the digital sum has several names; the most formal term is digital root, which clarifies that it is more than just a simple sum; I’ll later use check digit for simplicity.

Now the important facts about digital sums and arithmetic are that:

   s(a+b) = s(s(a)+s(b)),
   s(a*b) = s(s(a)*s(b)).

The idea here is that the digital sum is preserved by addition and multiplication: The digital sum of a sum is the digital sum of the sum of the digital sums of the addends, and the same for multiplication. It’s much harder to say than to do!

We use this to check addition and multiplication as follows:

   9974 + 2348 ?=? 12422.
   s(s(9974)+s(2348)) = s(2+8) = s(10) = 1,
   s(12422) = 2.

This means that the sum given is incorrect.

So if we think that \(9974+2348=12,422\), we can check the digital sums and see that it can’t be correct, because if it were, the digital sums of both sides would be the same. (In fact, \(9974+2348=12,322\). One digit was wrong.)

Similarly, for multiplication:

   9974*2348 ?=? 23418952.
   s(s(9974)*s(2348)) = s(2*8) = s(16) = 7,
   s(23418952) = 7.

This means that the product given is likely to be correct.

We thought that \(9974\times2348=23,418,952\), and the digital sums are compatible with that claim. But it doesn’t prove we are actually right:

This kind of checking will find many errors, but not all!  An interchange of two digits (23418952 vs. 23419852) will not be detected, and replacing a 9 by a 0 or vice versa will not be detected.

Swapping digits will not change the digital sums, so the answer stills looks like it could be right. As we’ll see, if we’re wrong, we have an 11% chance of catching the error.

To check subtraction, use the fact that a - b = c means a = b + c.
To check division, use the fact that a/b = c means a = b*c.
To deal with zero, you can define s(0) = 0.
To deal with negative numbers, you can define s(-a) = 9 - s(a).

We’ll see examples of subtraction and division below. When one of the numbers is zero, we don’t really need to check; but it’s nice to know what to do; when one is negative, we usually deal with signs separately. We’ll see the last comment, about negatives, below when we check subtraction directly.

What it is … without the big words

That got a little complicated. Here’s another question, from 1999:

Casting Out Nines to Check Arithmetic

My teacher was talking about casting out 9's. She said it was the easiest way to check the problems. No one in the class understands this method. She is a new teacher, we're in the 6th grade, and she was teaching high school math.

Thank you,
Jason Fowler

I fully understand the difficulty of explaining this at a fully elementary level! I first referred to the answer above and to an explanation we’ll see next time:

Hi, Jason.

Casting out nines is not high-school math if all you want to do is use it; but it can take some effort to explain why it works without getting into hard stuff. Here are two explanations of it in our archives, both of which get into some deeper ideas than you want by way of explaining how it works:

   Casting Out Nines and Elevens

   Casting Out Nines  

I'll give you a quick explanation of how to do it, without the big words.

We’ll see why it works next time, again at elementary and advanced levels.

First, for any number we can get a single digit, which I will call the "check digit," by repeatedly adding the digits. That is, we add the digits of the number, then if there is more than one digit in the result we add its digits, and so on until there is only one digit left. 

For example, for the numbers 6395 and 1259, we get:

     6395 --> 6 + 3 + 9 + 5 = 23 --> 2 + 3 = 5
     1259 --> 1 + 2 + 5 + 9 = 17 --> 1 + 7 = 8

My term “check digit” is commonly used in computers, where for example UPC or ID numbers often include an extra digit that checks whether the others are copied correctly. I used this general term to keep things simple.


Now, it turns out that if you add or multiply a set of numbers, the check digit of their sum is the same as the check digit of the sum of the check digits. You can think of it like this:

     numbers -----> digits
        |    check    |
        |     (1)     |add
        |             |(2)
        |             V
        |add         sum -----> digit
        |(4)             check    |
        |                 (3)     |equal?
        |         (5)             | (6)
        V        check            V
       sum -------------------> digit

That is, if you calculate the check digit (1) of each number you're adding, then add these (2) and calculate the check digit of the sum (3), that should be the same as the check digit (5) of the sum (4) you are checking.

You don’t need to use the diagram, but it was the best way I could think of to picture the process.

In our example, the sum of the numbers is

     + 1259
       7654 --> 7 + 6 + 5 + 4 = 22 --> 2 + 2 = 4

with check digit 4, and the sum of their check digits is

     + 8
      13 --> 1 + 3 = 4

So the check digit of the sum is 4, and the check digit of the sum of the check digits 5 and 8 is also 4. If they didn't agree, we'd know something was wrong. Here's my diagram:

     6395 -------> 5
     1259 -------> 8
       |   check   |
       |           |add
       |           |
       |           V
       |add       13 -------> 4
       |              check   |
       |                      |equal? yes!
       |                      |
       V         check        V
     7654 ------------------> 4


The same routine works when you multiply:

Similarly, for multiplication, the product of the numbers is

     x  1259
     8051305 --> 8 + 0 + 5 + 1 + 3 + 0 + 5 = 22 --> 2 + 2 = 4

and the product of the check digits is

     x 8
      40 --> 4 + 0 = 4

which agrees with our product:

      6395 -------> 5
      1259 -------> 8
        |   check   |
        |           |mult
        |           |
        |           V
        |mult      40 -------> 4
        |              check   |
        |                      |equal? yes!
        |                      |
        V         check        V
     8051305 ----------------> 4

(You wouldn't normally get the same check digit for the result of the sum and the products; I just picked a weird example.)

Subtraction and division

You can also apply the process to subtraction and division, but because of some special cases you have to deal with, it's easier to transform the problem to an addition or multiplication. For example, to check the subtraction:

     - 6395

you would transform it to the addition I did above. 

To check this division:

          _____6395_rem 342
     1259 ) 8051647

you would transform it to the multiplication I did above, by adding the check digit of the remainder to the product of the check digits of the quotient and the divisor, and checking whether this is equal to the dividend:

        6395 -->   5
     x  1259 --> x 8
     -------     ---
     8051305      40 -->   4
     +   342 ----------> + 9
     -------             ---
     8051647 ---> 4 <---  13

In other words, you apply casting out nines not to the subtraction or division itself, but to the standard check, in which you reverse the problem by adding the subtrahend to the difference or multiplying the quotient by the divisor.

So the division $$8051647\div1259=6395\text{ R }342$$ is equivalent to the equation $$1259\times6395+342=8051647$$ so we need to check the multiplication and addition together in order to check the division.

Some extra details

Note also that casting out nines only works to check an exact calculation, including the remainder; it can’t check a decimal or rounded answer.

If the check digits don't come out right, you must have made a mistake in your arithmetic (either in the problem you're checking, or in calculating the check digit); but if the check digits agree, your work could still be wrong, such as if you switched two digits when you were copying. In fact, I use a variant of this method when I balance my checkbook. If I get the wrong balance, I know my calculator didn't add wrong, but I may have entered something wrong. If the check digit for my balance is the same as what the bank says, I can guess that I reversed two digits somewhere; if they are different, it's more likely that I dropped a digit, or perhaps a whole transaction.

I don’t do that much any more, but it can still be worth doing!

If you want to know what this has to do with nines, or why it works, check out the other answers I referred to above. The basic idea is that the check digit is essentially the remainder after you divide by 9. (A slightly more advanced way of working with these check digits is to treat a result of 9 as a zero, so that check digits are always between 0 and 8 rather than 1 and 9, making it a genuine remainder.)

This is why it’s called casting out nines:

You may notice that when you add the digits of 6395, if you just ignore the 9, and the 6+3 = 9, you still end up with 5 as your check digit. This is because any 9's make no difference in the result. That's why the process is called "casting out" nines. Also, at any step in the process, you can add digits, not just at the end: to do 8051647, I can say 8 + 5 = 13, which gives 4; plus 1 is 5, plus 6 is 11, which gives 2, plus 4 is 6, plus 7 is 13 which gives 4. I never have to work with numbers bigger than 18.

This “running check” is very useful when you do this all in your head.

I hope this clarifies what you're doing. It takes a lot of words to explain, but it's really easy to do. Keep at it and you'll get the idea. If you want a simpler explanation of WHY the method works than we have in our archives, write back and I can send that to you too.

We’ll see that next time.

More on subtraction

A 2003 question focused on subtraction, and was added to this page:

Dear Dr. Math, 

I don't understand casting out nines. Can you help me?

Here is an example
- 1581
I know that it equals  2361

I think that you would add the numbers together and you would throw out the nines, so it would be
  3942 (0)
- 1581 (6)
so what would the answer be?  (3?)

How do you get that though ?

Note that Sarah didn’t just add \(3+9+4+2=18, 1+8=9\), but followed the full “casting out nines” procedure, replacing the final single digit of 9 with 0, which is the actual remainder when you divide this number by 9. More on that below!

I suspect that using the method to check subtraction is not taught as often as for addition and multiplication.

I answered again:

Hi, Sarah.

I would usually check a subtraction by checking the equivalent addition; here 2361 + 1581 = 3942. In this case, the reduced digit sums are 3, 6, and 0, which is correct since 3+6=9 which reduces to 0.

But you can cast out nines to check subtraction directly, if you add one step. In this example you want to subtract 6 from 0. To make the 0 big enough to subtract, you can "borrow" a 9, by adding 9 to the zero. (Just as you reduce by casting out nines, you can grab an extra nine when you need one.) Now you are subtracting 6 from 9, which gives you the 3 you expect.

Just as 9’s can be ignored because they are equivalent to zero, you can add in a 9 when the result would otherwise be negative. This is the point of the last line in Doctor Rob’s answer above.

Why it doesn’t catch every error

A 2001 question reveals a “flaw”:

When Casting Out Nines Fails

My son is doing Abeka 6th grade math. I was intrigued with checking math by casting out 9's. I introduced this technique to a friend. Just to prove that casting out 9's worked, I intentionally used an incorrect answer (quotient). I was shocked when the problem checked out correctly. Here is the problem. Divisor 6, Dividend 5223, and Quotient 875. Have I done something wrong? I know the correct answer is 870 R. 3.

Really stumped,
Teresa Miller

I’m reminded of a story my father used to tell about a demonstration he did in a marketing class in college. As part of his sales pitch for a newfangled self-sealing car tire, he hammered a nail into a tire – which promptly went flat. He had failed to learn that it only worked when the tire was warm from driving, so his demo failed. Here, the demonstration of casting out nines “failed”, because Teresa didn’t know all about what it really does.

I answered:

Hi, Theresa.

It's not at all surprising that casting out nines would fail; it puts all numbers into one of 9 categories, so it will catch an error that puts it into one of the 8 wrong categories, but not one that happens to land it back in the "right" category. This means there is a 1 in 9 chance that a random error will look okay. When the method is taught, it should always be pointed out that it can tell you if an answer is wrong, but can't be trusted to tell you that it is right!

The logic of the method is this: If the result is correct, the check digits will agree, so if the check digits disagree, the result must be incorrect. This says nothing about what is true if the check digits agree! (See Why, in Logic, Does “False” Imply Anything?)

In your example, your check should look something like this:

    Claim: 875 * 6 + 0 = 5223
    Check:  8  * 6 + 0 =? 3
                     3 =? 3

(There are different ways to arrange the work, of course. I calculated the digit sums, then calculated the left side as 48 and found its digit sum to be 3.)

The check digit of the multiplication is \(4+8=12,1+2=3\); the check digit of the addition is then \(3+0=3\). The check digits match though the result was wrong.

The correct answer, checked, would be

    Claim: 870 * 6 + 3 = 5223
    Check:  6  * 6 + 3 =? 3
                     3 =? 3

You have added 5 to the quotient, which adds 5*6 (or 3) to the digit sum; and you dropped the remainder of 3, which subtracted 3 from the digit sum, so you came out even.

The check digit of the multiplication is \(3+6=9\); the check digit of the addition is then \(9+3=12,1+2=3\).

How do they get 0?

We’ll close with one more explanation, for a fifth grader in 2009:

Casting out Nines: How Is 9 the Same As 0? Why Bother?

Dear Dr. Math,

I'm homeschooled, and in 5th grade, and am having trouble casting out nines.  I've read the directions, and all your other information, and it's too confusing.  My parents don't get it either. Also, what's the use?

One of my problems is 7326 + 5037 + 2765 + 9932 + 8416.  I don't get how 7 + 3 + 2 + 6 = 0, which is the answer that my Teacher's Edition gives.

I answered:

Hi, Samantha.

Casting out nines may not be quite as useful today when everyone uses calculators; but then, it can catch errors in entering the data into the calculator, so it might not be a bad idea to use it more than we do!

Casting out nines is a fascinating (and rather old) method for checking manual calculations.  If you look into why it works, you'll see that it ties into some important bits of number theory.

Since I may well have written some of what you wrote that was too complicated, let's try just using your example rather than trying to explain it fully in general terms.

We need to keep it simple, and I’ve learned that examples often do that. Sometimes, too, I find that the specific problem a student asks about has a unique issue I wouldn’t have noticed.

The basic idea is that we can make what is called a "digital root" by adding all the digits of a number, and then repeating the process until we have a single digit.  Let's do that with each of your numbers, and also with their sum:

    7326 -> 7 + 3 + 2 + 6 = 18 -> 1 + 8 = 9
    5037 -> 5 + 0 + 3 + 7 = 15 -> 1 + 5 = 6
    2765 -> 2 + 7 + 6 + 5 = 20 -> 2 + 0 = 2
    9932 -> 9 + 9 + 3 + 2 = 23 -> 2 + 3 = 5
 +  8416 -> 8 + 4 + 1 + 6 = 19 -> 1 + 9 = 10 -> 1 + 0 = 1
   33476 -> 3 + 3 + 4 + 7 + 6 = 23 -> 2 + 3 = 5

Do you notice something?

Before we continue ... I now see the specific question you are asking.  For the first addend, above, I wrote

   7 + 3 + 2 + 6 = 18 -> 1 + 8 = 9

Your book says it's 0, not 9. Why?

This is actually where the name "casting out nines" comes from.  If you work with this method enough, you find that anywhere you have a 9, you can just "cast it out" (throw it away) because it doesn't affect the digital root. For example, for the number 19, you get

    1 + 9 = 10 -> 1 + 0 = 1,

which is what you'd get if you ignored the 9 in the first place.

We just skip the 9, knowing it’s a waste of time.

But how can 0 and 9 really be the same answer, in our specific case?  That's because all this work is based on the remainder you would get if you divided a number by 9.  For example, if you divide 19 by 9, you get 2 with a remainder of 1, and 1 is the digital root!

So the digital root is the remainder when you divide by 9 ... except when you get a 9!  The remainder has to be less than the divisor.  So when you get 9, in order to really find the remainder, you have to divide by 9 again -- and now the remainder is 0.

So when we cast out nines, we treat 0 and 9 as the same thing; if we get a 9 we can "cast it out" and use 0 as the digital root.

Technically, we say that 9 is congruent to 0, modulo 9; that is, as far as we are concerned, they are the “same” number. And since we want the digital root to be less than 9, we just write 0 when we get 9. But, as we’ve seen above, we often don’t actually bother with that.

Back to our process.  The digital roots of the addends are now

    0 + 6 + 2 + 5 + 1 = 14

We take the digital root yet again, since this has two digits; and find that the digital root of the sum is 5.

If we had gotten a different digital root, we'd have known that we made a mistake.  But since this agrees with the 5 we got by using the sum itself, we've confirmed our addition.

Remember, again, that “confirm” here doesn’t mean prove; it just gives supporting evidence (that is, it doesn’t disprove the claim):

Now, having the same digital root doesn't prove the answer is right -- we could have added wrong but gotten the same result by coincidence -- but it does give us more confidence.

I hope that helps a bit.  And I hope your text explained this idea of ignoring 9's, and didn't just tell you to add digits, as I did at first.  That simplified explanation is actually good enough to use the method (it would have worked fine if we had used 9 rather than 0 for that first digital root).  But ignoring 9's makes the work a bit easier.

Next time, more on why it works.

1 thought on “Casting Out Nines: What and How”

  1. Pingback: Casting Out Nines: Why It Works – The Math Doctors

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.