Prove the difference between a number and the same number with two digits switched is always divisible by 9

306 Views Asked by At

I'm currently taking an elementary number theory course, and not quite sure if this proof suffices for the given problem statement.

Here is my proposed proof:

Let $d$ be an $n$-digit natural number.

Let there be two of the digits $a,b$ for $d$ where $a = a*10^x$, $b = b*10^y$, $0\leq x\neq y \leq n - 1$.

Assume $x > y$ to always achieve a non-negative difference.

When swapping the digits a and b, we have the following difference between the two quantities:

$(a * 10^x + b*10^y) - (b*10^x + a*10^y) \leftrightarrow $ $a(10^x - 10^y) + b(10^y - 10^x) \leftrightarrow (a - b)(10^x - 10^y)$

Since $10 \equiv 1(\mod 9)$, the above statement evaluates to 0, thus showing $9 | 0$, which means the difference between the correct amount and the amount with the two digits switched is always divisible by 9.

1

There are 1 best solutions below

0
On

I would drop the $x > y$ requirement. It's clutter, in my opinion. It suffices that $x \neq y$.

Take for example $1729$. Switch two digits to get $1927$. Then $1927 - 1729 = 198$. But $1729 - 1927 = -198$. Taking your assertion

$(a * 10^x + b*10^y) - (b*10^x + a*10^y) \leftrightarrow $ $a(10^x - 10^y) + b(10^y - 10^x) \leftrightarrow (a - b)(10^x - 10^y)$

and plugging in $7$ and $9$ both ways, we get

$$(700 + 9) - (900 + 7) \leftrightarrow (7 - 9)(100 - 1)$$

and

$$(900 + 7) - (700 + 9) \leftrightarrow (9 - 7)(1 - 100)$$

Then, ignoring signs, we arrive at the same result.