Ring and Field Calculator

ℤₙ Structure · Units · Zero Divisors · Cayley Tables

Explore the algebraic structure of ℤₙ (integers modulo n). Identify units, zero divisors, nilpotents, and idempotents. Check if ℤₙ is a field, integral domain, or just a ring. View full Cayley tables.

Quick Modulus

Enter a modulus n (2–30) and click Analyze to explore the ring structure of ℤₙ.

What Is a Ring in Abstract Algebra?

A ring is one of the fundamental structures in abstract algebra. Formally, a ring (R, +, ×) is a set R with two binary operations satisfying three groups of axioms: (1) (R, +) is an abelian group — addition is associative, commutative, has an identity (0), and every element has an additive inverse; (2) multiplication is associative; (3) distributivity — multiplication distributes over addition on both sides. When multiplication is also commutative, we call R a commutative ring. When there is a multiplicative identity 1 ≠ 0, R is a ring with unity.

Familiar rings include the integers ℤ, the rationals ℚ, the reals ℝ, the complex numbers ℂ, polynomial rings R[x], and matrices Mn(R). The integers modulo n, written ℤₙ or ℤ/nℤ, form a commutative ring with unity for every n ≥ 2.

Ring Axioms at a Glance

AxiomPropertyHolds in ℤₙ?
A1Additive associativity: (a+b)+c = a+(b+c)Always
A2Additive commutativity: a+b = b+aAlways
A3Additive identity: a + 0 = aAlways
A4Additive inverse: a + (-a) = 0Always
M1Multiplicative associativity: (ab)c = a(bc)Always
M2Commutativity: ab = baAlways
M3Multiplicative identity: 1·a = a·1 = aAlways
DDistributivity: a(b+c) = ab + acAlways

What Is an Integral Domain?

An integral domain is a commutative ring with unity that has no zero divisors. A zero divisor is a nonzero element a such that ab = 0 for some nonzero b. In ℤₙ, element a is a zero divisor exactly when gcd(a, n) > 1 and a ≠ 0. For example, in ℤ6: 2 × 3 = 6 ≡ 0 (mod 6), so 2 and 3 are zero divisors, and ℤ6 is not an integral domain. When n is prime, gcd(a, n) = 1 for all 1 ≤ a ≤ n−1, so there are no zero divisors — and ℤp is an integral domain.

What Is a Field?

