Casting out nines
|
Casting out nines is a sanity check of the validity of hand computations of sums, differences, and products of integers. By looking at the digital roots of the inputs and outputs, a user will catch the majority of accidental errors. Its ease-of-use makes it amenable to schoolchildren, even though they do not know its mathematical bases.
If x and x' (respectively, y and y') have the same remainder modulo 9, then so do x + y and x' + y', x - y and x' - y' and x × y and x' × y'.
The trick is that there exists a simple way to compute the remainder of a number by 9, based on the following check: the sum of the digits of the decimal writing of an integer has the same remainder modulo 9 as this integer. One therefore can sum all digits in the original number to obtain another number, and so on repeatedly until one gets a 1-digit number, which is necessarily equal to the original number.
The method takes its name from the fact that nines may be ignored when doing these summations, since they are equal to 0 modulo 9.
This description sounds more complicated than the method really is. Let us for instance consider 19786901 × 8098678443. The correct result is 160247748582475143, but we are likely to make a mistake if we compute it by hand unless we show great attention. Let us now apply the above summing process:
19786901 ⇒ 41 ⇒ 5
8098678443 ⇒ 57 ⇒ 12 ⇒ 3
160247748582475143 ⇒ 78 ⇒ 15 ⇒ 6
5 × 3 = 15 ⇒ 6 indeed.
If the results had differed, we would have had to conclude that we had made a mistake. However, since some errors (for example, a shortfall of some multiple of nine when adding) will not be reflected in the digital roots, a correct result after casting out nines does not guarantee that our result is correct — the technique catches most, but not all, random errors.