Finite Field
Learn about modular arithmetic and finite fields with examples.
Modulo operation
Given , , and , we write
when divides (also denoted as ). Here, is referred to as the remainder.
Example
Given , find r.
One possible answer is because . This is because 5|(17-2), which is read as 5 divided by 15.
For the example above, we can find many other remainders, such as 7 and -3. This is because 5|(17-7) and 5|(17+3).
Finite field
A finite field is a field with a finite number of elements. Finite fields have many applications in data science and especially in cryptography. We usually define a finite field using modulo operation.
Galois field
A finite field having prime number of elements over mod is called a Galois field or prime field. A Galois field is usually referred to as , where is a prime number and .
Example
A set defined over mod makes a Galois field . This implies that after each operation on field, we apply mod on the result. For instance,
and
Let’s now provide verification of each property using Python code.
Axiom verification
We can prove the axiom verification by using mathematical arguments, but let’s verify it through code and test all the properties of the field .
Closure
We define the sum
function, which computes the sum of two elements of a field and then computes mod 5
of the result. We first make a list of the elements, S=[0,1,2,3,4]
, and then use itertools
to generate all possible pairs. The following code calls the sum
function on every possible pair of elements of S, verifying the closure axiom.
Similarly, we can test the closure under multiplication using mul
, which also first multiplies two numbers and then takes their modulus.
Below is the complete code for testing closure under and .
Get hands-on with 1400+ tech skills courses.