Divisibility rules/Rule for 3 and 9 proof

A number $N$ is divisible by 3 or 9 if the sum of its digits is divisible by 3 or 9, respectively. Note that this does not work for higher powers of 3. For instance, the sum of the digits of 1899 is divisible by 27, but 1899 is not itself divisible by 27.

Proof

An understanding of basic modular arithmetic is necessary for this proof.

Arithmetic mod $9$ can be used to give an easy proof of this criterion:

Suppose that the base-ten representation of $N$ is

$N = a_k a_{k-1} \cdots a_2 a_1 a_0$,

where $a_i$ is a digit for each $i$. Then the numerical value of $N$ is given by

$N = a_k \cdot 10^k + a_{k-1} \cdot 10^{k-1} + \cdots + a_1 \cdot 10^1 + a_0 \cdot 10^0$.

Now we know that, since $10 - 1 = 9$, we have $10 \equiv 1$ (mod $9$) and so we have $10^{j}\equiv 1^{j}\equiv 1 \pmod{9}$ for every $j$.

Therefore, we can write

$a_k \cdot 10^k + a_{k-1} \cdot 10^{k-1} + \cdots + a_1 \cdot 10^1 + a_0 \cdot 10^0 \equiv a_k \cdot 1 + a_{k-1} \cdot 1 + \cdots + a_1 \cdot 1 + a_0 \cdot 1 \pmod{9}$.

Therefore, we have

$N \equiv a_k + a_{k-1} + \cdots + a_1 + a_0 \pmod{9}$.

That is, $N$ differs from the sum of its digits by a multiple of $9$. It follows, then, that $N$ is a multiple of $9$ if and only if the sum of its digits is a multiple of $9$.

Since we also have $10 \equiv 1 \pmod{3}$, the same proof also gives the divisibility rule for 3. The proof fails for 27 because $10 \not\equiv 1 \pmod{27}$.

See also