2.9.4

First, let $$a$$ be a non-negative integer with decimal digits $$a = d_{p-1}d_{p-2}\dots{}d_1{}d_0$$, then $$a = \sum_{k=0}^{p-1} d_k 10^k,$$ where $$p$$ is the number of decimal digits of $$a$$. For example, $$123 = 1\cdot 10^2 + 2\cdot 10^1 + 1\cdot 10^0.$$ Since $$10 \equiv 1 \pmod{9}$$ implies (by induction) that $$10^n \equiv 1 \pmod{9},$$ for any $$n \in \mathbb{N},$$ we get $$a \equiv \sum_{k=0}^{p-1} d_k 10^k \equiv \sum_{k=0}^{p-1} d_k \pmod{9}.$$

Some confusion may arise for the case when $$a$$ is negative. There are (seemingly) two interpretation of the proposition for this case.

One could say that the sum of the digits of e.g. $$-11$$ is $$1 + 1 = 2$$, but at the same time one could also claim that one should use the sum $$-(1 + 1) = -2$$ instead. The problem is that for the first interpretation the proposition does not hold for negative $$a$$ because e.g. $$-1 \equiv 8 \not\equiv 1 \pmod{9}.$$ For the second interpretation, the proposition is true for all integers because $$-x \equiv -y \pmod{9} \iff x \equiv y \pmod{9}.$$ (See comments below this article as well.)

= Alternative solution = This is essentially the same as above, but expressed somewhat differently (and uses only the second interpretation).

Let a be an integer. Suppose that a has k+1 digits in its decimal representation (k is a nonnegative integer), then a can be written as $$a = n_k{}n_{k-1}...n_1{}n_0 $$, and also as $$ a = \sum_{i=0}^{k} n_i{}10^i $$.

Assume first that a is nonnegative, then all the digits $$n_i$$ are nonnegative. Since $$10 \equiv 1 \ mod \  9 $$, it follows from Lemma 2.9.6 that $$ 10^i \equiv 1^i \equiv 1 \ mod \ 9$$, so that $$n_i{}10^i \equiv n_i \ mod \ 9 $$, hence $$ a \equiv ( \sum_{i=0}^{k} n_i ) \ mod \ 9 $$, and so a is equivalent to the sum of its decimal digits modulo 9.

Now let a be negative, then the digits $$ n_i$$ in its decimal representation $$ a = \sum_{i=0}^{k} n_i{}10^i $$ are all negative, so the digits $$-n_i $$ in the decimal representation of -a are all positive, and it follows from above that $$ - a \equiv (\sum_{i=0}^k -n_i) \ mod \ 9 $$. Then using the fact that x = y mod n implies -x = -y mod n, we have that $$a \equiv (\sum_{i=0}^k n_i)\ mod \ 9 $$. Hence in all cases, a is equivalent to the sum of its decimal digits modulo 9.