# Backwards and forwards

Take a whole number, for example 1746, and reverse it, obtaining for example 6471. Three non-obvious things:

• The difference of the number and its reverse (or vice versa) is divisible by 9.
• If the original number has an odd number of digits, the difference of the number and its reverse is divisible by 11 (and by 9, hence by 99).
• If the original number has an even number of digits, the sum of the number and its reverse is divisible by 11.

## Divisibility by 9

The number 1746 can be written as $1\times 10^3 + 7\times 10^2 + 4\times 10 + 6$; in general an n–digit number can be written $\sum_{i = 0}^{n-1} d_i \times 10^i$, where the di are the digits. Then the number minus its reverse, or vice versa if the reverse is larger, is

$\left|\sum_{i=0}^{n-1}d_i-d_{n-i}\times 10^i\right|$$\left|\sum_{i=0}^{n-1}d_i\times \left(10^i-10^{n-1-i}\right)\right|$.

For instance, $6471-1746 =$ $(6-1)\times 10^3 + (4-7)\times 10^2 + (7-4)\times 10 + (1-6)$ $= 6 \times (10^3-1) + 4 \times (10^2-10) + 7 \times (10-10^2) + 1 \times (1-10^3)$ $= 6 \times 999 + 4 \times 90 - 7 \times 90 - 1 \times 999$. That last number is obviously divisible by 9, and in the general case the result is divisible by 9 if $10^i-10^{n-1-i}$ is. But $10^m \mod {9} = 1$ for all $m$, so $(10^i-10^{n-1-i}) \mod{9}=0$.

## Divisibility by 11

As before, the difference is divisible by 11 if $10^i-10^{n-1-i}$ is, where in this case n is odd; let $n = 2k+1$; then $10^i-10^{n-1-i} = 10^i-10^{2k-i}$. But $10 \mod {11} = 10 = 1 \mod {11}$, therefore $10^m \mod {11} = 1 (10)$ if $m$ is even (odd). $i$ and $2k-i$ have the same parity, so $10^i \mod {11} = 10^{2k-i} \mod {11}$, and $(10^i - 10^{2k-i}) \mod {11} = 0$.

By similar reasoning, when $n = 2k$ is even, the sum is divisible by 11 if $(10^i + 10^{2k-1-i})$ is. $i$ and $2k-1-i$ have opposite parity, so $10^i \mod {11} = -10^{2k-1-i} \mod {11}$, and $(10^i +10^{2k-1-i}) \mod {11} = 0$.