Skip to main content

A number is divisible by 3 iff sum of its digits are divisible by 3

I was walking with my girlfriend other day, and I started telling her how Indian mathematics education is quite different and taught quite differently. One example I gave her was that they teaches you that a natural number is divisible by 3 if and only if the sum of its digits (in decimal representation) are also divisible by 3. Then I asked, "do you know why?" without knowing the answer. So both of us started thinking of ways to prove it. After a moment of thoughts, I came up with the proof idea for one direction: if the sum of digits of a natural number is divisible by 3, then the number is divisible by 3. Let’s formally prove this.

Proof that if the sum of digits of a natural number in decimal representation is divisible by 3 then the number is also divisible by 3 #

Let n be a natural number with the decimal representation akak−1⋯a1a0 where k is a non-negative integer and ∀0≤i≤k,0≤ai≤9. Suppose the sum of digits is divisible by 3, which is to say  (∑i=0kai)mod3≡0

Then n=∑i=0kai⋅10i. Because 10mod3≡1, it follows that ∀i∈Z+,10imod3≡1 by properties of modular arithmetic. Thus ai⋅10imod3≡(aimod3)⋅(10imod3)mod3≡aimod3. Hence nmod3≡(∑i=0kai⋅10i)mod3≡(∑i=0kai)mod3. By the supposition, (∑i=0kai)mod3≡0, and therefore nmod3=0 as desired. Q.E.D.

The proof for the other direction, however, quite troubled me to come up with. By supposing that the number is divisible by 3 doesn’t really give you any information about each digit. But this direction can be proved easily using the technique of proof by contradiction.

Proof that if a natural number is divisible by 3, then the sum of its digits in decimal representation is also divisible by 3 #

Suppose not. Suppose there exists a natural number n that is divisible by 3 and the sum of its digits in decimal representation is not divisible by 3. That is to say if akak−1⋯a1a0 is the decimal representation of n, then (∑i=0kai)mod3≠0. It follows immediately that n≡∑i=0kai⋅10i. But nmod3=(∑i=0kai)mod3 using the same argument made for the previous proof (this result is derived without using the divisibility of the sum of digits in the previous proof). By supposition, (∑i=0kai)mod3≠0 so nmod3≠0. Thus n is both divisible and not divisible by 3, which is a contradiction. Thus our supposition must be false and there is no natural number divisible by 3 and the sum of its digits in decimal representation is not divisible by 3, proving the statement. Q.E.D.