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

The full multiplication table of $\mathbb{Z}/n\mathbb{Z}$. Pick a modulus (try $7$ for a field, $6$ or $8$ for composites) and slide the row highlighter. For a prime modulus, every nonzero row is a permutation of $\{1, \dots, n-1\}$. For composites, repeats and zeros appear \u2014 those residues lack multiplicative inverses.

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.

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:

5 \cdot 3x \equiv 5 \cdot 5 \pmod 7
15 x \equiv 25 \pmod 7
1 \cdot x \equiv 4 \pmod 7

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:

  1. The seven residues form a closed, well-behaved arithmetic system.
  2. Every nonzero residue has a unique multiplicative inverse — so division works.
  3. 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