Divisible by 9

This problem is from Alexander Karabegov.

Given an integer m, suppose that the integer n is obtained from m by permuting its digits. For example, if m = 171243, then n could be 711234, or n could be 432117, and so on. Show that the difference mn is divisible by 9.

Please submit all response to mathpotw@acu.edu by 5:00 PM on Thursday.

Correct solutions were submitted by:  none.

The outline of the solution we present is to show that m is congruent to the sum of its digits modulo 9, and that n is congruent to the sum of its digits modulo 9. Then since the digits of n are just a rearrangement of the digits of m, both sums of the digits are the same. We then apply the transitive property of congruence: if x is congruent to y and y is congruent to z, then x is congruent to z.

Recall that two integers are congruent modulo 9 if and only if the difference of the two numbers is divisible by 9. So we look at the difference between an integer and the sum of its digits.

Now it is clear that 9 divides this difference. The problem is solved.