A field is a commutative ring with unity in which every nonzero element has a multiplicative inverse. Equivalently, a field is a commutative division ring. The classic examples are ℚ, ℝ, ℂ. Among ℤₙ, the ring ℤp is a field if and only if p is prime — because only then does every nonzero a satisfy gcd(a, p) = 1, guaranteeing an inverse a−1 mod p. By a deep theorem: every field is an integral domain, but the converse only holds when the ring is finite (Wedderburn's Little Theorem: every finite division ring is commutative).

Units, Zero Divisors, Nilpotents, and Idempotents

Four special classes of elements characterize the structure of ℤₙ:

  • Units: elements a with gcd(a, n) = 1; these form the multiplicative group (ℤₙ)* of order φ(n) (Euler's totient). Every nonzero element of a field is a unit.
  • Zero divisors: nonzero a with gcd(a, n) > 1. They always come in pairs: if a is a zero divisor via ab ≡ 0, then b is too. Zero divisors are absent exactly when n is prime.
  • Nilpotents: elements a for which ak ≡ 0 (mod n) for some positive integer k. In ℤₙ, a is nilpotent iff every prime factor of n also divides a. The only nilpotent element in a field is 0.
  • Idempotents: elements a satisfying a2 ≡ a (mod n). Always includes 0 and 1; additional idempotents appear when n is composite. By the Chinese Remainder Theorem, the number of idempotents equals 2k where k is the number of distinct prime factors of n.

Finite Fields — Galois Fields GF(pk)

The only finite fields are the Galois fields GF(q) (also written 𝔽q) where q = pk for a prime p and k ≥ 1. When k = 1, GF(p) = ℤp. For k > 1, GF(pk) cannot be constructed as ℤpk (which is not a field for k > 1), but as the quotient ring ℤp[x]/(f(x)) where f is an irreducible polynomial of degree k over ℤp. This is the setting of the Polynomial Ring tab above.

Galois fields are critical in modern technology: AES encryption uses arithmetic in GF(28); Reed-Solomon codes (used in QR codes and CDs) use GF(28); elliptic curve cryptography operates over GF(p) and GF(2k).

Polynomial Rings ℤp[x]

When p is prime, the polynomial ring p[x] consists of all polynomials with coefficients in ℤp. This is an integral domain, and it behaves like ℤ: one can perform polynomial long division, compute GCDs using the Euclidean algorithm for polynomials, and factor polynomials into irreducibles. Quotienting by an irreducible polynomial f(x) of degree k gives the finite field GF(pk).

Reference Table: Structure of ℤₙ for Common n

nRingComm. RingIntegral DomainFieldUnitsZero Divisors
2YesYesYesYes{1}none
4YesYesNoNo{1,3}{2}
5YesYesYesYes{1,2,3,4}none
6YesYesNoNo{1,5}{2,3,4}
7YesYesYesYes{1,2,3,4,5,6}none
12YesYesNoNo{1,5,7,11}{2,3,4,6,8,9,10}

Applications in Coding Theory and Cryptography

  • RSA cryptography: key generation works in (ℤφ(n), +, ×); private key d = e−1 mod φ(n) requires the unit group structure.
  • Diffie-Hellman / ElGamal: security relies on the discrete logarithm problem in the cyclic unit group (ℤp)* for large primes p.
  • AES (Advanced Encryption Standard): AddRoundKey, SubBytes, MixColumns all operate in GF(28) = ℤ2[x]/(x8+x4+x3+x+1).
  • Reed-Solomon codes: error correction via polynomial arithmetic over finite fields; used in QR codes, CDs, DVDs, and deep-space telemetry.
  • BCH codes and LDPC codes: designed using properties of polynomial rings over finite fields.
  • Elliptic curve cryptography (ECC): the group of points on an elliptic curve over GF(p) or GF(2k) provides the discrete-log hard problem used in modern TLS.

Frequently Asked Questions

What is a ring in abstract algebra?
A ring is a set R with two binary operations (addition and multiplication) where (R, +) is an abelian group, multiplication is associative, and multiplication distributes over addition. The integers ℤ, real numbers ℝ, and integers modulo n (ℤₙ) are classic examples. Every ℤₙ for n ≥ 2 is a commutative ring with unity.
What is a field?
A field is a commutative ring with unity in which every nonzero element has a multiplicative inverse. In ℤₙ, this happens exactly when n is prime. Examples: ℤ2, ℤ3, ℤ5, ℤ7 are fields; ℤ4 and ℤ6 are not (they have zero divisors / non-invertible nonzero elements).
What is an integral domain?
An integral domain is a commutative ring with unity that has no zero divisors: if a × b = 0, then a = 0 or b = 0. In ℤₙ, there are no zero divisors if and only if n is prime. Every field is an integral domain; a finite integral domain is always a field.
What is a zero divisor?
A zero divisor in a ring R is a nonzero element a such that there exists a nonzero b with a × b = 0. In ℤₙ, element a is a zero divisor precisely when gcd(a, n) > 1 and a ≠ 0. Example: in ℤ6, 2 × 3 = 6 ≡ 0 (mod 6), so both 2 and 3 are zero divisors.
Why is ℤₙ a field only when n is prime?
Element a has a multiplicative inverse mod n iff gcd(a, n) = 1. If n is prime, gcd(a, n) = 1 for all 1 ≤ a ≤ n−1, so every nonzero element is a unit — making ℤₙ a field. If n is composite, say n = p × q with 1 < p, q < n, then p is nonzero but gcd(p, n) = p > 1, so p has no inverse — not a field.
What are the units of ℤₙ?
The units of ℤₙ are the elements a with gcd(a, n) = 1. These form the multiplicative group (ℤₙ)* of order φ(n) (Euler's totient function). For example, the units of ℤ12 are {1, 5, 7, 11} since φ(12) = 4. The unit group is cyclic iff n ∈ {1, 2, 4, pk, 2pk} for odd prime p.
What is a Galois field?
A Galois field GF(q) (also written 𝔽q) is a finite field with q elements. Finite fields exist only when q = pk for a prime p and positive integer k. GF(p) = ℤp; GF(pk) for k > 1 is built from ℤp[x] quotiented by an irreducible polynomial of degree k. Galois fields are foundational in coding theory (Reed-Solomon, BCH) and cryptography (AES, ECC).