# π’ Mastering Unit Digit Problems
## The Problem
> **X** and **Y** are the digits at the unit's place of the numbers **(408X)** and **(789Y)** where **X β Y**.
> However, the digits at the unit's place of **(408X)^63** and **(789Y)^85** are the same.
> **What will be the possible value(s) of (X + Y)?**
---
## π Prerequisites
### 1. Base & Exponent
In the expression **2βΈ** (read as "two raised to the power of 8"):
- **2** is the **base**
- **8** is the **exponent**
---
### 2. PEW β Power Ends With
**PEW** is a term we'll use to describe the **cyclical pattern** of unit digits when a number is raised to successive powers.
| Base | PEW (Power Ends With) | Meaning |
|:----:|:---------------------:|:--------|
| 1 | (1) | Any power of 1 ends in **1** |
| 2 | (2, 4, 8, 6) | Powers of 2 cycle through these digits |
| 3 | (3, 9, 7, 1) | Powers of 3 cycle through these digits |
| ... | ... | ... |
#### β οΈ Important!
**PEW is an ordered sequence, not just a set.** The order matters because it tells us the *next* unit digit for consecutive powers.
**Example:** If 2ΒΉβ° = 1024 (ends in 4), then 2ΒΉΒΉ ends in **8** (next in the cycle).
---
### 3. The Golden Property of PEW
> **To find the unit digit of a large number in base^exponent form, only consider the last digit of the base.**
| Expression | Simplifies To | Why? |
|:----------:|:-------------:|:-----|
| 12345678ΒΉβ°β΄ | 8ΒΉβ°β΄ | Only the unit digit (8) matters |
| 123456789ΒΉΒ²Β³ | 9ΒΉΒ²Β³ | Only the unit digit (9) matters |
| 408XβΆΒ³ | XβΆΒ³ | Only X determines the unit digit |
---
### 4. Modular Arithmetic
Think of **modulo** as finding the **remainder** after division.
> π **Real-world example:** Clocks use mod 12, so 13:00 becomes 1:00 PM.
| Expression | Value | Explanation |
|:----------:|:-----:|:------------|
| 1 mod 4 | 1 | 1 Γ· 4 = 0 remainder **1** |
| 5 mod 4 | 1 | 5 Γ· 4 = 1 remainder **1** |
| 8 mod 4 | 0 | 8 Γ· 4 = 2 remainder **0** |
| 100 mod 4 | 0 | Perfect division |
**Key insight:** `n mod X` always gives a value between **0** and **X-1**.
---
## π Connecting PEW and Modulo
Here's where the magic happens!
### Building the PEW Table for Base 2
| Power | Value | Unit Digit | Position in Cycle |
|:-----:|:-----:|:----------:|:-----------------:|
| 2ΒΉ | 2 | 2 | 1st |
| 2Β² | 4 | 4 | 2nd |
| 2Β³ | 8 | 8 | 3rd |
| 2β΄ | 16 | 6 | 4th |
| 2β΅ | 32 | 2 | 1st β©οΈ |
| 2βΆ | 64 | 4 | 2nd |
| 2β· | 128 | 8 | 3rd |
| 2βΈ | 256 | 6 | 4th |
**PEW(2) = (2, 4, 8, 6)** β cycle length = **4**
---
### π‘ The Formula
> **To find the unit digit of base^n:**
> 1. Find PEW of the base's unit digit
> 2. Calculate: `n mod (PEW size)`
> 3. Look up that position in the PEW cycle
#### Example 1: What does 2ΒΉβ°β° end with?
```
PEW(2) = (2, 4, 8, 6) β size = 4
100 mod 4 = 0 β means "4th position" (0 = complete cycle)
Answer: 6 β
```
#### Example 2: What does 2ΒΉβ°ΒΉ end with?
```
PEW(2) = (2, 4, 8, 6) β size = 4
101 mod 4 = 1 β 1st position
Answer: 2 β
```
Visualizing 2βΉβ· through 2ΒΉβ°ΒΉ:
```
2βΉβ· = ...2 (position 1)
2βΉβΈ = ...4 (position 2)
2βΉβΉ = ...8 (position 3)
2ΒΉβ°β° = ...6 (position 4)
2ΒΉβ°ΒΉ = ...2 (position 1) β©οΈ cycle restarts
```
---
## π― Solving the Original Problem
### Step 1: Simplify the Problem
From the problem:
- Unit digit of **(408X)βΆΒ³** = Unit digit of **XβΆΒ³**
- Unit digit of **(789Y)βΈβ΅** = Unit digit of **YβΈβ΅**
**Reframed problem:**
> Find X and Y (where X β Y) such that **XβΆΒ³** and **YβΈβ΅** have the **same unit digit**.
---
### Step 2: Build the Complete PEW Table
| Base | PEW | Cycle Size |
|:----:|:---:|:----------:|
| 0 | (0) | 1 |
| 1 | (1) | 1 |
| 2 | (2, 4, 8, 6) | 4 |
| 3 | (3, 9, 7, 1) | 4 |
| 4 | (4, 6) | 2 |
| 5 | (5) | 1 |
| 6 | (6) | 1 |
| 7 | (7, 9, 3, 1) | 4 |
| 8 | (8, 4, 2, 6) | 4 |
| 9 | (9, 1) | 2 |
---
### Step 3: Calculate Mod Values
For **XβΆΒ³**:
```
63 mod 4 = 3 β for bases with cycle size 4
63 mod 2 = 1 β for bases with cycle size 2
```
For **YβΈβ΅**:
```
85 mod 4 = 1 β for bases with cycle size 4
85 mod 2 = 1 β for bases with cycle size 2
```
---
### Step 4: Compute Unit Digits for Each Base
| Base | PEW | XβΆΒ³ ends with | YβΈβ΅ ends with |
|:----:|:---:|:-------------:|:-------------:|
| 0 | (0) | 0 | 0 |
| 1 | (1) | 1 | 1 |
| 2 | (2, 4, 8, 6) | **8** β 3rd position | **2** β 1st position |
| 3 | (3, 9, 7, 1) | **7** β 3rd position | **3** β 1st position |
| 4 | (4, 6) | **4** β 1st position | **4** β 1st position |
| 5 | (5) | 5 | 5 |
| 6 | (6) | 6 | 6 |
| 7 | (7, 9, 3, 1) | **3** β 3rd position | **7** β 1st position |
| 8 | (8, 4, 2, 6) | **2** β 3rd position | **8** β 1st position |
| 9 | (9, 1) | **9** β 1st position | **9** β 1st position |
---
### Step 5: Find Matching Pairs
We need: **XβΆΒ³ unit digit = YβΈβ΅ unit digit** where **X β Y**
Looking for matches **across different rows**:
| XβΆΒ³ ends with | YβΈβ΅ ends with | X | Y | Match? |
|:-------------:|:-------------:|:-:|:-:|:------:|
| 8 | 8 | 2 | 8 | β
|
| 7 | 7 | 3 | 7 | β
|
| 3 | 3 | 7 | 3 | β
|
| 2 | 2 | 8 | 2 | β
|
---
## β¨ Solution
### Valid (X, Y) Pairs:
| X | Y | XβΆΒ³ ends with | YβΈβ΅ ends with | X + Y |
|:-:|:-:|:-------------:|:-------------:|:-----:|
| 2 | 8 | 8 | 8 | **10** |
| 3 | 7 | 7 | 7 | **10** |
| 7 | 3 | 3 | 3 | **10** |
| 8 | 2 | 2 | 2 | **10** |
---
## π Final Answer
$$\boxed{X + Y = 10}$$
---
## π§ Key Takeaways
1. **Only the unit digit of the base matters** when finding unit digits of powers.
2. **PEW sizes are limited:** Only 1, 2, or 4 β so we only need to mod by 2 or 4.
3. **The "swap pattern":** When power positions differ (like 3rd vs 1st in a cycle-4):
- 2 β 8 (both sum to 10)
- 3 β 7 (both sum to 10)
4. **This is why X + Y = 10 appears so frequently** in these problems!
---
## π Quick Reference: PEW Table
```
ββββββββ¬ββββββββββββββ¬βββββββββββ
β Base β PEW β Size β
ββββββββΌββββββββββββββΌβββββββββββ€
β 0 β (0) β 1 β
β 1 β (1) β 1 β
β 2 β (2,4,8,6) β 4 β
β 3 β (3,9,7,1) β 4 β
β 4 β (4,6) β 2 β
β 5 β (5) β 1 β
β 6 β (6) β 1 β
β 7 β (7,9,3,1) β 4 β
β 8 β (8,4,2,6) β 4 β
β 9 β (9,1) β 2 β
ββββββββ΄ββββββββββββββ΄βββββββββββ
```
---
*Happy Problem Solving! π*