When you write out the multiplication table of \mathbb{Z}/7\mathbb{Z} — the residues \{0, 1, 2, 3, 4, 5, 6\} with multiplication reduced mod 7 — something striking happens. Every nonzero row (and every nonzero column) is a permutation of \{1, 2, 3, 4, 5, 6\}. Each nonzero residue appears exactly once. That is the fingerprint of a field, and it is the reason \mathbb{Z}/7\mathbb{Z} behaves like the rationals or reals rather than like ordinary integers.
Compare this to the mod-4 table, where the row for 2 reads 0, 2, 0, 2 — the residue 2 keeps hitting 0 before it runs through all residues. That failure is the fingerprint of not being a field. The difference is one word: 7 is prime.
What the table looks like
What "every nonzero residue appears once" means
Pick any nonzero a in \{1, 2, 3, 4, 5, 6\} and look at its row. You see six cells, and the six values are a rearrangement of \{1, 2, 3, 4, 5, 6\} — never a repeat, never a zero, and always a 1 somewhere. Each of those three facts matters.
-
No repeats: if a \cdot b_1 \equiv a \cdot b_2 \pmod 7 for b_1 \ne b_2, then a(b_1 - b_2) \equiv 0 \pmod 7, so 7 \mid a(b_1 - b_2). But \gcd(a, 7) = 1 since 7 is prime, so 7 \mid (b_1 - b_2), forcing b_1 = b_2 in \{0, \dots, 6\}. Contradiction.
-
No zeros in nonzero rows: if a \cdot b \equiv 0 \pmod 7 with a, b \ne 0, then 7 \mid ab. Since 7 is prime, either 7 \mid a or 7 \mid b. But a, b \in \{1, \dots, 6\}, so neither can be a multiple of 7. Contradiction.
-
Exactly one 1: the six values in the row are distinct and drawn from the six nonzero residues, so all six are present, including 1.
That last point is the definition of a multiplicative inverse: a \cdot b \equiv 1 \pmod 7 means b = a^{-1}. Every nonzero residue has a unique inverse. Every nonzero element is invertible — that is precisely what "field" means.
Why primality matters: the argument "no repeats" and "no zeros" both use \gcd(a, 7) = 1 for every nonzero a. This is automatic when 7 is prime because the only divisors of 7 are 1 and 7 itself. For a composite modulus like 12, you lose this: \gcd(4, 12) = 4 \ne 1, so the argument fails, and row 4 mod 12 does contain zeros (4 \cdot 3 \equiv 0 \pmod{12}) and repeats.
The failing case: mod 4
Compare to \mathbb{Z}/4\mathbb{Z}:
| \times | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 2 | 3 |
| 2 | 0 | 2 | 0 | 2 |
| 3 | 0 | 3 | 2 | 1 |
Row 2 is 0, 2, 0, 2 — only two distinct values, and 2 \cdot 2 \equiv 0 \pmod 4 even though neither factor is zero. This means 2 has no multiplicative inverse mod 4: no value of b makes 2b \equiv 1 \pmod 4, since the row never contains 1. So \mathbb{Z}/4\mathbb{Z} is not a field, just a ring.
The culprit is \gcd(2, 4) = 2 \ne 1. The residue 2 shares a factor with the modulus, so multiplying by 2 "aligns" with the modular wrap in a way that produces zeros.
General rule: \mathbb{Z}/n\mathbb{Z} is a field if and only if n is prime. For prime moduli, every nonzero residue is coprime to n, so every row is a permutation, and inverses exist for all nonzero elements. For composite moduli, the residues that share factors with n have no inverse.
Why fields are the good number systems
In a field you can divide (except by zero), solve linear equations, and run most of the algebra you learned in school. \mathbb{Q}, \mathbb{R}, \mathbb{C} are fields. \mathbb{Z} is not (you cannot divide 1 by 2 inside the integers). \mathbb{Z}/p\mathbb{Z} for prime p is a finite field — all the divisibility of \mathbb{Q} packaged into just p elements.
This is why number theorists love prime moduli. Every cryptographic tool that uses modular arithmetic — RSA, Diffie–Hellman, elliptic curves — relies on working in a field or group whose inverses are well-defined. Without primality, you lose inverses, and without inverses, you lose the algebra.
One worked example
Use the table to solve $3x \equiv 5 \pmod 7$
Step 1. Find the inverse of 3 mod 7. From row 3 of the table, the column where 3 \cdot b \equiv 1 is b = 5. So 3^{-1} \equiv 5 \pmod 7.
Step 2. Multiply both sides of the equation by 5:
Why: 5 \cdot 3 = 15 = 2 \cdot 7 + 1, so 15 \equiv 1 \pmod 7. And 25 = 3 \cdot 7 + 4, so 25 \equiv 4 \pmod 7.
Step 3. Check. 3 \cdot 4 = 12 = 7 + 5 \equiv 5 \pmod 7. ✓
So x \equiv 4 \pmod 7. In a field, linear equations have unique solutions — and the table gave you the inverse you needed with a single cell lookup.
The takeaway
Staring at the mod-7 table for a minute teaches you three things at once:
- The seven residues form a closed, well-behaved arithmetic system.
- Every nonzero residue has a unique multiplicative inverse — so division works.
- The table's "permutation of rows" structure is the visual signature of a field.
The same table for composite moduli loses this structure. The gap between prime and composite modulus, which sounds subtle when stated in words, is visible at a glance on the multiplication table.
Related: Modular Arithmetic · Modular Inverse Finder · Number Theory Basics · Are There Infinitely Many Primes? · Chinese Remainder Theorem