Path: blob/main/foundations/02-rings-fields-polynomials/sage/02f-quotient-rings.ipynb
483 views
Quotient Rings and Field Extensions
Module 02 | 02-rings-fields-polynomials
quotient(), building GF(4) from F_2, the construction behind every finite field in cryptography
Objectives
By the end of this notebook you will be able to:
Explain the quotient ring construction and why it generalises "mod" from integers to polynomials.
Build GF(4) by hand as and verify it is a field.
Construct complete addition and multiplication tables for small extension fields.
Explain why the modulus polynomial must be irreducible to get a field (and what goes wrong if it isn't).
State the general pattern: .
Recognise as the AES field and connect this notebook to Module 03.
Prerequisites
Completion of Polynomial Division and Irreducibility, you need
quo_remandis_irreducible().Concepts from Integers Mod n as a Ring, zero divisors, units, .
Concepts from What Is a Field?, every nonzero element invertible.
Motivating Question
In notebook 02d we saw that is a field whenever is prime. That gives us fields of size 2, 3, 5, 7, 11, 13, ...
But can we build a field with 4 elements? Or 8? Or 256?
There is no prime equal to 4, 8, or 256. So cannot help us. We need a fundamentally different construction.
The answer turns out to be: take polynomials and "mod out" by an irreducible polynomial, exactly the way we take integers and mod out by a prime. This is the quotient ring construction, and it is the single most important algebraic idea behind finite fields in cryptography.
The Core Analogy: Integers vs Polynomials
Let's put the two constructions side by side. The parallel is exact.
| Integers | Polynomials | |
|---|---|---|
| Start with | (all integers) | (all polynomials over ) |
| Mod out by | (an integer) | (a polynomial) |
| Elements of quotient | Remainders | Remainder polynomials of degree |
| Arithmetic | Add/multiply, then reduce mod | Add/multiply, then reduce mod |
| Get a field when | is prime | is irreducible |
| Notation |
That's it. Same machine, different raw materials.
Bridge from 02b/02e: In 02b you learned that has zero divisors because 12 is composite, while is a field because 7 is prime. In 02e you learned that some polynomials are irreducible (the polynomial analogue of "prime"). Now we combine these ideas.
Warm-Up: Z/nZ Revisited
Before we touch polynomials, let's remind ourselves how modular arithmetic works for integers. When we compute in , every integer gets replaced by its remainder after dividing by 5.
Misconception alert: A common mistake is to think "GF(4) = ." This is wrong! has zero divisors () and is therefore NOT a field. GF(4) is a completely different algebraic structure that we build from polynomials, not integers. They both have 4 elements, but their arithmetic is entirely different.
So how DO we build a field with 4 elements? By modding out polynomials instead of integers.
Building GF(4) Step by Step
Step 1: Choose the base field and polynomial ring
We work over , the field with 2 elements. The polynomial ring contains all polynomials with coefficients in .
Step 2: Choose an irreducible polynomial of degree 2
From notebook 02e, we know that is irreducible over . (It has no roots: plugging in 0 gives 1, plugging in 1 gives 1. No root means no linear factor means irreducible for degree 2.)
Step 3: Form the quotient
The elements are all remainders when dividing by . Since the divisor has degree 2, all remainders have degree . Over , the possible remainders are:
That's 4 elements, exactly what we wanted!
The element a in the quotient ring plays the role of , but now it satisfies , which means (over , subtraction is the same as addition).
This is exactly like how in the number 7 "becomes" 2 because . Here, "becomes" because .
Addition Table for GF(4)
Addition in is just polynomial addition with coefficients mod 2. Since in , this is essentially XOR on the coefficient vectors.
Checkpoint: Predict Before You Compute
Before running the next cell, predict: what is in GF(4)?
Think about it: represents in the quotient. So . But in our quotient ring, , so (since in ).
Your prediction: ?
Now run the cell to check.
Let's trace one multiplication by hand to make sure we understand the mechanics.
Example: Compute in GF(4).
Multiply as polynomials:
Reduce mod : divide by :
(remainder is 1, since in )
Result:
This means and are multiplicative inverses of each other!
Verifying: It's Really a Field!
A ring is a field if and only if every nonzero element has a multiplicative inverse. Let's check all three nonzero elements of GF(4).
Why Irreducibility Matters
What happens if we mod out by a polynomial that is not irreducible? Let's try over . Note that in (since ), so it factors.
This is exactly analogous to forming instead of : modding out by something composite gives zero divisors.
The pattern is now clear:
| Construction | Condition for field | Failure mode |
|---|---|---|
| is prime | Composite zero divisors | |
| is irreducible | Reducible zero divisors |
Irreducible polynomials are to polynomial rings what primes are to integers.
Scaling Up: Building GF(8)
Now that we understand the construction, let's build a bigger field. To get , we need an irreducible polynomial of degree 3 over .
From 02e, we know is irreducible over . So:
The elements are all polynomials of degree over : that's elements.
The General Pattern
We can now state the fundamental theorem that underlies all of finite field cryptography:
Theorem. For every prime and positive integer , there exists a unique field with elements (up to isomorphism). It can be constructed as: where is any irreducible polynomial of degree over .
Different irreducible polynomials give the same field (up to relabelling elements), though the specific representation of elements differs. The choice of irreducible polynomial is like choosing a basis.
Crypto Foreshadowing: The AES Field GF(256)
The Advanced Encryption Standard (AES), the most widely used symmetric cipher in the world, performs all its internal arithmetic in .
Every byte (8 bits) is an element of this field. The specific irreducible polynomial used by AES is:
So .
Module 03 builds this field from scratch and uses it to implement AES operations. Everything you just learned, quotient rings, reduction mod an irreducible, multiplication tables, is exactly what AES does with bytes.
Exercises
Exercise 1: GF(4) Arithmetic by Hand (Fully Worked)
Problem: In , compute by hand, then verify with SageMath.
Solution:
Multiply as polynomials: (since in )
Reduce mod : compute
(remainder is , since in )
Answer: in GF(4)
Exercise 2: Build GF(16) (Guided)
Problem: Construct where is an irreducible polynomial of degree 4 over .
Steps:
Find an irreducible polynomial of degree 4 over
Build the quotient ring
List all 16 elements
Verify it is a field
Compute the inverse of
Exercise 3: Reducible vs Irreducible (Independent)
Problem: Over (the field with 3 elements), consider the two polynomials:
For each polynomial:
Determine whether it is irreducible over .
Build the quotient ring .
Determine if the result is a field.
If it is NOT a field, find a pair of zero divisors.
If it IS a field, verify by finding the inverse of every nonzero element.
Hint: To check irreducibility of a degree-2 polynomial, test all elements of as roots.
Summary
| Concept | Key idea |
|---|---|
| Quotient ring construction | mods polynomials by , exactly the way mods integers by |
| Elements are remainders | In with , elements are all polynomials of degree with coefficients in , giving exactly elements |
| Irreducible = field | The quotient is a field iff the modulus polynomial is irreducible. A reducible modulus gives zero divisors, just like a composite modulus in |
| The general pattern | |
| GF(4) and GF(8) by hand | Built as and , with complete addition and multiplication tables verified |
| The crypto connection | AES operates in . This is Module 03 |
Module 02 complete. You now have the algebraic foundations, rings, fields, polynomial arithmetic, irreducibility, and quotient rings, to understand how finite fields are built and used in cryptography.