Preamble

This is a toy proof of a math trick I learned in elementary school. It’s really Just an excuse to play with .

This document is also available as PDF and source.

Introduction

There was a trick we learned in elementary school: if the sum of the digits of a number is divisible by 3, then the number itself is divisible by 3.

Example: Is divisible by ? The sum of digits is , which is divisible by , so should be divisible by according to this rule, and yes, .

Is that true for all numbers?

Proving it

We write numbers as strings of decimal digits like so:

More precisely, we write an integer as a string of decimal digits: , which represents the equation:

Given that definition of the digits of a number, we can prove the theorem. First, a couple of mini-theorems:

Lemma 1: For all integer polynomials, for some integer . In other words, is divisible by .

Proof: By induction. First the base case where :

So for the base base, .

Now, the inductive step. Assuming , prove :

We’ve proven the case: , and by induction this is be true for all .

Lemma 2: If , then is divisible by if and only if is divisible by .

**Proof: ** Assume is divisible by . Then, for some integer , and

thus is divisible by .

Now, assume is {\bf not} divisible by . Then, for some , and

and since , is {\bf not} divisible by .

Thus is divisible by if and only if is divisible by .

Now we can get back to the main theorem.

Theorem: If an integer is written as a string of digits where , then is divisible by 3 if and only if the sum of its digits is divisible by 3.

Proof: The proof uses the simple fact that :

So , and by Lemma 2, is divisible by 9 if and only if the sum of its digits, is also divisible by 9. That’s an interesting result, but we were trying to prove that statement for 3. However, since :

Lemma 2 works again to prove that is divisible by 3 if and only if the sum of its digits, is also divisible by 3.

Epilogue

This proof used the fact that we write integers in base 10, and , and thus if the sum of a number’s digits in base 10 is divisible by 9 or 3, then so is the number itself. This works for other bases too. For example, if the number’s digits are in base 8, this rule will work for all divisors of . For example, , and