On this page
You already know one finite field: remainders mod 7. Work only with 0 to 6 and you can add, subtract, multiply and divide (except by 0) without leaving those seven numbers. This post builds GF(4) with every sum and product written out, sketches GF(8), and shows where the same idea sits inside every QR code.
What is a finite field?
A finite field, also called a Galois field after Évariste Galois, is a set with finitely many elements where addition, subtraction, multiplication and division by non-zero elements all work by the usual rules (Finite field, Wikipedia). The field with q elements is written GF(q).
E. H. Moore proved in 1893 that a finite field of order q exists exactly when q is a prime power, and that any two of the same order are the same field with the elements renamed.
Why does arithmetic mod a prime give GF(p)?
Take the remainders mod 7. Sums and products wrap round: 4 + 5 = 9 = 2, and 3 × 5 = 15 = 1. So 5 is the reciprocal of 3, and dividing by 3 means multiplying by 5. Every non-zero remainder mod 7 has such a partner, because 7 shares no factor with 1 to 6.
Now try mod 6. Here 2 × 3 = 0, so 2 has no reciprocal: if 2y = 1, multiplying by 3 gives 0 = 3. The remainders mod n form a field exactly when n is prime. Mod 4 fails too (2 × 2 = 0), so GF(4) needs a different build.
How do you build GF(4) from x² + x + 1?
Start with GF(2) = {0, 1}, where 1 + 1 = 0. Take polynomials with coefficients 0 or 1 and work modulo x² + x + 1, as you worked modulo 7. This polynomial acts like a prime: it has no root in GF(2) (x = 0 and x = 1 both give 1), so it does not factor. The four possible remainders, 0, 1, x and x + 1, are GF(4), and the one rule you need is x² = x + 1 (minus equals plus when 1 + 1 = 0).
Addition: add coefficients mod 2, so every element plus itself is 0.
0 + a = a, and a + a = 0, for every element a
1 + x = x + 1, 1 + (x + 1) = x, and x + (x + 1) = 1
Multiplication: multiply as polynomials, then replace x² by x + 1.
0 × a = 0 and 1 × a = a
x × x = x² = x + 1
x × (x + 1) = x² + x = (x + 1) + x = 1
(x + 1) × (x + 1) = x² + 2x + 1 = x² + 1 = x
So x and x + 1 are each other's reciprocals, and 1 is its own: every non-zero element can be divided by, so this is a field. The powers of x run x, x + 1, 1, so x cycles through all three non-zero elements, just as a primitive root does mod 7.
Why must the size of a finite field be a prime power?
Keep adding 1 to itself. In a finite set the sums must repeat, so some count of ones gives 0. The first such count p is prime: if p = ab with a and b smaller than p, then (a ones) × (b ones) = 0, so one factor would already be 0.
So the field contains a copy of GF(p) and is a vector space over it: you can add elements and scale them by 0 to p − 1.
With a basis of n elements, each element is one combination with p choices per coordinate: pⁿ elements. Our post on the change-of-basis matrix is a refresher on bases.
For GF(4) the basis is {1, x}, with 2 choices each: 2² = 4. So no field has 6 or 10 elements. Moore's theorem gives the other direction: every prime power occurs (Finite field, Wikipedia).
Try it yourself: how do you build GF(8)?
Use GF(2) polynomials modulo x³ + x + 1. It has no root: x = 0 gives 1, and x = 1 gives 1 + 1 + 1 = 1.
List the 2³ = 8 remainders: 0, 1, x, x + 1, x², x² + 1, x² + x, x² + x + 1.
Use x³ = x + 1 to compute powers of x: x⁴ = x² + x, x⁵ = x² + x + 1, x⁶ = x² + 1, x⁷ = 1.
All seven non-zero elements appear, so multiplying is adding exponents mod 7: x⁴ × x⁵ = x⁹ = x².
Check with group theory: the seven non-zero elements form a group, so every one satisfies a⁷ = 1, as our post on Lagrange's theorem and group order predicts.
If polynomial division is the shaky step, the Fermi Concept Library covers every concept in mathematics, and the Fermi Problem Library has a step-by-step solver that explains the reasoning.
Where are finite fields used in QR codes and error correction?
QR codes repair damage with a Reed–Solomon code added to the data (QRcode.com, Denso Wave). I. S. Reed and G. Solomon published the method in 1960 as "Polynomial codes over certain finite fields" (Journal of the Society for Industrial and Applied Mathematics).
Each byte of a QR code is one element of GF(256) = GF(2⁸), and products are reduced modulo the bit pattern 100011101, the polynomial x⁸ + x⁴ + x³ + x² + 1 (Thonky QR code tutorial). Bytes fit GF(256) because 256 = 2⁸ is a prime power; the remainders mod 256 are not a field, since 2 has no reciprocal.
Reed–Solomon needs two extra codewords for every codeword it corrects. The four levels restore about 7% (L), 15% (M), 25% (Q) and 30% (H) of codewords (QR code, Wikipedia), and Denso Wave says level M is the one most often chosen (QRcode.com, Denso Wave).
Next time a scuffed QR code still scans, the arithmetic you used for GF(4) is doing the repair, with 256 elements instead of 4.



