Casting out nines is any of three arithmetical procedures:[1] To "cast out nines" from a single number, its decimal digits can be simply added together to obtain its so-called digit sum.
Since 21 = 2946 − 325 × 9, the effect of taking the digit sum of 2946 is to "cast out" 325 lots of 9 from it.
), replacing the original number by its digit sum has the effect of casting out lots of 9.
If the procedure described in the preceding paragraph is repeatedly applied to the result of each previous application, the eventual result will be a single-digit number from which all 9s, with the possible exception of one, have been "cast out".
The resulting single-digit number is called the digital root of the original.
The digital root of 12565 is therefore 1, and its computation has the effect of casting out (12565 - 1)/9 = 1396 lots of 9 from 12565.
If no mistake has been made in the calculations, these two digital roots must be the same.
Examples in which casting-out-nines has been used to check addition, subtraction, multiplication, and division are given below.
In each addend, cross out all 9s and pairs of digits that total 9, then add together what remains.
The method works because the original numbers are 'decimal' (base 10), the modulus is chosen to differ by 1, and casting out is equivalent to taking a digit sum.
In general any two 'large' integers, x and y, expressed in any smaller modulus as x' and y' (for example, modulo 7) will always have the same sum, difference or product as their originals.
This property is also preserved for the 'digit sum' where the base and the modulus differ by 1.
However, it is possible that two previously unequal integers will be identical modulo 9 (on average, a ninth of the time).
Since the first two factors are multiplied by 9, their sums will end up being 9 or 0, leaving us with 'ab'.
While extremely useful, casting out nines does not catch all errors made while doing calculations.
For example, the casting-out-nines method would not recognize the error in a calculation of 5 × 7 which produced any of the erroneous results 8, 17, 26, etc.
In particular, casting out nines does not catch transposition errors, such as 1324 instead of 1234.
A form of casting out nines known to ancient Greek mathematicians was described by the Roman bishop Hippolytus (170–235) in The Refutation of all Heresies, and more briefly by the Syrian Neoplatonist philosopher Iamblichus (c.245–c.325) in his commentary on the Introduction to Arithmetic of Nicomachus of Gerasa.
[2] Both Hippolytus's and Iamblichus's descriptions, though, were limited to an explanation of how repeated digital sums of Greek numerals were used to compute a unique "root"[3] between 1 and 9.
Neither of them displayed any awareness of how the procedure could be used to check the results of arithmetical computations.
The earliest known surviving work which describes how casting out nines can be used to check the results of arithmetical computations is the Mahâsiddhânta, written around 950 by the Indian mathematician and astronomer Aryabhata II (c.920–c.1000).
[4] Writing about 1020, the Persian polymath, Ibn Sina (Avicenna) (c.980–1037), also gave full details of what he called the "Hindu method" of checking arithmetical calculations by casting out nines.
[6] This method can be generalized to determine the remainders of division by certain prime numbers.
The same result can also be calculated directly by alternately adding and subtracting the digits that make up