A friend of mine (whose last name is Songer) recently mentioned an unusual observation at a dinner party---if one subtracts a number from its reversal, the result is always divisible by nine. In a textbook example of nerd sniping, a couple of other friends and I whipped out calculators to convince ourselves and spent a few minutes trying to find a proof (as one does at dinner parties). Not all of the guests that night were fond of math, so we set the problem aside when the proof wasn't immediately forthcoming. However, an unresolved sense of mathematical angst propelled me toward a proof the next day, and it has an interesting consequence.
Now, we define the reversal of a number as the reversal of its digits. For instance, the reversal of 1234 would be 4321. If we define a reversal function that performs this reversal, our theorem is formally stated as follows:
For every integer , there is an integer such that
There are a few different ways to think about integers. Most helpful to our proof is to think about them as polynomials. For instance, 271 is equivalent to . So, for any integer with digits , there is an equivalent polynomial .
Let our value of in the theorem be an integer with digits . Then our theorem can be restated as
We can then pair up every term in with its corresponding term in the reversal. For each term, this gives us something like
This is equivalent to
If is equal to , then we're right in the middle of both numbers and this term is equal to 0. So, let's assume without loss of generality, that is greater than . Then we can factor an extra out of both of the powers of 10 to get
This term now has a factor that is a nonzero power of 10 minus 1 which will always give us an integer divisible by 9 (9, 99, 999, etc.). Since every digit of has a corresponding digit in the reversal, every one of these paired terms in the polynomial must be divisible by 9.
What's more, we see that 9 isn't particularly special. It just happens to be the value that's one less than the base we're working in. We could just as easily use any other base as a substitute for 10. So, for a base , a number minus its reversal is divisible by . This gives us a more abstract formulation:
For every integer in base , there is an integer such that