Worked examples — Modular arithmetic — definition, addition, multiplication, congruence
This page is a drill floor. The parent note taught you the rules; here we throw every kind of input at those rules — positive, negative, zero, huge powers, word problems, and one exam trap — so that no future problem surprises you.
Before any symbol appears, one reminder in plain words: writing means " and land on the same spot on a circle with marks numbered ." The mark you land on is the remainder after dividing by . That circle is the picture behind every example below.

Look at the red mark: it is position on a circle of marks. Every number that leaves remainder when divided by — that is and also — sits on that same red mark. That is the whole idea of a "bucket."
The scenario matrix
Every problem this topic can throw is one of these cells. Each worked example below is tagged with the cell it covers.
| Cell | Scenario | Danger it tests |
|---|---|---|
| A | Positive positive | reduce-first habit |
| B | Positive positive | reduce both factors |
| C | Negative input | wrapping into |
| D | Subtraction (a special negative) | can go below zero |
| E | Large power, base | trivial-base shortcut |
| F | Large power, base | finding the cycle length |
| G | Zero / degenerate (, or ) | edge behaviour |
| H | Word problem (real-world clock/calendar) | translating to |
| I | Exam twist — illegal "division" | the coprime condition |
Nine cells. Nine (and one bonus) worked examples follow. Prerequisites you may want open: Division Algorithm, GCD and LCM, Modular Inverses.
Example 1 — Cell A (positive + positive)
Forecast: Guess the final answer (a number between and ) before reading on.
- Reduce each operand. , so . And , so . Why this step? The addition rule says congruent numbers may be swapped for their remainders before adding — smaller numbers are safer to handle.
- Add the small numbers. . Why this step? By the addition rule .
- Is it in range? , so we stop. Why this step? Standard form lives in .
Answer: .
Verify: . Remainder . ✓
Example 2 — Cell B (positive × positive)
Forecast: Multiplying gives — but you should be able to name the remainder without that.
- Reduce each factor. . . Why this step? The multiplication rule lets us replace each factor by its remainder.
- Multiply the reduced values. . Why this step? .
- Reduce the product. , already standard.
Answer: .
Verify: . Remainder . ✓
Example 3 — Cell C (negative input)
Forecast: A negative number must still land on a mark in . Which one?

- Divide, allowing a negative quotient. We need with . Try : , and . Why this step? The Division Algorithm guarantees a unique remainder in even for negatives — we just pick small enough.
- Read off the remainder. , so . Why this step? That is the mark we land on when stepping backwards around the circle (red arrow in the figure).
- Shortcut check. Equivalently, add multiples of until non-negative: . Same answer.
Answer: .
Verify: , a multiple of . ✓
Example 4 — Cell D (subtraction dipping below zero)
Forecast: Subtraction is just "add a negative," so expect a wrap-around.
- Reduce each term. (already small); . Why this step? Reduce before operating, exactly as with addition — subtraction obeys the same swap rule.
- Subtract the reduced values. . Why this step? .
- Fix the sign if needed. Here , so no wrap is required.
Answer: .
Verify: , and . So . ✓
Example 5 — Cell E (large power, base ≡ 1)
Forecast: An exponent of looks terrifying. It won't be.
- Reduce the base. . Why this step? If the base is , the power rule collapses everything.
- Apply the power rule. . Why this step? Congruence survives exponentiation: .
- Evaluate. .
Answer: .
Verify: Since , every power of is . Check tiny case . ✓ (Compare with Fermats Little Theorem for a deeper reason powers cycle.)
Example 6 — Cell F (large power, base ≢ ±1 — find the cycle)
Forecast: Here , so we cannot collapse the base. Guess whether the answer is small.

- List the powers of until they repeat. , , , , , . Why this step? Powers must cycle (only possible remainders), and the moment we hit the pattern restarts. The cycle length here is .
- Use the cycle to shrink the exponent. Since , reduce modulo the cycle length : , so the leftover exponent is . Why this step? .
- Read the answer off the list. From step 1, .
Answer: .
Verify: The cycle (red loop in the figure) repeats every ; position gives the th entry . ✓
Example 7 — Cell G (zero / degenerate)
Forecast: Edge cases. Do the rules still hold when a factor is , or the modulus is ?
- Part (a): a zero factor. , so . Why this step? The multiplication rule works for any residues, including . Zero times anything is , and is already standard.
- Part (b): modulus . With , the marks on the circle are just — a single point. Every integer leaves remainder . Why this step? , so . In mod arithmetic all numbers collapse to one class.
Answers: (a) . (b) .
Verify: (a) . ✓ (b) , a multiple of . ✓
Example 8 — Cell H (real-world word problem)
Forecast: Weeks are a circle of marks. Guess a day.

- Model days as marks mod 7. Number the days Wed, Thu, Fri, Sat, Sun, Mon, Tue. Why this step? A week is a -mark clock; "in days" means stepping marks forward.
- Reduce the step count. , so . Why this step? Whole weeks ( of them) return you to the same day, so only the leftover steps matter.
- Step forward from Wed. Tuesday.
Answer: In days it will be Tuesday.
Verify: and , . ✓ Six days after Wednesday: Thu, Fri, Sat, Sun, Mon, Tue. ✓
Example 9 — Cell I (exam twist: illegal division)
Forecast: Your instinct says "divide both sides by ." Resist — check the gcd first.
- Check whether you may divide by . , so has no modular inverse mod ; naive division is forbidden. Why this step? Cancelling by is only legal when (see GCD and LCM).
- Divide the whole congruence by the common factor . Since divides , , and : . Why this step? When divides , you may divide , , and all by . This is the legal move — a Linear Congruences technique.
- Now , so invert mod . We need ; testing, , so . Why this step? With a genuine inverse we may finally "divide."
- Multiply through by . .
Answer: — equivalently as residues mod .
Verify: Take : . ✓ Take : . ✓ Take : . ✓
Recall Self-test (reveal after answering)
How do you reduce a negative number to standard form? ::: Add the modulus repeatedly until the result lands in . Why can be found instantly? ::: Because , and to any power is . For , what number do you reduce the exponent by? ::: The cycle length (since ), giving leftover exponent . When is dividing both sides of a congruence by legal? ::: Only when .