Path: blob/main/foundations/02-rings-fields-polynomials/sage/02d-what-is-a-field.ipynb
483 views
What Is a Field?
Module 02 | 02-rings-fields-polynomials
Every nonzero element invertible, is a field iff is prime
Objectives
By the end of this notebook you will be able to:
Define a field and explain how it differs from a ring.
Prove computationally that is a field exactly when is prime.
Build complete multiplication and inverse tables for a prime field.
Identify familiar fields (, , ) and non-fields (, ).
Explain why cryptography requires fields, not just rings.
Prerequisites
Completion of Integers Mod n as a Ring, you should know what units and zero divisors are.
Completion of Polynomial Rings, you've seen rings with different coefficient sets.
Concepts: ring axioms, , .
Motivating Question
In notebook 02b, we discovered that has units (elements with multiplicative inverses) and zero divisors (nonzero elements whose product is zero). For instance, has no inverse in , you simply cannot "divide by 3" in that ring.
Question: Is there a version of modular arithmetic where you can divide by anything nonzero? In other words: can we find a ring where every nonzero element is a unit?
The answer is yes, and such a ring earns a special name: a field. Let's discover which values of make this work.
From Rings to Fields: The Key Upgrade
Recall that a ring gives us addition and multiplication with the usual nice properties (associativity, distributivity, additive inverses, etc.).
A field is a commutative ring with one crucial extra property:
Field axiom: For every in , there exists such that .
In other words: every nonzero element is a unit.
More precisely, a field is a commutative ring with where every nonzero element has a multiplicative inverse.
Bridge from 02b: In , we found that the units were , only 4 out of 11 nonzero elements. The rest were zero divisors. In a field, the set of units equals the set of all nonzero elements. Zero divisors are completely eliminated.
Misconception alert: "A field is just a ring with multiplicative inverses." Almost, but you also need (1) multiplication to be commutative, and (2) the ring to be nontrivial, meaning . The trivial ring (where ) satisfies every other axiom but is not a field.
The Problem with : Zero Divisors Block Invertibility
Let's revisit and see concretely why it fails to be a field. We'll classify every nonzero element as either a unit or a zero divisor.
Only 4 out of 11 nonzero elements are invertible. The other 7 are zero divisors, they "kill" information when you multiply. You cannot undo multiplication by 3 in , because means the function is not injective.
Key connection: An element is a zero divisor if and only if it is not a unit (in ). So having zero divisors and failing to be a field are two sides of the same coin.
Is a Field When Is Prime
Now the punchline. Let's check: for which values of is a field?
Checkpoint (predict before running): Look at the list . For which values of do you think every nonzero element of will have an inverse? What pattern do you expect?
Why Does Primality Guarantee a Field?
Here is the key reasoning:
An element is a unit (we proved this in 02b).
If is prime and , then cannot divide , so .
Therefore every nonzero element of is a unit.
And there are no zero divisors (other than 0 itself).
Conversely, if is composite, say with , then , giving us a zero divisor. So is a field if and only if is prime.
This is why prime fields are written or ("Galois Field of order ").
Building the Complete Multiplication Table for
Checkpoint: Before we build the multiplication table, predict: will there be any zeros in the table (other than in the row/column for 0)? What would a zero entry mean?
Let's build the full multiplication table for and verify that the nonzero elements form a closed multiplicative system with no zeros sneaking in.
That last observation is crucial: each nonzero row of the multiplication table is a permutation of . This means:
Every nonzero value appears exactly once in each row.
In particular, 1 appears in every row, so every nonzero element has an inverse.
The function is a bijection on for any .
This is the defining feature of a field: multiplication by any nonzero element is always reversible.
The Inverse Table for
Now let's build the complete inverse table. For each nonzero , we find such that .
Familiar Fields and Non-Fields
Fields are everywhere in mathematics. Let's check which familiar number systems are fields:
| Structure | Field? | Reason |
|---|---|---|
| (rationals) | Yes | Every nonzero has inverse |
| (reals) | Yes | Every nonzero real has a reciprocal |
| (complex) | Yes | Every nonzero has inverse |
| (integers) | No | has no integer inverse () |
| No | (zero divisors) | |
| Yes | Every nonzero element coprime to 7 |
Let's verify with SageMath:
The Smallest Field:
The smallest possible field has just two elements: and . Its arithmetic is surprisingly familiar:
Addition in is XOR:
Multiplication in is AND:
The only nonzero element is , and . Done, it's trivially a field!
Crypto foreshadowing: is the foundation of all binary arithmetic in cryptography. AES operates over , an extension field with 256 elements that we'll construct in Module 03. Every byte in AES is an element of this field, and the MixColumns step is literally matrix multiplication over .
Why Fields Matter for Cryptography
In cryptography, we constantly need to divide, that is, multiply by an inverse. Here's why:
RSA uses modular arithmetic in (not a field!), but key generation requires working in the unit group. The security relies on the difficulty of factoring to find the structure of that unit group.
Elliptic curve cryptography defines curves over prime fields . The point addition formula requires dividing by differences of coordinates, this only works if every nonzero element has an inverse.
AES performs byte-level arithmetic in . The SubBytes step computes multiplicative inverses in this field.
Shamir's Secret Sharing evaluates polynomials over and reconstructs secrets using Lagrange interpolation, which requires dividing by for distinct points.
In a ring that isn't a field, some of these divisions would fail, leading to broken cryptosystems. Fields give us the guarantee: if it's nonzero, you can divide by it.
The slogan: Rings let you add, subtract, and multiply. Fields let you do all of that and divide (by anything nonzero). Cryptography needs division, so cryptography needs fields.
Exercises
Exercise 1: Inverse Table for (Fully Worked)
Task: Build the complete inverse table for and verify that every nonzero element has an inverse.
Exercise 2: Field Detective (Guided with TODOs)
Task: For each ring below, determine whether it is a field by checking two things:
Does it have zero divisors?
Is every nonzero element a unit?
Fill in the TODO sections.
Exercise 3: Division in a Field (Independent)
Task: In , compute the following "divisions" by finding multiplicative inverses. No starter code is provided, write it from scratch.
Compute (i.e., find ).
Compute .
Verify your answers: if , then should equal .
Challenge: Can you compute ? What about ? Explain the difference.
Hint: In SageMath, if F = GF(13), then F(a) / F(b) computes the field division directly, or you can manually compute F(a) * F(b)^(-1).
Summary
| Concept | Key idea |
|---|---|
| Field | A commutative ring (with ) where every nonzero element has a multiplicative inverse. Equivalently, a field has no zero divisors |
| is a field iff is prime | When is prime, for all , so every nonzero element is invertible |
| Familiar fields and non-fields | , , , and are fields. (no integer inverse for 2) and (zero divisors) are not |
| , the smallest field | Just , where addition is XOR and multiplication is AND |
| Crypto needs fields | Protocols require division (multiplication by inverse) for every nonzero element. Elliptic curves, AES, and secret sharing all rely on field arithmetic |
Looking ahead: We've seen that gives us one field for each prime . But AES uses a field with elements, and 256 is not prime! How can that be a field? The answer involves polynomial quotient rings, which we'll explore starting in the next notebook.