Sub topic 2
Unit digit of sums, differences and products
This chapter assumes you are comfortable with place value, division with remainders and basic factorials. The previous chapter showed that the unit digit of a number is its remainder when divided by 10. Here you use that fact to find the unit digit of an expression without evaluating the whole expression.
The core rule
When you add, subtract or multiply integers, the unit digit of the result depends only on the unit digits of the inputs. The tens, hundreds and higher digits cannot reach the units place. Carries move left, never right.
In remainder language, for any integers a and b:
- (a + b) mod 10 = ((a mod 10) + (b mod 10)) mod 10
- (a − b) mod 10 = ((a mod 10) − (b mod 10)) mod 10
- (a × b) mod 10 = ((a mod 10) × (b mod 10)) mod 10
So you can replace every number in an expression by its unit digit, work with single digits, and keep only the last digit of each intermediate result.
Sums
Add the unit digits and keep the last digit of the total.
Example: find the unit digit of 487 + 2593 + 76.
The unit digits are 7, 3 and 6. Their sum is 16, so the unit digit is 6. Direct addition gives 487 + 2593 + 76 = 3156, which ends in 6.
You do not need to reduce after every step. For a long sum, add all the unit digits first and reduce once at the end. The sum of the first ten squares has unit digits 1, 4, 9, 6, 5, 6, 9, 4, 1, 0. These add to 45, so the unit digit is 5. The full sum is 385.
Products
Multiply the unit digits and keep the last digit. With more than two factors, reduce after each multiplication so the numbers stay small.
Example: find the unit digit of 23 × 47 × 58.
- 3 × 7 = 21, so keep 1.
- 1 × 8 = 8.
The unit digit is 8. The full product is 62698.
Shortcuts for products containing 0 or 5
These cases come up often in CAT problems because they let you stop early.
| Factors in the product | Unit digit of the product |
|---|---|
| Any factor ends in 0 | 0 |
| A factor ends in 5 and another factor is even | 0 |
| A factor ends in 5 and every factor is odd | 5 |
| An even factor and a factor ending in 5 appear anywhere in the list | 0 |
The reason is that an even number times 5 gives a multiple of 10, and a multiple of 10 ends in 0 however many further factors you multiply by. An odd number times 5 always ends in 5. For example, 1 × 3 × 5 × 7 × … × 99 ends in 5, because the product contains 5 and every factor is odd.
Unit digits of squares
Squares need only ten cases, and it is worth memorising them.
| Unit digit of a | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| Unit digit of a² | 0 | 1 | 4 | 9 | 6 | 5 | 6 | 9 | 4 | 1 |
A perfect square never ends in 2, 3, 7 or 8. If an answer option for a "unit digit of a square" question is one of those, you can eliminate it at once.
Differences
Subtraction needs more care, because you may need to borrow. Work with unit digits as follows.
- If the first unit digit is at least the second, subtract directly.
- If the first unit digit is smaller, add 10 to it first (this is the borrow), then subtract.
Example: find the unit digit of 1234 − 579.
The unit digits are 4 and 9. Since 4 < 9, compute 14 − 9 = 5. Direct subtraction gives 655, which ends in 5.
In remainder form this is (4 − 9) mod 10 = (−5) mod 10 = 5. Both views agree.
Negative results
The borrow method assumes the result is positive. If the first number is smaller than the second, the true result is negative, and the borrow method then gives the unit digit of the number with its sign removed incorrectly. Look at this example.
Find the unit digit of 1234 × 5678 − 4321 × 8765.
- 4 × 8 = 32, so the first product ends in 2.
- 1 × 5 = 5, so the second product ends in 5.
- 2 − 5: borrow to get 12 − 5 = 7.
The actual values are 7,006,652 − 37,873,565 = −30,866,913. The number you computed, 7, is the unit digit of the remainder mod 10 (Python also returns 7 for this), but the displayed number ends in 3. In a CAT question the expression is almost always positive, or the question asks for a remainder. If a result could be negative, decide first which one the question wants. When it asks for the unit digit of the magnitude, compare the two numbers' sizes and subtract the unit digits in the order that matches the larger number. Here that means 5 − 2 = 3.
Mixed expressions
Real questions combine all three operations. Apply the usual order of operations to the unit digits, and reduce at each stage.
Example: find the unit digit of 3456 × 7891 + 2345 × 6789 − 1234 × 9876.
- 6 × 1 = 6.
- 5 × 9 = 45, so keep 5.
- 4 × 6 = 24, so keep 4.
- 6 + 5 − 4 = 7.
The unit digit is 7. The final expression is positive, since the first two products together far exceed the third.
Series with a pattern: factorial sums
Some sums have most terms vanish. For n ≥ 5, n! contains both 2 and 5 as factors, so it is a multiple of 10 and its unit digit is 0. Only the first four terms matter:
- 1! = 1
- 2! = 2
- 3! = 6
- 4! = 24
The total is 1 + 2 + 6 + 24 = 33, so the unit digit of 1! + 2! + 3! + … + n! is 3 for every n ≥ 4. This is a direct use of the product shortcut: a factor 5 together with an even factor gives a unit digit of 0.
Checking with code
Python's % operator always returns a result between 0 and 9 when the modulus is 10, even for negative numbers, so it matches the remainder rule. The functions below apply the digit-by-digit method and compare it with a direct calculation.
from math import factorial
def unit_digit_sum(nums):
return sum(n % 10 for n in nums) % 10
def unit_digit_product(nums):
result = 1
for n in nums:
result = (result * (n % 10)) % 10
return result
print(unit_digit_sum([487, 2593, 76])) # 6
print(unit_digit_product([23, 47, 58])) # 8
print((1234 * 5678 - 4321 * 8765) % 10) # 7, a remainder, not the last printed digit
print(sum(factorial(k) for k in range(1, 101)) % 10) # 3
# Direct values agree with the digit method.
print((487 + 2593 + 76) % 10 == unit_digit_sum([487, 2593, 76])) # True
print((23 * 47 * 58) % 10 == unit_digit_product([23, 47, 58])) # TrueIn an exam you have no computer, but running a check like this while you practise confirms that your hand method is sound.
Common errors
- Reducing a number but forgetting that a product needs multiplication, not addition, of the unit digits. A common slip is to write 3 × 7 as 10 and keep 0 instead of reducing 21 to 1.
- Applying the digit method to division. It does not work: the unit digit of 48 ÷ 6 is not the unit digit of 8 ÷ 6. Division needs the full numbers or a different technique.
- Forgetting the borrow in differences, or applying it when the result is negative.
- Missing an early stop. Scan a product for a 0, or for a 5 with an even factor, before you start multiplying.
Practice
Exercise
Find the unit digit of 15 × 22 × 37 × 49.
Show answer
The factor 15 ends in 5 and 22 is even, so the product is a multiple of 10. The unit digit is 0. As a check, 5 × 2 = 10, which ends in 0, and multiplying by further integers keeps the 0.
Exercise
Find the unit digit of 1! + 2! + 3! + … + 50!.
Show answer
For n ≥ 5, n! is a multiple of 10 and ends in 0. Only 1! + 2! + 3! + 4! = 1 + 2 + 6 + 24 = 33 contributes, so the unit digit is 3.
Exercise
Find the unit digit of 3456 × 7891 + 2345 × 6789 − 1234 × 9876, then explain why the borrow method is safe for this expression.
Show answer
The unit digits of the products are 6, 5 and 4, so 6 + 5 − 4 = 7. The borrow method is safe because the result is positive: the first two products add up to far more than the third, so the written unit digit equals the remainder mod 10.
Exercise
A student claims that 7 × 13 × 29 ends in 3. Find the unit digit and say what the student likely did wrong.
Show answer
7 × 3 = 21, which keeps 1. Then 1 × 9 = 9. The unit digit is 9 (the product is 2639). The student probably added or mis-multiplied the digits at one step, for example by keeping 3 from 13 and ignoring the other factors.