Casting out nines is any of three arithmetical procedures:
See main article: Digit sum.
To "cast out nines" from a single number, its decimal digits can be simply added together to obtain its so-called digit sum. The digit sum of 2946, for example is 2 + 9 + 4 + 6 = 21. Since 21 = 2946 − 325 × 9, the effect of taking the digit sum of 2946 is to "cast out" 325 lots of 9 from it. If the digit 9 is ignored when summing the digits, the effect is to "cast out" one more 9 to give the result 12.
More generally, when casting out nines by summing digits, any set of digits which add up to 9, or a multiple of 9, can be ignored. In the number 3264, for example, the digits 3 and 6 sum to 9. Ignoring these two digits, therefore, and summing the other two, we get 2 + 4 = 6. Since 6 = 3264 − 362 × 9, this computation has resulted in casting out 362 lots of 9 from 3264.
For an arbitrary number,
10ndn+10n-1dn-1+ … +d0
dndn-1...d0
dn+dn-1+ … +d0
\begin{align} &10ndn+10n-1dn-1+ … +d0-\left(dn+dn-1+ … +d0\right)\\ ={}&
n-1\right)d | |
\left(10 | |
n |
+\left(10n-1-1\right)dn-1+ … +9d1. \end{align}
Because numbers of the form
10i-1
10i-1=9 x \left(10i-1+10i-2+ … +1\right)
10n-1 | |
9 |
dn+
10n-1 | |
9 |
dn-1+ … +d1
lots of 9.
See main article: Digital root. 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 exception occurs when the original number has a digital root of 9, whose digit sum is itself, and therefore will not be cast out by taking further digit sums.
The number 12565, for instance, has digit sum 1+2+5+6+5 = 19, which, in turn, has digit sum 1+9=10, which, in its turn has digit sum 1+0=1, a single-digit number. 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.
To check the result of an arithmetical calculation by casting out nines, each number in the calculation is replaced by its digital root and the same calculations applied to these digital roots. The digital root of the result of this calculation is then compared with that of the result of the original calculation. 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. These new values are called excesses. Add up leftover digits for each addend until one digit is reached. Now process the sum and also the excesses to get a final excess.
\bcancel{3} 2 \bcancel{6} 4 | ⇒ | \bcancel{6} | 2 and 4 add up to 6. | |
\bcancel{8}\bcancel{4}\bcancel{1}\bcancel{5} | ⇒ | 0 | 8+1=9 and 4+5=9; there are no digits left. | |
2 \bcancel{9} 4 6 | ⇒ | \bcancel{3} | 2, 4, and 6 make 12; 1 and 2 make 3. | |
\underline{+\bcancel{3} 2 0 \bcancel{6}} | ⇒ | 2 | 2 and 0 are 2. | |
\bcancel{1} 7 \bcancel{8} 3 1 | \Downarrow | 6, 0, 3 and 2 make 11; 1 and 1 add up to 2. | ||
\Downarrow | ||||
{2} | \Leftrightarrow | 2 | The excess from the sum should equal the final excess from the addends. |
\bcancel{5}\bcancel{6}\bcancel{4}\bcancel{3} | ⇒ | 0(9) | First, cross out all 9s and digits that total 9 in both minuend and subtrahend (italicized). | |
\underline{- 2 \bcancel{8}\bcancel{9}\bcancel{1}} | ⇒ | -2 | Add up leftover digits for each value until one digit is reached. | |
\bcancel{2} 7 \bcancel{5}\bcancel{2} | \Downarrow | Now follow the same procedure with the difference, coming to a single digit. | ||
\Downarrow | Because subtracting 2 from zero gives a negative number, borrow a 9 from the minuend. | |||
{7} | \Leftrightarrow | 7 | The difference between the minuend and the subtrahend excesses should equal the difference excess. |
\bcancel{5}\bcancel{4} 8 | ⇒ | 8 | First, cross out all 9s and digits that total 9 in each factor (italicized). | |
\underline{ x 6 2 \bcancel{9}} | ⇒ | 8 | Add up leftover digits for each multiplicand until one digit is reached. | |
{\bcancel{3} 4 4 \bcancel{6}\bcancel{9} 2 } | \Downarrow | Multiply the two excesses, and then add until one digit is reached. | ||
\Downarrow | Do the same with the product, crossing out 9s and getting one digit. | |||
{1} | \Leftrightarrow | 1 | The excess from the product should equal the final excess from the factors. |
\bcancel{27}\bcancel{54}62 | ÷ | 877 | = | 314 | r. | 84 | Cross out all 9s and digits that total 9 in the divisor, quotient, and remainder. | |
\Downarrow | \Downarrow | \Downarrow | \Downarrow | Add up all uncrossed digits from each value until one digit is reached for each value. | ||||
8 | \Leftrightarrow | (4 | x | 8) | + | 3 | The dividend excess should equal the final excess from the other values. In other words, perform the same procedure as in a multiplication, only backwards. 8x4=32 which is 5, 5+3 = 8. And 8=8. |
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.
If a calculation was correct before casting out, casting out on both sides will preserve correctness. However, it is possible that two previously unequal integers will be identical modulo 9 (on average, a ninth of the time).
The operation does not work on fractions, since a given fractional number does not have a unique representation.
A trick to learn to add with nines is to add ten to the digit and to count back one. Since we are adding 1 to the tens digit and subtracting one from the units digit, the sum of the digits should remain the same. For example, 9 + 2 = 11 with 1 + 1 = 2. When adding 9 to itself, we would thus expect the sum of the digits to be 9 as follows: 9 + 9 = 18, (1 + 8 = 9) and 9 + 9 + 9 = 27, (2 + 7 = 9). Let us look at a simple multiplication: 5 × 7 = 35, (3 + 5 = 8). Now consider (7 + 9) × 5 = 16 × 5 = 80, (8 + 0 = 8) or 7 × (9 + 5) = 7 × 14 = 98, (9 + 8 = 17), (1 + 7 = 8).
Any non-negative integer can be written as 9×n + a, where 'a' is a single digit from 0 to 8, and 'n' is some non-negative integer.Thus, using the distributive rule, (9×n + a)×(9×m + b)= 9×9×n×m + 9(am + bn) + ab. Since the first two factors are multiplied by 9, their sums will end up being 9 or 0, leaving us with 'ab'. In our example, 'a' was 7 and 'b' was 5. We would expect that in any base system, the number before that base would behave just like the nine.
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. (that is, any result congruent to 8 modulo 9). In particular, casting out nines does not catch transposition errors, such as 1324 instead of 1234. In other words, the method only catches erroneous results whose digital root is one of the 8 digits that is different from that of the correct result.
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.[1] 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"[2] 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).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.
The procedure was described by Fibonacci in his Liber Abaci.[3]
This method can be generalized to determine the remainders of division by certain prime numbers.
Since 3·3 = 9,
n\bmod3=(n\bmod9)\bmod3.
Casting out ninety nines is done by adding groups of two digits instead just one digit.
Since 11·9 = 99,
n\bmod11=(n\bmod99)\bmod11.
n
n
Casting out nine hundred ninety nines is done by adding groups of three digits.
Since 37·27 = 999,
n\bmod37=(n\bmod999)\bmod37.