### 1 Description of the Magic Effect

- The magic effect consists of the following steps:
- Take a 3-digit number and reverse it.
- Subtract the smallest number from the greatest number.
- Take the result and reverse it again.
- Sum the result and the reversed number.

### 2 Mathematical Principle Behind the Magic Effect

Let n be the chosen number and write it in positional notation as n = xyz. This means that n = 100x + 10y + z. When the volunteer is asked to reverse the number and then subtract the smallest from the greatest, the following operations are carried out:

At this point it is clear that the effect will not work if the number is palindromic, that is, if we obtain the same number when read backwards. In this case the subtraction will be zero. Without loss of generality, we can assume that x > z. We re-write the result as 99(x - z) = 11 ⋅ 9 ⋅ (x - z). Since x - z < 9, the product 9 ⋅ (x - z) is a multiple of 9 between 9 and 81. This multiple can be written as 9 ⋅ (x - z) = a10 + b, for certain a,b in ℕ. By substituting this expression in the product 99(x - z), we will obtain:

We reverse the number and sum the original number:

Since a10 + b is a multiple of 9, the sum of its digits is 9, and, therefore, (a + b)121 = 9 ⋅ 121 = 1089. This shows that the magic effect always works as long as the chosen number is not a palindrome.

**Note:** Some people have put forward a simpler, not so deep explanation. I have taken it as valid as this one.

### 3 The 2-digit Version

Let n be a 2-digit number. As before, we write it in positional notation, n = xy = 10x + y. Then, the number is reversed and subtracted from each other.

Again, we must require x is not equal to y, that is, the number cannot be a palindrome. Let us assume, for example, that x > y. Let us write number 9(x - y) as 10a + b, as done before.

### 4 The 4-digit Version

First of all, the same situation arises when a palindromic number is chosen. Let us take a non-palindromic number. Even in that case, the final result is not unique. Consider the following numbers as a point in case:

n = 1,000: 1,000 - 0001 = 999 999 + 999 = 1,998.

n = 1,003: 3,001 - 1,003 = 1,998 1,998 + 8,991 = 10,989.

n = 1,011 : 1,101 - 1,011 = 90 90 + 09 = 99.

n = 7,451 : 7,451 - 1,547 = 5,904 5,904 + 4,095 = 9,999.