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
Algebraic Classification of ℤₙ
Key Element Sets
All Elements ℤₙ
Units (gcd(a,n) = 1) — have multiplicative inverse
Zero Divisors (gcd(a,n) > 1, a≠0) — prevent integral domain
Nilpotents (ak≡0 for some k≥1)
Idempotents (a2≡a)
Structure Summary
Enter a modulus n (2–30) and click Analyze to explore the ring structure of ℤₙ.
Arithmetic Operations in ℤₙ
Operation
Cayley Table for ℤₙ
Analyze a modulus n ≤ 15 to view the Cayley table.
Cayley tables are shown only for n ≤ 15 (table would be too large).
Analyze a modulus to view the unit group (ℤₙ)*.
Unit Group (ℤₙ)*
Units, Inverses & Orders
| Unit a | Inverse a¹ | Order ord(a) | a² mod n | Is Generator? |
|---|
Polynomial arithmetic in ℤp[x] is available only when n is prime. Select a prime modulus (2, 3, 5, 7, 11, 13, ...) and click Analyze.
Polynomial Arithmetic in ℤp[x]
Enter coefficients as comma-separated values, highest degree first. Example: 1,0,2,1 represents x³ + 2x + 1.
Polynomial Results
f(x) + g(x) mod p
f(x) × g(x) mod p
gcd(f(x), g(x)) in ℤp[x]
Irreducibility of f(x) over ℤp
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
| Axiom | Property | Holds in ℤₙ? |
|---|---|---|
| A1 | Additive associativity: (a+b)+c = a+(b+c) | Always |
| A2 | Additive commutativity: a+b = b+a | Always |
| A3 | Additive identity: a + 0 = a | Always |
| A4 | Additive inverse: a + (-a) = 0 | Always |
| M1 | Multiplicative associativity: (ab)c = a(bc) | Always |
| M2 | Commutativity: ab = ba | Always |
| M3 | Multiplicative identity: 1·a = a·1 = a | Always |
| D | Distributivity: a(b+c) = ab + ac | Always |
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
| n | Ring | Comm. Ring | Integral Domain | Field | Units | Zero Divisors |
|---|---|---|---|---|---|---|
| 2 | Yes | Yes | Yes | Yes | {1} | none |
| 4 | Yes | Yes | No | No | {1,3} | {2} |
| 5 | Yes | Yes | Yes | Yes | {1,2,3,4} | none |
| 6 | Yes | Yes | No | No | {1,5} | {2,3,4} |
| 7 | Yes | Yes | Yes | Yes | {1,2,3,4,5,6} | none |
| 12 | Yes | Yes | No | No | {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.