Sum of digits of squares of a number and its reverse

450 Views Asked by At

I have observed the following:

Let $ab$ be a two digit number where $a$ and $b$ represent digits, and $ba$ be a two digit number with its digits in reverse order as $ab$. If the sum of the digits of $(ab)^2$ be $S_n$ and that of $(ba)^2$ be $S_r$, then $|{S_n-S_r}|=9n$ where $n=0 \: or\: 1 \: or \: 2$

In short, the difference of the sums of the digits is zero or a multiple of nine. Example: $27^2=729 \\ 72^2=5184\\ \text{Here,} \: (7+2+9)-(5+1+8+4)=0\\ \text{But here,} \: 46^2=2116\\ 64^2=4096\\ \text{and} \: (4+0+9+6)-(2+1+1+6)=9$

Why is this happening? Is this true for any number?

I've checked for every two digit number, and it works.

1

There are 1 best solutions below

0
On BEST ANSWER

Recall that for any positive integer $x$ we have $x\equiv S(x)\;(\text{mod}\;9)$, where $S(x)$ denotes the sum of the decimal digits of $x$.

Allowing leading zero digits, let $x$ be an $n$-digit number and let $y$ be its reversal (i.e., the digits of $y$ are the same as those of $x$, but in reverse order). \begin{align*} \text{Then}\;\;&S(x)=S(y)\\[4pt] \implies\;&S(x)\equiv S(y)\;(\text{mod}\;9)\\[4pt] \implies\;&x\equiv y\;(\text{mod}\;9)\\[4pt] \implies\;&x^2\equiv y^2\;(\text{mod}\;9)\\[4pt] \implies\;&S(x^2)\equiv S(y^2)\;(\text{mod}\;9)\\[4pt] \end{align*}