Associated Topics || Dr. Math Home || Search Dr. Math

### Casting Out Nines

```
Date: 02/19/98 at 07:51:38
From: James Monaco
Subject: Casting out nines

I am trying to find a reference which defines this mathematical
operation.  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
```

```
Date: 02/19/98 at 11:56:09
From: Doctor Rob
Subject: Re: Casting out nines

Casting out nines is the name of 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.

Example:

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.

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)).

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.

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.

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.

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).

-Doctor Rob,  The Math Forum
Check out our web site http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search