# Sum of the digits of a numbers

Take a number say 987654. Sum it's digits

9 + 8 + 7 + 6 + 5 + 4 = 39
3 + 9 = 12
1 + 2 = 3


i.e. keep doing this till you get a single digit answer.

Now I take the same number & do it in other different ways, I still end up with the same answer.

987 + 654 = 1641
16 + 4 + 1 = 21
2 + 1 = 3


Or

98765 + 4 = 98769
9876 + 9 = 9885
988 + 5 = 993
99 + 3 = 102
1 + 0 + 2 = 3


How come I always get the same answer (3 in this case). This is not special for 987654. It's for any number you take.

What's the reason or theory behind this?

(PS - I am not sure what's the right tag for this question. Please correct if necessary).

-
Note that this does not for all numbers. For example: 1 or 71 don't yield 3 as in your examples. –  Emmad Kareem Oct 24 '12 at 11:53
I didn't say that the answer is always 3. –  user93353 Oct 24 '12 at 11:54
You said: "This is not special for 987654. It's for any number you take." - Anyway, nevermind, I just wanted to make it clear for you. –  Emmad Kareem Oct 24 '12 at 11:55
Yes, but I didn't say the answer is always 3. I said the answer is the same irrespective of what manner you add a particular number up - check the 3 different ways of adding up in the 3 examples in my question. –  user93353 Oct 24 '12 at 11:57
OK, I see your point. –  Emmad Kareem Oct 24 '12 at 12:03

What you have stumbled upon is known as taking the digital root, which is also sometimes referred to as a part of "Vedic mathematics." You might also be interested in reading about "Casting out nines". These sources should help point you in the right direction.

-

In short: in the end of this 'sum of digits' procedure, what is left coincides with the remainder modulo $9$. (More precisely, if $9|n$ then $9$ will be the result, unless $n=0$.)

The main point is $10\equiv 1 \pmod{9}$, hence $10^k\equiv 1 \pmod{9}$ for all $k\in\Bbb N$. So for any number with decimal digits $N=\overline{a_1a_2...a_n}$ $$N=\sum_{k=1}^n 10^{n-k}\cdot a_k \equiv \sum_k a_k \pmod{9}$$ So, meanwhile the process, the remainder mod $9$ always stays the same.

-
This is certainly true, but perhaps the OP was more interested in knowing something about the reason behind it. If you would explain why the sum of digits coincides with the remainder modulo 9 I would upvote your answer. –  Giovanni De Gaetano Oct 24 '12 at 10:33
I understand that the final answer answer for sumofdigits is always sumofdigits modulo 9. That's not my question. My question is why I get the same answer even if I go about summing different subsets of digits and then again summing them together - not sure how to describe this best - but my examples are there in my question –  user93353 Oct 24 '12 at 10:36
@user93353 The answer to that question is simple. Both the sum of digits and remainder modulo 9 is unchanged if we write $987654$ as $987000 + 654$. Then we note again that both remain unchanged as we strip away the three $0$-s. Also, carrying out the actual resulting addition $987 + 654 = 1641$ does not change remainder modulo 9, and thus does not change the final sum of digits. –  Arthur Oct 24 '12 at 11:41
@Arthur Upto stripping away the three 0-s is fine. But why does carrying out the addition 987 + 654 = 1641 not change the remainder modulo 9? –  user93353 Oct 24 '12 at 11:51
Because that's part of how modulo arithmetic works. In this case, if we take remainders on each side, we get $6 + 6 \mod 9$ on one side, and $3 \mod 9$ on the other side. Calculating, we get $6 +6 \equiv 12 \equiv 3 \mod 9$ for the left hand side, which is congurent to the $3$ on the right hand side. –  Arthur Oct 24 '12 at 12:15