One small step for error detection

Author: Michael Mernagh

Casting out the nines

 

Before the dawn of adding machines ushered in the modern era of computers, statisticians (and accountants) needed to be able to add up figures with both speed and accuracy (though they usually added them down from the top of the page!). They could correctly tot entire pages of figures mentally. Their trick was to use a safety check called “casting out the nines”. As you can see below, it has a long history, but it is a trick that is still useful today, even if you are using a calculator: in a long string of additions it is easy enough to mis-key a number, and this technique will tell you at the end if you have done so.

A potted history of the technique1

It was also known as “the nines remainder method” or “the digit-sum method”.

• The Latin phrase for “casting out nines” was “abjectio novenaria”. Hippolytos referred to it as early as the third century (even though he worked with Roman numerals).

• In India, Aryabhata II used it in the tenth century and Narayana in the 14th century.

Fibonacci described the method in his “Book of the Abacus” of 1202. He called the excess of nines the “portion” of the number.

• The phrase "If you wish to check the sum by casting out nines..." appeared in 1478 in the “Treviso Arithmetic”.

Pacioli referred to it in 1494 in his book on "Current Trading and Lending".

• In 1607, Clavius used the term "Proof of the additions by 9", in his “Epitome of Practical Arithmetic”.

Leibniz praised and recommended the method in the 17th century.

• An article on the topic appeared in the first edition of “Encyclopaedia Britannica” (1768-1771) under the heading of “Arithmetick”.

How does it work?

A “digit-sum” is the sum of the digits that compose any number in the denary system. For example, the digit sum of 61 is 6+1 = 7. In other words, you find the digit-sum of a number by “adding across” the number. The digit-sum of the number 5,012 is (5 + 0 + 1 + 2) = 8.

You always reduce it to a single figure if it is not already a single figure. For instance, the digit-sum of 345 = 12 or (1+2) = 3.

And, the key to the method: The digit-sum is always the same as the remainder obtained when you divide the actual number by 9. So 61 ÷ 9 = 6 remainder 7; the digit-sum of 61 is also 7.
And 345 ÷ 9 = 38 remainder 3; the digit-sum of 343 is 3.

In “adding across” a number, you can drop out 9’s. If you notice that any group (or sub-group) of digits add up to 9 then you can also ignore those digits.
Therefore, the digit-sum of 9,099,991 is 1, at a glance.
So also, the digit sum of 54,362 is (5+4) + (3+6) + 2 = 2.
If you are alert, you can spot that the digit sum of 21,475 is (2+7) + (5+4) + 1 = 1.
Don’t bother to add 9s. (Even if you did, you would end up with the same digit-sum, after you reduced it to a single figure.)

Decimals work in the same way. Pay no attention to the decimal point. The digit sum of 5.111 is 8.

Application to addition

To use it as a check in adding up numbers, the digit-sum of the answer should be the same as the added-up digit-sums. Thus:

The figures in the “Check” column are the digit-sums. If the answer that you wish to check is correct, then the digit sum of the sum of the digit-sums will equal the digit-sum of the overall sum.

Applications to other arithmetical operations

Basic Rule: Whatever you do to the numbers, you also do the same to their digit-sums.

Multiplication

Example # 4

For instance: 92 x 12 = 1104 – whose digit-sum is 6 
       digit-sums: 2 x 3 = 6 - so our multiplication checks.

Example # 5

Check this double multiplication: 322 x 28.1 x 12.4 = 112,197.68

Ignore the decimal points in checking.

So the answer was correct.

Division

Division works in the same way, but only for calculations where the numerator, the denominator and the answer are all either round numbers or fractions that can be written as finite sequences of decimal places.

Example # 6

. 132 / 11 = 12
. digit-sums: 6 / 2 = 3

Example # 7

. 186.1 / 37.22 = 5
. digit-sums: 7 / 5 = 1.4 and (1+4) = 5

Example # 8

. 40.086264 / 3.26 = 12.2964
. digit-sums: 3 / 2 = 1.5 and (1+5) = 6

Division can be also checked by multiplying the answer by the denominator. The digit-sum of that product will equal the digit sum of the numerator.

Subtraction

The method also works for subtraction by applying the basic rule. If, however, the subtraction of the check-digits results in a negative check digit, simply add 9 to that negative digit.
Of course, you can always check subtraction by “reverse addition”.

Parting thoughts

Half a lifetime in statistics has shown me that invariably if it looks wrong, then it is wrong.

Statistical analysis usually produces numerical answers. If we get the basics right, we can be more sure of getting the right answers. Conversely, if the answers look reasonable, we can be more confident that the basic methodology is sound.

The odds are 1:9 that two random integers will differ by a multiple of nine.2 Therefore, “casting out the nines” has a theoretical reliability rate of just under 89%.

References & Bibliography

  • References
  • 1. http://en.wikipedia.org/wiki?title=Talk:Casting_out_nines
  • 2. The Art of Computer Programming (Vol. 2) by Donald Knuth
  • Bibliography
  • The Trachtenberg Speed System of Basic Mathematics, translated and adapted by A. Cutler and R. McShane (Souvenir Press, 1962)
  • Essentials of Business Arithmetic, by H.F. Hemstock (Harrap, 1946)
  • Commercial Arithmetic, by F.L. Grant and A.M. Hill (Longmans, 1958)

Bookmark and Share

Comment on this article

Submit your comment
  1. Image of unique ID

Comments

Michael Mernagh

The video about 11.11.11 at http://www.youtube.com/watch?feature=player_embedded&v=sPFWfAxIiwg# describes the use of “eleven” as an error correction code for ISBN book numbers. See http://numberphile.com/

reply to this comment

Skip to Main Site Navigation / Login

Site Search Form

Site Search