Using Maple to Construct Finite Fields In this section, we will show how Maple can be used to construct the non-zero elements as powers of a in a finite field Zp [ x ] / p( x ) for prime p and primitive polynomial p(x) in Zp [ x ] . Example 1 2 We will begin by defining the polynomial p( x )x x2 in Z3 [ x ] used to construct the field elements. > p := x -> x^2 + x + 2; p := xx 2x2 We can use the Maple Irreduc function as follows to verify that p(x) is irreducible in Z3 [ x ] . The following command will return true if p(x) is irreducible in Z3 [ x ] , and if it is not false if it is not. > Irreduc(p(x)) mod 3; true Z Z Thus, p(x) is irreducible in 3 [ x ] , and 3 [ x ] / p( x ) is a field. However, in order for us to be able to construct all of the nonzero elements in this field as powers of a, it must be the case that p(x) is also primitive. We can use the Maple Primitive function as follows to verify that p(x) is primitive in Z3 [ x ] . The following command will return true if p(x) is primitive in Z3 [ x ] , and, if it is not, false. > Primitive(p(x)) mod 3; true Thus, p(x) is primitive in Z3 [ x ] . To construct the nonzero elements in Z3 [ x ] / p( x ) as powers of a, we can use the Maple Powmodfunction. For example, the following command returns the field element that 6 corresponds to a in Z3 [ x ] / p( x ) . > Powmod(a, 6, p(a), a) mod 3; a2 The operation performed as a consequence of the preceding command is the primitive element a given in the first parameter raised to the power 6 given in the second parameter, with the output displayed after the result is reduced modulo the third parameter p(x) defined over the specified coefficient modulus 3. The fourth parameter is the variable used in the first and third parameters. Recall the given a finite field generated by a primitive polynomial p(x), the number of non-zero degree ( p( x ) ) 1 . For example over Z3 [ x ] with polynomial elements of the finite field is p p( x )x 2x2 , p = 3 and degree(p(x)) = 2. We will now use a Maple for loop to construct and display the 2 non-zero field elements that correspond to each of the first 3 18 powers of in a in Z3 [ x ] / p( x ) . Note that since p(x) is primitive and Z3 [ x ] / p( x ) only has a total of 8 nonzero elements, this will cause each of the nonzero elements in Z3 [ x ] / p( x ) to be displayed exactly once. In the following commands, we store the results returned by Powmod for each of the first 8 powers of a in the variable temp, and display these results using the Maple print command. Note where we use colons and semicolons in this loop, and note also that we use back ticks ( `) in the print statement. > for i from 1 to 3^(degree(p(x)))- 1 do > temp := Powmod(a, i, p(a), a) mod 3: > print(a^i, ` Field Element: `, temp); > od: a, Field Element: , a 2 a , Field Element: , 2 a1 a 3, Field Element: , 2 a2 a 4, Field Element: , 2 a 5, Field Element: , 2 a a 6, Field Element: , a2 a 7, Field Element: , a1 a 8, Field Element: , 1 > Example 2 5 3 We will begin by defining the polynomial p( x )x x 1 in Z2 [ x ] used to construct the field elements. > p := x -> x^5 + x^3 + 1; p := xx 5x 31 We can use the Maple Irreduc function as follows to verify that p(x) is irreducible in Z2 [ x ] . The following command will return true if p(x) is irreducible in Z2 [ x ] , and if it is not false if it is not. > Irreduc(p(x)) mod 2; true Z Z Thus, p(x) is irreducible in 2 [ x ] , and 2 [ x ] / p( x ) is a field. However, in order for us to be able to construct all of the nonzero elements in this field as powers of a, it must be the case that p(x) is also primitive. We can use the Maple Primitive function as follows to verify that p(x) is primitive in Z2 [ x ] . The following command will return true if p(x) is primitive in Z2 [ x ] , and, if it is not, false. > Primitive(p(x)) mod 2; true Thus, p(x) is primitive in Z2 [ x ] . Recall the given a finite field generated by a primitive polynomial p(x), the number of non-zero degree ( p( x ) ) 1 . For example over Z2 [ x ] with polynomial, elements of the finite field is p p( x )x 5x 31 , p = 2, and degree(p(x)) = 5. We generate the finite field using the following for loop. > for i from 1 to 2^(degree(p(x)))- 1 do > temp := Powmod(a, i, p(a), a) mod 2: > print(a^i, ` Field Element: `, temp); > od: a, Field Element: , a a 2, Field Element: , a 2 a 3, Field Element: , a 3 a 4, Field Element: , a 4 a 5, Field Element: , a 31 a 6, Field Element: , a 4a a 7, Field Element: , a 3a 21 a 8, Field Element: , a 4a 3a a 9, Field Element: , a 4a 3a 21 a 10, Field Element: , a 4a1 a 11, Field Element: , a 3a 2a1 a 12, Field Element: , a 4a 3a 2a a 13, Field Element: , a 4a 21 a 14, Field Element: , a1 a 15, Field Element: , a 2a a 16, Field Element: , a 3a 2 a 17, Field Element: , a 4a 3 a 18, Field Element: , a 4a 31 a 19, Field Element: , a 4a 3a1 a 20, Field Element: , a 4a 3a 2a1 a 21, Field Element: , a 4a 2a1 a 22, Field Element: , a 2a1 a 23, Field Element: , a 3a 2a a 24, Field Element: , a 4a 3a 2 a 25, Field Element: , a 41 a 26, Field Element: , a 3a1 a 27, Field Element: , a 4a 2a a 28, Field Element: , a 21 a 29, Field Element: , a 3a a 30, Field Element: , a 4a 2 a 31, Field Element: , 1 > Exercises 1. For each of the following polynomials p( x ) , all of whom are primitive in Z2 [ x ] , construct the field elements that correspond to powers of a in Z2 [ x ] / p( x ) . 5 3 a. p( x )x x 1 6 5 b. p( x )x x 1 7 c. p( x )x x1 8 4 3 2 d. p( x )x x x x 1 2. For each of the following polynomials p( x ) , both of whom are primitive in Z5 [ x ] , construct the field elements that correspond to powers of a in Z5 [ x ] / p( x ) . 5 a. p( x )x 4 x2 7 b. p( x )3 x 4 x1 3. Find a primitive polynomial of degree 4 in Z3 [ x ] , and use this polynomial to construct the nonzero elements in a finite field. 4. Find a primitive polynomial of degree 2 in Z11 [ x ] , and use this polynomial to construct the nonzero elements in a finite field. 5. Use a primitive polynomial to construct the nonzero elements in a finite field of order 127.