# Proof of a discovery involving the square of whole numbers

It was probably discovered by someone else but: When you take the square of a non-zero whole number the sum of the numbers digit is always equal to $1,4,7,9$ How can I write a mathematical proof of that?

• I must be missing something, but $7^2 = 49$ and $4+9 = 13$. Or $8^2 = 64$ and $6+4 = 10$. Do you then some the digits of the result as well? – Bamboo Aug 12 '15 at 16:32
• Yes I mean to sum the digits of the result until there is one number left – DoubleOseven Aug 12 '15 at 16:35

This follows quite easily from the fact that digit sum arithmetic is equivalent to arithmetic modulo 9. To see this we express a given integer $n$ as $n = k_1 + 10 k_2 + ... + 10^j k_j$ where the $k_i$s are integers (in fact the digits of $n$). Then $n = k_1 + k_2 + ... + k_j \, (mod \, 9)$.

Then the question is simply which numbers are square modulo 9 and the answer to that is precisely the numbers in your list.

• What do you mean when you write: "which numbers are square modulo 9"? – DoubleOseven Aug 12 '15 at 16:42
• @mathguy007 I mean for which numbers $n$ is there $k$ such that $k^2 = n \, (mod \, 9)$. – Rhys Steele Aug 12 '15 at 16:45

This is the base $9$ equivalent of all the squares ending in $0,1,4,5,6,9$ base $10$ because the "digital root" you are calculating is also the remainder on dividing by $9$.

This works in turn because any power of $10$ leaves remainder $1$ when it is divided by $9$ ($10^r=\dots 999+1$ where there are $r$ nines).

It is a nice thing to notice and explore. So I'm including some suggestions.

You might want to find out about the remainders of squares to other moduli (bases). $8$ is a surprising one, and well worth knowing (can you spot the pattern and prove it). And you could see what happens with prime numbers too. The key concept here is "quadratic residue".

Note that $(3r\pm 1)^2=3(3r^2\pm 2r)+1$ leaves remainder $1$ on division by $3$ and that $(3r)^2=9r^2$ is divisible by $9$.

Just as any integer can be odd or even, every integer is either a multiple of $3$ or one more or one less than a multiple of $3$. So every square leaves remainder $1$ on division by $3$ or $0$ (equivalent to $9$) on division by $9$ - and these are just the ones you have picked out.