Recipe
Add two elements in \mathbb{Z}_n
Use when: you need a+b inside (\mathbb{Z}_n, +), including finding an additive inverse or filling in one cell of a Cayley table
Goal: the single representative in \{0,\ldots,n-1\} that a+b actually equals, with the wraparound step never skipped
Taught in The group Z_n under addition
Quick recipe
-
1
Ignore \mathbb{Z}_n for a moment and add a+b the normal way, without any reduction yet.
Example
In \mathbb{Z}_9: 6+4=10, computed exactly as ordinary addition.
Why: reduction only makes sense once the raw, unreduced sum is in hand.
-
2
Compare the raw sum from Step 1 to n.
- the raw sum is already between 0 and n-1 — it's already the final answer, no further step needed.
- the raw sum is n or more (or negative) — it needs the wraparound step before it's a genuine element of \mathbb{Z}_n.
Why: an unreduced sum like 10 isn't wrong arithmetic, but it isn't one of \mathbb{Z}_n's actual elements either.
-
3
Subtract n as many times as needed if the sum is too large, or add n if it's negative, until the result sits in \{0,\ldots,n-1\}.
Example
Continuing 6+4=10 in \mathbb{Z}_9: 10 \ge 9, so subtract once, 10-9=1, giving 6+4=1 in \mathbb{Z}_9.
Why: this wraparound step is exactly the division algorithm from the readiness review, applied to the raw sum with divisor n.
-
4
Set the target sum to 0 and solve for x directly: x=n-a works for any nonzero a, since a+(n-a)=n, which reduces to 0 by the same wraparound step.
Example
Invert 5 in \mathbb{Z}_7: x=7-5=2, and checking confirms 5+2=7\equiv0 \pmod 7.
Why: an inverse is the special case of Steps 1-3 where the target sum is the identity, 0, instead of some other value.
Common mistakes
- Reporting the raw, unreduced sum (like 10 in \mathbb{Z}_9) as the final answer.
- Subtracting n the wrong number of times, instead of just enough to land the result in \{0,\ldots,n-1\}.
- Forgetting the wraparound step entirely when the sum happens to already look like a reasonable small number.
- Computing an inverse with ordinary subtraction, -a, instead of n-a, and getting a negative representative instead of one in range.