Why $9$ & $11$ are special in divisibility tests using decimal digit sums? (casting out nines & elevens)

I don't know if this is a well-known fact, but I have observed that every number, no matter how large, that is equally divided by $9$, will equal $9$ if you add all the numbers it is made from until there is $1$ digit.

A quick example of what I mean:

$9*99 = 891$

$8+9+1 = 18$

$1+8 = 9$

This works even with really long numbers like $4376331$

Why is that? This doesn't work with any other number. Similarly for $11$ and alternating digits sums.


Solution 1:

Not quite right, since $9\times 0 = 0$ and the digits don't add up to $9$; but otherwise correct.

The reason it works is that we write numbers in base $10$, and when you divide $10$ by $9$, the remainder is $1$. Take a number, say, $184631$ (I just made it up). Remember what that really means: $$184631 = 1 + 3\times 10 + 6\times 10^2 + 4\times 10^3 + 8\times 10^4 + 1\times 10^5.$$ The remainder when you divide any power of $10$ by $9$ is again just $1$, so adding the digits gives you a number that has the same remainder when dividing by $9$ as the original number does. Keep doing it until you get down to a single digit and you get the remainder of the original number when you divide by $9$, except that you get $9$ instead of $0$ if the number is a nonzero multiple of $9$.

But since every multiple of $9$ is a multiple of $9$, you will always get $9$.

Note that you have a similar phenomenon with $3$ (a divisor of $9$), since adding the digits of a multiple of $3$ will always result in one of the one-digit multiples of $3$: $3$, $6$, or $9$.

If we wrote in base $8$, instead of base $10$, then $7$ would have the property: if you write a number in base $8$ and add the digits (in base 8) until you get down to a single digit between $1$ and $7$, then the multiples of $7$ will always end yielding $7$, for precisely the same reason. And if we wrote in base $16$, then $15$ (or rather, F) would have the property. In general, if you write in base $b$, then $b-1$ has the property.

This is a special case of casting out nines, which in turn is a special case of modular arithmetic. It is what is behind many divisibility tests (e.g., for $2$, $3$, $5$, $9$, and $11$).

Coda. This reminds me of an anecdote a professor of mine used to relate: a student once came to him telling him he had discovered a very easy way to test divisibility of any number $N$ by any number $b$: write $N$ in base $b$, and see if the last digit is $0$. I guess, equivalently, you could write $N$ in base $b+1$, and add the digits to see if you get $b$ at the end.

Solution 2:

It is a special case of casting out nines, which is obvious when viewed via modular arithmetic:

$\rm\quad mod\,\ 9\!:\, \ \color{#c00}{10\equiv 1}\ \Rightarrow\ P(\color{#c00}{10})\equiv P(\color{#c00}1)\ \, $ for all polynomials $\rm\,P(x)\,$ with integer coefficients

by the Polynomial Congruence Rule.

But radix notation has polynomial form, e.g. $\rm\ N = 567 = P(10)\,$ for $\rm\, P(x) = 5\, x^2 + 6\,x + 7.\, $ Thus the above implies $ $ mod $\,9\!:\ \rm N = P(10)\equiv P(1) = $ the sum $\rm\,S_N$ of the decimal digits of $\rm\,N,\,$ thus $\rm \bmod 9\!:\,\ 567 \equiv 5\!+\!6\!+\!7\equiv 18\equiv 1\!+\!8\equiv 9,\,$ so $\,9\mid 567,\,$ i.e. $\,9\,$ divides $\,567$.

OP is special case $\rm\ N\equiv 0\pmod{\! 9}\ $ so by above it remains $\equiv 0\ $ if we map $\rm N$ to its digit sum $\rm\,S_N.\,$ This map is strictly decreasing for $\rm\:N > 9,\, $ so iterating it eventually reaches some $\rm\: N' \le 9.\ $ But $\rm\ N'\equiv 0\pmod{\!9}\, $ so $\rm\: N' = 9\,$ $\rm (N'\!\neq0\,$ by $\rm\,N>0\,$ has a nonzero digit so $\rm\,S_N>0)$.

If modular arithmetic is unfamiliar we could instead use divisibility rules or proceed as follows:

Factor Theorem $\rm\,\Rightarrow\, X\!-\!1\mid P(X)\!-\!P(1)\ $ so $\rm\ X = 10\ \Rightarrow\ 9\mid P(10)\!-\!P(1)\ $ i.e. $\rm\; 9\mid N\! -\! S_N$

