Elementary Number Theory – Every Integer is Congruent to the Sum of Its Digits Mod 9

elementary-number-theory

This is a question from the free Harvard online abstract algebra lectures. I'm posting my solutions here to get some feedback on them. For a fuller explanation, see this post.

This problem is from assignment 6. The notes from this lecture can be found here.

Prove that every integer $a$ is congruent to the sum of its decimal digits modulo 9.

Let $s$ be an $(n+1)$-digit integer given by $s=a_n\cdot10^n+\dots+a_2\cdot10^2+a_1\cdot10^1+a_0\cdot10^0$ with $a_i\in\mathbb{Z}$ such that $0\leq a_i\leq9$. Then
$
\begin{align}
s\,\mathrm{mod}\,9&=\bar{s}\\
&=\overline{a_n\cdot10^n+\cdots+a_2\cdot10^2+a_1\cdot10^1+a_0\cdot10^0}\\
&=\overline{a_n\cdot10^n}+\overline{\cdots}+\overline{a_2\cdot10^2}+\overline{a_1\cdot10^1}+\overline{a_0\cdot10^0}\\
&=\overline{\overline{a_n}\cdot\overline{10^n}}+\overline{\cdots}+\overline{\overline{a_2}\cdot\overline{10^2}}+\overline{\overline{a_1}\cdot\overline{10^1}}+\overline{\overline{a_0}\cdot\overline{10^0}}\\
&=\overline{\overline{a_n}\cdot1}+\overline{\cdots}+\overline{\overline{a_2}\cdot1}+\overline{\overline{a_1}\cdot1}+\overline{\overline{a_0}\cdot1}\\
&=\overline{a_n}+\overline{\cdots}+\overline{a_2}+\overline{a_1}+\overline{a_0}\\
&=a_n\,\mathrm{mod}\,9+\cdots+a_2\,\mathrm{mod}\,9+a_1\,\mathrm{mod}\,9+a_0\,\mathrm{mod}\,9
\end{align}
$

Again, I welcome any critique of my reasoning and/or my style as well as alternative solutions to the problem.

Thanks.

Best Answer

Just another way.

Clearly $9\vert (10-1)$. Suppose that $9\vert (10^n - 1)$, $n\gt 1$. Then $$10^{n+1}-1 =10\cdot 10^{n}-1=9\cdot 10^n + (10^n - 1)$$ thus $9\vert (10^{n+1}-1)$. Therefore $9\vert (10^n-1)$ for any $n\in\mathbb{N}$.

Now take an integer $$a=\sum_{i=0}^n a_i10^{i},$$ where $a_i\in \{0,1,\ldots,9\}$. Then $$a-\sum_{i=0}^na_i=\sum_{i=0}^n a_i10^{i}-\sum_{i=0}^na_i=\sum_{i=1}^n a_i(10^{i}-1),$$ therefore, by the established above $$a\equiv \sum_{i=0}^na_i \pmod 9$$