Casting out nines
This article's tone or style may not reflect the encyclopedic tone used on Wikipedia. (August 2015)
Casting out nines is a sanity test to ensure that hand computations of sums, differences, products, and quotients of integers are correct. By looking at the digital roots of the inputs and outputs, the casting-out-nines method can help one check arithmetic calculations. The method is so simple that most schoolchildren can apply it.
- 1 Checking arithmetic using remainders
- 2 Why use 9s?
- 3 Modular arithmetic
- 4 Further examples
- 5 How it works
- 6 A variation on the explanation
- 7 Limitation to casting out nines
- 8 Casting out 11s
- 9 History
- 10 Notes
- 11 References
- 12 External links
Checking arithmetic using remainders
Counting and addition
Suppose you are teaching two younger children. Child A collects a pile of sticks and has them on her table. Child B also collects a pile of sticks and has them on his table. Suppose you then have the children group the sticks on their own tables into bundles of 9 sticks, with some remaining.
Child A has several bundles of 9 sticks and 2 left over. Child B has several bundles of 9 sticks and 3 left over. Now have the children put all the sticks together on a table at the front of the class room. Group them in groups of 9. How many sticks will be outside of the bundle of 9 sticks now? It should be still 5.
Note that if one child had 5 extra and another child had 6 extra, i.e. 11 total, then the children could group 9 of those together and report 2 remaining.
Still if there is no error, the sum of the sticks left over initially and the group of sticks left over when you are done should agree allowing for adding or subtracting some multiple of 9 from the total.
You know if the children both claimed 1 extra outside their bundles of 9 each and now they claim 4 extra in the combined pile, something is wrong.
What these children have done is the concrete version of casting out 9s.
pile A has (9*x)+a where x is the number of bundles of 9 sticks for student A and a are the ones left outside bundles on student As table pile B has (9*y)+b where y is the number of bundles of 9 sticks for student B and b are the ones left outside bundles on student Bs table Total 9(x+y) +(a+b). Given in the example a=2 and b=3 The remaining sticks once you group the total into bundles of 9 should be a+b which in this example would be 5. Remember that if (a+b)>9 then the number remaining that you see may be (a+b)-(n*9) where n is some whole number.
Suppose a student is to add 12+11 Suppose they tell you the answer is 22. They can know this is incorrect if they cast out 9s. 12 = 9+3 11 = 9+2 Your answer should have 3+2=5 outside your bundle of 9s. 22 = 18 + 4 which is incorrect. The correct answer is 23 which is 18+5.
The desired range for a remainder is between 0 and 8. Otherwise the children may report several different numbers as answers in some problems. You may untie bundles or group loose sticks into bundles until the number of the remaining sticks is some number between and including zero through eight.
Students will forget to carry a 1 here and be off by a few points in an addition there. Usually they will not be off by 9 points.
This method may be used to check adding multiple numbers together. Suppose you ask the children to add
8 + 9 + 12 + 4. 8, 0, 3, 4 Remainders when bundled into groups of 9 you have 8+3+4=15 not in bundles. You can bundle 9 of 15 leaving 6 loose. The problem was initially 8+9+12+4=33 =(9*3)+6 So you now have 3 bundles of nine and 6 outside bundles. A child tells you the answer is 28=(9*3)+1 You know this is incorrect as some sticks outside of bundles would have to magically disappear.
Notice that we were able to discard that entire second pile of 9 from the remainder immediately. In the third pile of 12 we were able to immediately cast out 9 of those sticks. It leads to the common name for this technique of "casting out 9s".
You may expect 12 and end up showing 3 extra. The missing 9 were bundled. You may expect 23 and end up showing 5 extra. The missing 18 were bundled in 2 groups of 9.
The sticks outside the bundles in group A and those outside bundles group B should agree with the number outside bundles when all the sticks are piled together plus or minus some multiple of the number of sticks per bundle.
Could this method work for subtraction?
Child A has 5 bundles of 9 and 4 loose outside bundles. Child B takes 3 bundles of 9 and 2 loose outside bundles. You end up with 2 bundles of 9 and 2 loose outside bundles.
49=(5*9)+4 -29=(3*9)+2 ______________ 20=(2*9) +2
Now you will run into the following type of difficulty.
28 =(3*9) + 1 -14 =(1*9) + 5 _______________ 14=(2*9)-4?
The problem is in the loose sticks. You cannot have the children carry away 5 sticks from a pile with 1 stick in it. The idea to use is to open a bundle of 9 and add these 9 to the lone loose stick.
28 =(2*9) + 10 -14 =(1*9) + 5 ________________ 14 = (1*9) +5
Notice mathematically that the answer is still 14 ie (2x9)-4=18-4=14 vs (1*9)+5=14 If you come up with a negative number of loose items, you missed an earlier opportunity to borrow. This may be corrected later by opening any number of bundles and adding that many groups of 9 to the total of loose sticks. This should yielding 0-8 loose items.
Notice that to reverse the subtraction you add
14 =(1*9)+5 +14 =(1*9)+5 ______________ 28=(2*9)+10 =(3*9) + 1
So notice that this process has needed to use the idea of borrowing in the subtraction problem and carrying when the total number of loose sticks are more than 9.
Suppose you expect 4 items outside bundles after a subtraction and the child's answer is equivalent to some multiple of 9 plus 2 loose sticks outside of a bundle. You know there is an error.
A child has one bundle of 9 and 2 loose sticks. You ask them to put 3 times that many on the front table.
3*11= Perhaps your students don't know their tables to 11 yet. 3*[(1*9)+2]= If they restate the problem in terms of 1 bundle of 9 and 2 sticks they know 3 times as many will be 3*9+6= 3 bundles ie 3*9 is 27 and 3*2 loose sticks which is 6 loose sticks. 27+6=33
4*23= 4*[(2*9)+5]= 23 is two bundles of 9 sticks plus 5 more. 8*9+20= 18 of the 20 loose sticks may be gathered into 2 new bundles. with 2 loose sticks remaining. 10*9 +2=92
Suppose the student gave the wrong answer and stated 4*23=82 because they forgot to carry the 1 in 4*3=12. If they know the problem will end with 2 loose sticks remaining, they will know the answer of 1 loose stick must be wrong.
12*11 = [1 bundle + 3 loose sticks ] * [1 bundles and 2 loose sticks]= The correct answer is 132. 132 = 90+42=90+36+6=9*(10+4)+6 We expected 3*2=6 loose sticks and we had 6 after bundling 14 bundles of nine.
It will always be true that when you multiply two numbers you can multiply the loose sticks in both factors and get information about the number of loose sticks in the product. If the number of loose sticks in the answer /product is higher than 9 you may create more bundles using these. It will always be true that the number of loose sticks you expect by multiplying the two numbers together ie 3*2 in the problem above will equal the number of loose sticks in the product plus or minus some multiple of 9.
For Algebra students I will show why this is always true.
Again lets suppose A= 9x+a and B=9y+b. In other words both numbers are some multiple of 9 plus some remainder.
A*B= [9x*9y] + [9x*b]+ [a*9y] + [a*b] = 9*[9xy+bx+ay] +a*b
Multiply A times B and the loose sticks in the result will be equivalent (+- n*9) to the product of the loose sticks from A and the loose sticks from B.
Since we are working with 9 here the remainder may be off by a multiple of 9. If its off by any other number, the calculation was done improperly.
Suppose A= 9x+7 . Suppose B = 9y+8. A has some bundles and 7 loose sticks. B has some bundles but 9 loose sticks. A*B=9*z +56 where z is some number. From the algebra above we know that we will end up with 9 times some number z plus a*b=7*8 56 = 54+2=9(6)+2 If your multiplying A with a remainder of 7 times B with a remainder of 8, you should obtain a number that is 9n+2 where n is some number. Any other remainder once all possible 9s are subtracted than 2 would be incorrect.
If A/B=C then the product C*B=A should check.
Example If 60/15=4 then 4*15=60
Use Casting Out Nines to check the multiplication.
Why use 9s?
If any number could be used to check arithmetic using bundles of a given size and remainders then why does everyone pick 9? What is special about it?
Let N= a*1+b*10+c*100+d*1000 The number could be written as dcba. Any of these variables could be zero.
we have a*1 b*(1+9) c*(1+99) d*(1+999)
Think of any number that is made only of 9s. Adding 1 to this number will always result in a number that is a 1 followed by zeros.
Notice that N=a+b+c+d + 9(1b+11c+111d) This tells you that if you divide N by 9, the remainder will be equivalent to a+b+c+d. Instead of doing a division problem, you may simply add up the digits.
Example: what is the remainder of 1,234 / 9? If you do the division you will find its 137 with a remainder of 1.
Alternatively you could add up the digits. From right to left, the first 3 digits = 9. The remaining digit is 1 which is the remainder when 1234 is divided by 9. You may add up the digits starting at either end when casting out 9s. Sometimes though its convenient when you see numbers which sum to 9 to start there. Immediately in your mind bundle those 9. This leaves the 1 only among the loose sticks. You may also think of 9+1=10 whose digits sum to 1. A nine has no effect on the total when counting up the remainder.
Note in the number we picked for N i.e. N=a*1+b*10+c*100+d*1000 we could have continued on and added more digits and the same logic would hold.
Adding digits in numbers gives the remainder from a division by 9. Finding groups of 9s and putting them aside gives the same results. These methods may be combined.
Example Add 2+9+3+4+5+7 Answer 30. One student might realize this is (9)+(4+5)+(2+7) +3 simply by rearranging the numbers in the addition problem. They might also notice that 30 is 27 + 3= (3*9) + 3.The remainder of 3 seems to be correct so likely the addition has been done correctly.
Another student might say 2+9=11. The sum of the digits of 11=2. 2+3=5. 5+4=9. A 9 may be divided by 9 with zero remainder so the sum so far has a zero remainder. The final 2 numbers 5 and 7 when added yield 12. The digits of 12 sum to be 3. This means the remainder if the sum were added then the total divided by 9 should be 3.
Notice that 9s may be discarded or "cast out" when found as they do not contribute to the remainder.
Since there are several techniques that could be used to get the remainder after division by 9 ie performing the actual division by 9, casting out 9s, and adding the digits of numbers, this makes 9 an excellent choice for this type of procedure ie checking arithmetic using a remainder.
Because its so delightful sometimes to save division work simply by spotting a multiple of 9 that may be "cast out" this method using 9s is referred to as "Casting Out 9s".
Go back and review the elementary section of Casting Out Nines. See if your new information ie that you can discard nines as you find them, and add digits together allow you to check your work even faster.
If two numbers have the same remainder once all nines have been removed, these 2 numbers are said to be congruent modulo 9. This is written x ≡ y (mod 9). x=9z+y where z is a positive or negative whole number or zero. In words this means that x and y differ by a multiple of 9.
Congruence means that you can place one object over another and its properties agree. Triangles that you cut out with construction paper and where one fits exactly over the other are said to be congruent. They may be cut out of different colors or may be covered in different designs. This means that all properties don't have to match exactly.
In modular arithmetic, in this case in modulo 9, the essential bit is that the remainder after bundling up all the sticks into bundles of 9 is the same number.
x(mod 9)= means how many loose sticks are there remaining after x sticks are gathered into bundles of 9.
x(mod 9)≡ is asking what other numbers have the same remainder or number of loose sticks left over after bundling the sticks into bunches of 9.
60 (mod 9)= 6 This yields one unique answer ie 6.
60 (mod 9) ≡ 15
because both have 6 remaining after bundles of 9 are removed.
24 (mod 9 ) ≡ 33
Now we may stop staying 24 sticks gathered into bundles of 9 has the same number remaining as 33 when 33 is also gathered into bundles of 9.
Now check 12+14=26 12 (mod 9) = 3 Say "12 modulo 9 equals 3". Add the digits of 12 to get 3. 14 (mod 9)= 5 Say "14 modulo 9 equals 5". Add the digits of 14 to get 5. 26 (mod 9)=8 Add the digits of 26 to get 8. This is what we expect.
Check 72*14=1008 72 (mod 9) = 0 . The sum of digits is 9 and since you are making bundles of 9, make a bundle of these and leave zero remaining.
Note that a remainder of zero means this number should be exactly divisible by 9 and it is. 8x9=72 Caution here: Set numbers in (mod 9) = numbers (0-8). Allowing a mod 9 number to be equal to 9 would mean there would be two possible answers for this function A function MAY NOT have 2 possible answers.
14 (mod 9) = 5. Add the digits to get 5. Remember you can always check your math on the sum of digits method by dividing by 9 and looking at the remainder. 1008 (mod 9) = 0. The sum of digits =9. Bundle this and leave zero remaining.
Function is another math word you should know. A function is like a computer that you give instructions. Then you put a number into the computer and it will give you the only possible answer.
See Wikipedia Modular Arithmetic for a more extended discussion
The method involves converting each number into its "casting-out-nines" equivalent, and then redoing the arithmetic. The casting-out-nines answer should equal the casting-out-nines version of the original answer. Below are examples for using casting-out-nines to check addition, subtraction, multiplication, and division.
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.
|2 and 4 add up to 6.|
|8+1=9 and 4+5=9; there are no digits left.|
|2, 4, and 6 make 12; 1 and 2 make 3.|
|2 and 0 are 2.|
|7, 3, and 1 make 11; 1 and 1 add up to 2.|
|The excess from the sum should equal the final excess from the addends.|
|First, cross out all 9s and digits that total 9 in both minuend and subtrahend (italicized).|
|Add up leftover digits for each value until one digit is reached.|
|Now follow the same procedure with the difference, coming to a single digit.|
|Because subtracting 2 from zero gives a negative number, borrow a 9 from the minuend.|
|The difference between the minuend and the subtrahend excesses should equal the difference excess.|
|First, cross out all 9s and digits that total 9 in each factor (italicized).|
|Add up leftover digits for each multiplicand until one digit is reached.|
|Multiply the two excesses, and then add until one digit is reached.|
|Do the same with the product, crossing out 9s and getting one digit.|
|*||The excess from the product should equal the final excess from the factors.|
*8 times 8 is 64; 6 and 4 are 10; 1 and 0 are 1.
|Cross out all 9s and digits that total 9 in the divisor, quotient, and remainder.|
|Add up all uncrossed digits from each value until one digit is reached for each value.|
|The dividend excess should equal the final excess from the other values.
In other words, you are performing the same procedure as in a multiplication, only backwards. 8x4=32 which is 5, 5+3 = 8. And 8=8.
How it works
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).
One should note that the operation does not work on fractions, since a given fractional number does not have a unique representation.
A variation on the explanation
A nice trick for very young children to learn to add nine is to add ten to the digit and to count back one. Since we are adding 1 to the ten's digit and subtracting one from the unit's 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 positive integer can be written as 9×n + a, where 'a' is a single digit from 0 to 8, and 'n' is any positive 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.
Limitation to casting out nines
While extremely useful, casting out nines does not catch all errors made while doing calculations. For example, the casting-out-nines method would not recognise the error in a calculation of 5×7 which produced any of the erroneous results 8, 17, 26, etc. in other words, the method only catches erroneous results whose digital root is one of the eight digits that is different from that of the correct result.
Casting out 11s
There is a related technique called "casting out elevens."
Look at numbers from the sequence
1, 10, 100, 1000, 10000, 100000, 100000, etc.
Each number is 10 times larger than the preceding number in the sequence. When writing a whole number the digits are multiples of these numbers.
Look at every other term:
1, 100, 10000, 1000000...etc.
1, 99+1, 9999+1, 999999+1...etc.
(99*0)+1, (99*1)+1, (99*101)+1, (99*10101)+1...
Call the terms in this part of the sequence U. Each of these terms is of the form U= (99* some number)+1. Since 99 is divisible by 11, U=(11* some number)+1 for each number U in this part of the sequence.
Now look at the remaining terms in the original sequence:
10, 1000, 100000, 10000000 ...
10, 990+10, 99990+10, 9999990+10 ....
99*0*10+10, 99*1*10+10 99*101*10+10, 99*10101*10+10...
Call all the terms in this part of the sequence T. We could continue to add terms and it would still follow the pattern of T=99*some number*10 +10, where some number could be zero, and differs for each term.
T=(99*some number +11)-1
T= (11*some number) -1 for each number T in this part of the sequence.
The result is that the sequence of numbers
will be of form
U, T, U, T, U, T, U, T, ...
i.e., there will be a form for the number in the units place U, and a form for a number in the tens place T. This pattern will repeat to as many terms as you like. The first few terms have been written out. Notice the form U=11x+1, T=11x-1 with this repeating as you go down the column. The value of x changes in each term as needed.
1 = 11* 0 + 1 10 = 11* 1 - 1 100 = 11* 9 + 1 1000 = 11* 91 - 1 10000 = 11* 909 + 1 100000 = 11* 9091 - 1 1000000 = 11* 90909 + 1 10000000 = 11*909091 - 1 ... ...
Write the number using the U and T forms. Since x may be different for each term, use a,b,c,d,e,and f for the value of x needed for each term.
265437= 7*(11a+1)+3*(11b-1)+4*(11c+1)+5*(11d-1) +6*(11e+1) +2*(11f-1)
265437=[11*(7a)+7]+[11*(3b)-3]+[11*(4c)+4]+[11*(5d)-5]+[11*(6e)+6]+[11*(2f)-2] =[11*some number]+[7-3+4-5+6-2]
In other words the remainder of a number divided by 11 is the sum of the digits starting from the units digit with the signs alternating ...plus or minus some multiple of 11. 265437=[11*some number]+7 This process may be used similar to Casting Out 9s to check arithmetic problems. Any zero in a number must be used in summing the digits with alternating signs. Otherwise the signs of the numbers that follow will be incorrect. It is important to start in the units position, i.e., to use the digits in a number from right to left when performing this calculation. Starting at the higher end of the number will result in the units position having the wrong sign if the number has an even number of digits. Instead of (-)(+)(-)(+)(-)(+) with the far right digit used as positive which is the correct form, we would have ended up with (+)(-)(+)(-)(+)(-) where the far right is ...improperly...written as negative. Wrong! Always begin from the far right side in assigning a sign to digits to cast out 11.
5218 = 8 - 1 + 2 - 5 = 4 (mod 11) 5218=5+2+1+8=16=1+6=7 (mod 9) 1306 = 6 - 0 + 3 - 1 =8 (mod 11) 1306=1+3+0+6=10=1+0=1 (mod 9) 6524 = 4 - 2 + 5- 6 = 1 (mod 11) 6524= 4+2+5+6=17=1+7=8 (mod 9)
4+8=12=11+1=1 (mod 11)
That the sum of the numbers in modulus 11 and in modulus 9 add up to the respective modulus for the total gives evidence that 6524 is in fact the sum of 5218 and 1306. Note that in calculating 5218 in (mod 9) you could have noticed that on the far right are a 1 and 8 totalling 9 and discarded those. Then at a glance you may tell from the remaining 5 and 2 that the number is 7 (mod 9). By the same token in the 1306, you could have discarded the 6 and 3 as they total 9 and told at a glance that 1306 is 1 (mod 9). Your trying to add a 7 (mod 9 ) number to 1 (mod 9) number. Look at 6524 and discard the 5 and 4. The remaining 6 and 2 give evidence that the sum is correct. Do not cast out digits this way when converting to (mod 11) unless you are sure the digits you are discarding have the same sign. +9 and +2 may be discarded if desired. +9 and -2 may not, as they do not total a multiple of 11. Note that the multiple may be a positive number times 11, a negative number times 11, or zero. The (mod 11) number is usually given as a number between 0 and 10 adding or subtracting multiples of 11 as needed to get to this range. The (mod 9) number is handled similarly with the desired number between 0 and 8. In (mod 9) add or subtract multiples of 9 to get in the desired range. Casting Out 9s seems the simpler method as there are no subtractions and it does not matter in casting Out 9s if the calculation is begun at the right or left end of the number. Casting Out 9s will not detect the difference between 12 and 21 as the sum of the digits are the same. 12 = 1+2 = 3 (mod 9) 12 = 2-1 = 1 (mod 11) 21 = 2+1 = 3 (mod 9) 21= 1-2 = -1 = -1 + 11 = 10 (mod 11)
A form of casting out nines known to ancient Greek mathematicians was described by the Roman bishop Hippolytus in The Refutation of all Heresies, and more briefly by the Syrian Neoplatonist philosopher Iamblichus in his commentary on Nicomachus's Introduction to Arithmetic. Ibn Sina (Avicenna) (980–1037) was a Persian physician, astronomer, physicist and mathematician who contributed to the development of this mathematical technique. It was employed by twelfth-century Hindu mathematicians. In Synergetics, R. Buckminster Fuller claims to have used casting-out-nines "before World War I." Fuller explains how to cast out nines and makes other claims about the resulting 'indigs,' but he fails to note that casting out nines can result in false positives.
The method bears striking resemblance to standard signal processing and computational error detection and error correction methods, typically using similar modular arithmetic in checksums and simpler check digits.
- Cajori, Florian (1991), A History of Mathematics (AMS Chelsea Publishing) (5th ed.), New York, NY: AMS, ISBN 0-8218-2102-4<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
- Lua error in Module:Citation/CS1/Identifiers at line 47: attempt to index field 'wikibase' (a nil value).
- Fuller, R. Buckminster (April 1982), Synergetics: Explorations in the Geometry of Thinking (New ed.), New York, NY: Macmillan Publishing Company, ISBN 0-02-065320-4<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
- Leibniz, Gottfried Wilhelm (2008-01-24), Dascal, Marcelo, ed., Gottfried Wilhelm Leibniz: The Art of Controversies, The New Synthese Historical Library (Paperback ed.), New York, NY: Springer, ISBN 978-1-4020-8190-3<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
- Masood, Ehsan (2006-01-15), Science and Islam: A History, Duxford, United Kingdom: Icon Books Ltd., ISBN 1-84831-081-1<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>