The analogous result holds true for any radix $\rm\:b,\,$ i.e. we can cast $\rm\:b\!-\!1$'s in the same way, since

$\rm\quad \bmod\, \color{}{b\!-\!1\!}:\,\ \color{#c00}{b\equiv 1}\,\Rightarrow\, N=P(\color{#c00}b) \equiv P(\color{#c00}1)= \text{sum of radix $\rm\,b\,$ digits of }\, N$

Hence $\,\rm \bbox[5px,border:1px solid #c00]{\text{the divisor $\,9\,$ is 'special' in radix $\,10\,$ because }\, \color{#c00}{10\,\equiv\, 1}\,\pmod{\! 9}}$

Similarly we cast $11$'s by $\!\rm\bmod 11\!:\ \color{#c00}{10\equiv -1}\,\Rightarrow\, P(\color{#c00}{10})\equiv P(\color{#c00}{-1})\equiv p_0 -p_1 + p_2 -p_3 +\cdots $

Hence $\,\rm \bbox[5px,border:1px solid #c00]{\text{the divisor $11$ is 'special' in radix $\,10\,$ because } \color{#c00}{10\equiv -1}\pmod{\!\! 11}}$

Similarly we may cast $\,1001 = 7\cdot 11\cdot 13\,$ by taking the alternating digit sum in radix $\,10^3,\,$ yielding a combined divisibility test for $\,7,11,13\,$. We get countless divisibility tests via such modular reduction, e.g. see here for casting out $\,91$'s.

It deserves to be better known that we may also cast out nines to check rational arithmetic - as long as the fractions have denominator coprime to $3$, e.g. see Hilton; Pedersen, $1981,\,$ Casting out nines revisited (these results are very old). Analogous remarks hold true for any ring that has $\ \mathbb Z/9\ $ as an image - just as one can apply parity arguments in any ring that has $\ \mathbb Z/2\ $ as an image, e.g. the ring of all rationals with odd denominator, or the ring of Gaussian integers $\,\mathbb Z[i],\,$ where the image $\, \mathbb Z[i]/(2,i\!-\!1) \cong \mathbb Z/2\ $ yields the natural parity definition: $\, a+b\:i\ $ is even $\iff a\equiv b\pmod{\! 2},\,$ i.e. if $\, a+b\:i\ $ maps to $\:0\:$ via the above isomorphism, which maps $\, 2\to 0,\ i\to 1\:$. See here for further discussion of parity in rings of algebraic integers, including examples of number rings with no parity structure, and with more than one parity structure. See also this post for "casting out orders" in cyclic groups, and see this thread for an in-depth comparison of various elementary inductive proofs of casting nines.

These are elementary prototypical examples of problem-solving by way of modular reduction - one of the keystones of abstract algebra. As such one should be sure to understand these simple instances before moving on to more advanced manifestations of modular reduction.

Beware $ $ Such casting-out rules are often advocated for use in checking arithmetic. But keep in mind that such checks won't reveal all arithmetical errors, i.e. there can be many "false positives", since the check only verifies that expressions agree modulo some small number, e.g. integers agreeing mod $10$ means only that they have the same final digits. To remedy this we can perform checks modulo sufficiently many coprime moduli (see CRT = Chinese Remainder Theorem). This is one example of various "lifting" techniques employed in modular computation methods - which you can read about in most textbooks on computer algebra, e.g. Knuth, TAOCP, vol. 2, Seminumerical Algorithms, or von zur Gathen: Modern Computer Algebra.

Solution 3:

Many ways to say this I suppose - what made sense to me when I first was confronted with this fact is that the number "$abcd$" is $1000a+100b+10c+d=(999a+99b+9c)+a+b+c+d$. The first term is clearly divisible by $9$ so if the digit sum is then "$abcd$" is as well...

Solution 4:

This follows from the divisibility test for $9$ and from the fact that the sum of the digits of a natural number with more than one digit is strictly less than the number itself i.e. if $n$ is a natural number with more than one digit and if $s(n)$ denotes the sum of the digits of the natural number then $s(n)<n$. Your observation can be strengthened to note that if we keep repeatedly adding the digits, the final number we are left with is the remainder when divided by $9$.

Solution 5:

This property is based on the fact that $9$ is one minus $10$ which is the base of the number system you are working with because of this any power of $10$ will equal $1$ modulo $9$.