# Trick with 3-digit numbers, always get 1089

When I was in primary school a teacher showed us the following exercise in arithmetic.

Take any 3 digit number between 201 and 998 provided that the hundreds digit is bigger than the ones digit and do the following:

1. Write down the number $\hspace{2.2cm} 523$

2. swap the first and last digits $\hspace{1.5cm} 325$

3. Now subtract the two numbers $\quad\,= 198$

4. Now swap the first and last digits of the new number and add them $198+891=1089$ always

Today I showed this to my 5th grade niece who was pretty amazed, but then she asked me the question that I was not prepared for:

Why does it always work?

• – lab bhattacharjee Sep 18 '14 at 16:51
• I notice that $1089=33^2$. ${}\qquad{}$ – Michael Hardy Sep 18 '14 at 16:53
• Many of these problems, amazing to 5th graders, are easy to verify using algebra ... Maybe the next time one of them asks you why it works, tell them that. Maybe they will look forward to algebra (for a change). – GEdgar Sep 18 '14 at 17:15
• See also Kaprekar's constant. – Lucian Sep 18 '14 at 17:57
• Choosing, for example, 645 it does not work, apparently. The first difference (1.) is 99. I think the first number must be higher by 2 than the last. – Emi987 Sep 19 '14 at 7:29

Setting $100A+10B+C$, we have $$(100A+10B+C)-(100C+10B+A)=100(A-C)+C-A$$$$=100(A-C-1)+9\cdot 10+(10+C-A).$$ So, we have $$\left(100(A-C-1)+90+(10+C-A)\right)+\left(100(10+C-A)+90+(A-C-1)\right)$$$$=9\cdot 100+90\cdot 2+9=1089.$$

• I'm not sure how much a fifth grader might understand that... But good answer either way! – Ethan Bierlein Sep 18 '14 at 20:59
• Why does this fail for 645? (or any A,B,C in general?) – Dennis Jaheruddin Sep 19 '14 at 11:08
• @DennisJaheruddin: For $645$, you'll get $645-546=99$. If you think $99$ as $099$, it works because $099+990=1089$. So, in general, if you think that $A-C-1=0$ is OK, then it works. If you think $100(A-C-1)+9\cdot 10+(10-A-C)$ should be three-digits number, then we need another condition $A-C-1\ge 1$. – mathlove Sep 19 '14 at 11:17

A less rigorous, but simpler, explanation for beginners is to note that (1) the digits $xyz$ of the first subtraction must satisfy $x+z = 9$ and $y = 9$, and then it is easy to see that (2) the sum which follows is $1089$. This only requires understanding (1) subtraction and borrowing, followed by (2) addition and carrying, rather than the full fledged powers of $10$ algebraic proof.

Here I have found the nice generalization of this!!!

Consider the four digit number $ABCD$ with $A>D+1$ then,

1. Write down the number $\hspace{2.2cm} ABCD$

2. swap the first and last digits $\hspace{1.5cm} DBCA$

3. Now subtract the two numbers $\quad\,$

4. Now swap the first and last digits of the new number and add it in to initial number, then you get $10989$ always

FOR:
Consider the four digit number $1000A+100B+10C+D$ with $A>D+1$ then, $$(1000A+100B+10C+D)-(1000D+100B+10C+A)=1000(A-D)+(-A+D)=1000(A-D-1)+900+90+(10-A+D)$$ Adding the numbers..., we get

$\{1000(A-D-1)+900+90+(10-A+D)\}+\{1000(10-A+D)+900+90+(A-D-1)\}$ $$=1000\times9+1800+180+9\\=10989$$

Numbers of digits and invariant sums can be given like $$2\to 99$$ $$3\to 1089$$ $$4\to 10989$$ $$5\to 109989$$ and so on (I hope :)).

Let's call the digits of the original number h, t and o, for hundreds, tens, and ones. The effect of subtracting oth from hto is the same as doing the following three equations and adding the results together:

(100 * h) - (      h) =  99 * h
( 10 * t) - ( 10 * t) =   0
(      o) - (100 * o) = -99 * o


That's easily simplified, first to (99 * h) - (99 * o), and then further, to (h - o) * 99. Because h and o are single digits, and further we know that h > o (according to the original problem, which said that the hundreds digit must be greater than the ones digit), we know that h - o cannot be less than 1, or greater than 8.

That means that there are actually only eight possible values for the three-digit number we have after the first step, and they are found in the following table of the three-digit multiples of 99 (fudging a bit on the first entry):

 1 * 99  =  099
2 * 99  =  198
3 * 99  =  297
4 * 99  =  396
5 * 99  =  495
6 * 99  =  594
7 * 99  =  693
8 * 99  =  792
9 * 99  =  891
10 * 99  =  990


Each time we add 99, it has the effect of subtracting 1 from the ones place and adding 1 to the hundreds place (the flip side of when we were shifting digits between the ones and hundreds places, and the effect was the same as adding/subtracting multiples of 99.) That's why the hundreds digit goes up, and the ones digit goes down, at exactly the same pace - and why the reverse of each number in the table is also a number in the table. (However many steps it takes from go up from a to b, it takes exactly as many to go down from b to a.)

For any number in the table, if it is the nth entry in the table reading down, its reversed counterpart is the nth entry in the table reading up. When you select pairs under that constraint, from a table where each consecutive entry is exactly c greater than the last for some constant, the sum of each pair will always be the same as the sum of the first and the last (try it with a table where the entries are only 1 apart, and you'll see why.) So, no matter which multiple of 99 our initial subtraction gives us, adding its reversed counterpart will always give us a sum equal to (1 + 10) * 99 - i.e., 1089.

I suggest something like the following.

How does it work?

Let’s look at the number 432, What doe it mean?

4 Hundreds + 3 tens + 2 ones

If we reverse the digits (234) What does that mean?

2 Hundreds + 3 tens + 4 ones

If we subtract the 2nd from the 1st won’t it look like this?

4 Hundreds + 3 tens + 2 ones - 2 Hundreds - 3 tens - 4 ones

2 Hundreds + 0 tens + 2 ones – 4 ones

2 Hundreds + 0 tens - 2 ones

1 Hundred + 1 Hundred + 0 tens - 2 ones

1 Hundred + 10 tens + 0 tens - 2 ones

1 Hundred + 10 tens - 2 ones

1 Hundred + 9 tens + 1 tens - 2 ones

1 Hundred + 9 tens + 10 ones - 2 ones

1 Hundred + 9 tens + 8 ones

198