At your cousin’s Tihar party, an uncle with a pen behind his ear says he can read minds. He folds a slip of paper, writes something on it without letting anyone see, and gives it to your little sister to hold.
“Each of you, write down any three-digit number,” he says. “Make the first and last digits different. Now write the same digits backwards, and take the smaller number from the larger. Write that answer backwards too, and add the two together.”
Your sister picked 732. Your friend picked 521. Your grandmother, who wanted to catch him out, picked 908. They all do the sums. The uncle asks your sister to open the slip. It says 1089. Everyone got 1089.
Before you try it, guess.
The uncle wrote 1089 before anyone chose a number. Was he lucky with these three, or does every number do it?
Pick an answer to see why.
Now be the uncle’s audience yourself. Try your own number, then your friends’ numbers, then the strangest number you can think of.
Try it
Numbers that break the trick
Try to beat the machine. You will soon find the two kinds of number that seem to.
So the rule is: any three-digit number whose first and last digits are different, and every answer kept to three digits. Out of the 900 three-digit numbers, 100 to 999, 90 have the same first and last digit (like 343 and 707). The other 810 all end at 1089. A computer checked every one of them for this topic; you could too, with a few days and a lot of paper.
That is a strong reason to believe it, but it doesn’t tell you why, and without a why you can’t tell what happens with four digits, or with a different rule. So look closer.
Only nine differences
Look at the middle of the trick, the difference you get after subtracting. Here are some starting numbers and their differences:
| Start | Reversed | Difference |
|---|---|---|
| 732 | 237 | 495 |
| 853 | 358 | 495 |
| 521 | 125 | 396 |
| 470 | 074 | 396 |
| 381 | 183 | 198 |
| 941 | 149 | 792 |
| 908 | 809 | 099 |
732 and 853 give the same difference. So do 521 and 470. What do the numbers in each pair have in common?
Pick an answer to see why.
Here are all nine, with the first digit minus the last:
| First − last | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|
| Difference | 099 | 198 | 297 | 396 | 495 | 594 | 693 | 792 | 891 |
Look at the nine numbers before reading on. Two things are true of every one of them.
Now add any of the nine to its own reverse: 297 + 792, 594 + 495, 099 + 990. Each makes 1089. So two things need explaining: why the difference is always one of these nine, and why each of the nine, added to its reverse, makes 1089.
What’s going on
What a three-digit number really is
A number like 732 is a short way of writing 7 hundreds, 3 tens and 2 ones: 732 = 7 × 100 + 3 × 10 + 2. That is place value, from Grade 6: a digit’s worth depends on the place it stands in. Reversing a number keeps the digits but swaps their places. The 7 that was worth 700 in 732 is worth only 7 in 237, and the 2 that was worth 2 is now worth 200.
Why the difference is 99 times something
Lay both numbers out as counters in a place-value chart:
The tens are the same in both numbers, so they cancel. Each extra hundred in 732 adds 100 to the difference, and each extra one in 237 takes 1 away. They come in pairs, one extra hundred for every extra one, because the same digits have only swapped places. So each pair is worth 100 − 1 = 99, and there are as many pairs as the first digit minus the last.
Now say it for every three-digit number at once. Call its digits a, b and c, so the number is 100a + 10b + c. Here a letter stands for any digit, as letters stood for numbers in Grade 7’s algebraic expressions. Reversed, it is 100c + 10b + a. If a is the larger end, take the reverse away (if c is larger, take it the other way round, and the same steps give 99(c − a)):
The 10b cancels, just as the tens counters did. What is left is 99 times the first digit minus the last. Writing the number in a different form, with its place values showing, made the answer visible: you didn’t need to try any examples at all.
Why 99 times anything has a 9 in the middle
Take 99 × 4. That is 100 × 4 less 4: 400 − 4. Taking 4 from 400 is the same as taking 1 from it to get 399, then 3 more: 396. In general, 99 times a digit d (from 1 to 9) is
Read it as place values: the hundreds digit is d − 1, the tens digit is 9, the ones digit is 10 − d. For d = 4: 3, 9, 6. The middle is always 9, and the two ends, (d − 1) + (10 − d), always make 9. That is exactly what the table of nine showed, and now you know it can’t be otherwise.
Put the two together and the trick is proved. Add the difference to its reverse:
| hundreds | tens | ones | |
|---|---|---|---|
| difference, 99d | d − 1 | 9 | 10 − d |
| reversed | 10 − d | 9 | d − 1 |
| added | 9 | 18 | 9 |
9 hundreds, 18 tens and 9 ones make 1089, whatever the starting number was. A proof like this is different from checking: it covers all 810 numbers at once, and it says exactly when the trick works. If the first and last digits are equal, d = 0 and there is no difference to reverse. If they differ by 1, d = 1 and the difference is 99, whose hundreds digit is d − 1 = 0: so it must be written 099 for the columns to line up.
The same idea in simpler tricks
Algebra explains a whole family of party tricks. Here is a simpler one to try on a friend:
Think of a number. Add 7. Double it. Take away 4. Halve it. Now take away the number you first thought of. Your answer is 5.
It works for every number. To see why, draw the secret number as a bag you can’t see inside, and each 1 as a counter:
Doubling doubles the bag and the counters. Taking away 4 removes counters. Halving leaves one bag and half the counters. Taking away your number removes the bag. The 5 counters at the end never depended on what was inside the bag. In algebra, the steps make the expressions n + 7, 2n + 14, 2n + 10, n + 5 and finally 5. Each expression is a different way of writing the same amount, and writing it in a simpler form shows what the trick will do.
Another trick: Think of a number. Double it. Add 10. Halve it. Take away the number you thought of. What does everyone end with?
Pick an answer to see why.
More tricks with place value
Write it twice
Here is a trick that looks impossible. Write any three-digit number twice, side by side, to make a six-digit number: 365 becomes 365365. Divide it by 7. Divide the answer by 11. Divide that by 13. You are back at 365, and no division ever left a remainder.
The twist: four digits
What happens with four-digit numbers? Reverse, subtract, reverse, add, keeping four digits throughout. Try 1012: 2101 − 1012 = 1089 (that number again, in the middle of the trick this time). Reversed, 9801, and 1089 + 9801 = 10890. So perhaps the answer for four digits is always 10890?
Try 1010 before you choose. 1010 reversed is 0101, which is 101. What does the trick give for 1010?
Pick an answer to see why.
A computer tried all 9,000 four-digit numbers. Leaving out the 90 that read the same both ways (like 1221), it found just four endings:
| The trick ends at | How many of the 9,000 four-digit numbers |
|---|---|
| 9999 | 3,645 |
| 10890 | 3,645 |
| 10989 | 810 |
| 990 | 810 |
The algebra shows why. With digits a, b, c, d, the number is 1000a + 100b + 10c + d, and the difference from its reverse is
With three digits the middle digit canceled, so only the first digit minus the last mattered. With four digits the two middle digits swap places too, and don’t cancel: now the outer pair and the inner pair both matter, and there is more than one ending. A rule true for three digits needn’t be true for four; only the reason tells you which.
Kaprekar’s machine
Here is a different machine with a stranger ending. Take a four-digit number whose digits are not all the same, say 2026. Arrange its digits from largest to smallest, 6220, and from smallest to largest, 0226. Take the smaller from the larger: 6220 − 0226 = 5994. Now do the same to 5994, and keep going, keeping every number to four digits (999 is written 0999).
Every four-digit number whose digits aren’t all the same ends at 6174, and stays there, because 7641 − 1467 = 6174 again. A computer tried all 8,991 such numbers: none takes more than 7 steps (1004 is the smallest that needs all 7), and 1,980 of them need exactly 7. With three digits, every number ends at 495 within 6 steps.
With three digits, the first step of Kaprekar’s machine takes the digits smallest first from the digits largest first: for 732, 732 − 237. What can that first answer be?
Pick an answer to see why.
The three-digit machine is explained by the 1089 trick’s own algebra. For the four-digit machine, the simplest proof is to follow every four-digit number to the end, as a computer (or a very patient person) can. A proof that checks every case one by one is called a proof by exhaustion, and it is a real proof, as long as no case is missed.
Other ways of counting
The proof used one fact about our numbers: each place is worth ten times the place to its right. Count in something other than tens, and the trick still works, but ends somewhere else.
In Grade 8 you write numbers in base 5, where each place is worth five times the one to its right. The trick works there too; question f. below finds where it ends.
A story from maths
Where this is used
A check on the digit sum, like casting out nines, can never notice two swapped digits, because swapping them doesn’t change the digit sum. Check digits on barcodes are built to catch most such swaps. You can see how in Computing, Going Further: How Does a Barcode Catch a Typing Mistake?
Questions
Without doing the subtraction, write down the difference between 862 and 268.
Hint
Answer
A friend did the trick and told you the last digit of their difference was 3. What was their difference?
Pick an answer to see why.
Do the 1089 trick with two-digit numbers: take 72, reverse it, subtract, reverse the answer and add, keeping two digits. Try three more two-digit numbers. What always happens, and why?
Hint
Answer
Write 518 twice to make 518518. Which of these does not divide 518518 exactly?
Pick an answer to see why.
Make a “think of a number” trick whose answer is the number your friend first thought of plus 10, so that you can tell them their number. Explain it with bags or with algebra.
Answer
A shopkeeper’s two totals for the day should agree, but one says Rs 8,352 and the other Rs 8,532. Is this likely to be two digits swapped? Explain using 9.
Answer
Use the four-digit formula, 999(a − d) + 90(b − c), to explain why 1012 and 1010 behave differently in the four-digit trick.
Answer
In base 5 (Grade 8), each place is worth five times the place to its right, and the only digits are 0 to 4. Do the trick with 421₅, working in base 5 throughout: reverse, subtract, reverse, add. Then check by changing to base 10.
Hint
Answer
Where to go next
- Why Do the Divisibility Tests Work? The same place-value algebra explains why the digit sum tells you whether 9 divides a number.
- Is the Answer Roughly Right? Checking sums by casting out nines, and the swapped-digit mistakes it can’t see.
- Is a Pattern That Works Ten Times Always True? When checking examples isn’t enough.
- How Can You Multiply 98 × 97 in Your Head? More tricks that are algebra in disguise.
- Why Do the ‘Vedic Mathematics’ Tricks Work? (Grades 9–12) Famous shortcuts, and the algebra under each.
- How Does the Mind-Reading Card Trick Work? (Computing, Going Further) Another trick that is really place value, this time in binary.
- How Does a Barcode Catch a Typing Mistake? (Computing, Going Further) Check digits that catch swapped digits.
Where these facts come from
- The 1089 trick with its algebra; the mind-reading trick from the last digit of the difference, “unknown to most compilers of books of puzzles”; the pounds, shillings and pence trick from the Educational Times Reprints (1890, vol. 53, p. 78) and its answer £12 18s 11d: W. W. Rouse Ball, Fellow and Tutor of Trinity College, Cambridge, as its title page says, Mathematical Recreations and Essays (Macmillan; first edition 1892, the 1905 printing), public domain, Project Gutenberg ebook 26839, read October 2026.
- The trick’s rule (first and last digits differing, 99 read as 099), the book test with page 108 and the 9th word: Wikipedia, “1089 (number)”, read October 2026.
- David Acheson’s first meeting with the trick (age 10, 1956, a magic article) and his book 1089 and All That (Oxford University Press, 2002): D. Acheson, “1089 and all that”, Plus magazine, September 2004, read October 2026.
- D. R. Kaprekar’s life (born Dahanu 1905, Fergusson College, the 1927 prize, teacher at Devlali 1930–1962, died Nashik 1986), 6174 published in 1955, Harshad numbers, his ideas not taken seriously at first, and Martin Gardner’s column of March 1975: Wikipedia, “D. R. Kaprekar”, read October 2026.
- Kaprekar’s career in Devlali until he retired in 1962, 6174 found in 1946, announced at the Madras conference in 1949 and published in 1953 (“Problems involving reversal of digits”), Indian mathematicians laughing at his ideas, his privately printed pamphlets, Gardner’s column (March 1975) and his death in Devlali (Wikipedia: Nasik): J. J. O’Connor and E. F. Robertson, “Dattatreya Ramachandra Kaprekar”, MacTutor History of Mathematics, read October 2026.
- Kaprekar’s 1955 paper, “An interesting property of the number 6174”, Scripta Mathematica 21; 495 and 6174 as the only decimal Kaprekar constants for three and four digits: Wikipedia, “Kaprekar’s routine”, read October 2026.
- A trial balance difference that divides by 9 as a clue that figures may have been transposed: OpenStax, Principles of Accounting, Volume 1: Financial Accounting, 3.6 “Prepare a Trial Balance”, read October 2026.
- British money before 1971 (12 pence to the shilling, 20 shillings to the pound): from Ball’s worked example above, where £10 17s 5d − £5 17s 10d = £4 19s 7d.
- Every number in this topic (all 900 three-digit numbers, all 9,000 four-digit ones, Kaprekar’s steps for every three- and four-digit number, base 5, the 2,640 sums of money) computed in
checks/textbooks/math-further-6-8/03/tmp/numbers_1089.py.
