# 1. Concept of the Galois Field Package

Consider a finite field with the order of a prime power number. Let f(x)=x 3+x+1 be a polynomial over GF(2) which is an irreducible polynomial. Using the modulo x3+x+1, we can reduce x0 , x1 , x2 , ... to polynomials with degree less than 3.

```Exponential   Polynomial              Vector               Regular

0               0                      (000)                   0
x0=1            1                    	(100)                  1
x1              x                    	(010)                  2
x2              x2                   	(001)                	4
x3              1+x                  	(110)                	3
x4             x+x2                  	(011)                	6
x5            1+x+x2                 	(111)                	7
x6             1+ x2     	        (101)                	5

```
The first and second columns are called exponential and polynomial representations, respectively. The third column contains the triples of coefficients of the polynomial representations, called the vector representation. The last column, called regular representation, contains the integer representations of vectors which are regarded as binary numbers. This finite field is said to be an extension field of degree 3 of GF(2) and is written GF(23). Then the field GF(2) is called the base field of GF(23).
When we declare a finite field, we name the field using the following rules:
• The first character must be a letter.
• It is not allowed to use a symbol (a string) which is used in Mathematica.
• You will get a warning message if you use a name with the length of one character .
It is called algebra name. We can use different algebra names for finite fields with the same order. Every element of a finite field, that is, a constant, has the following form:

algebra name[ integer ]

The integer in the form must be a regular representation of the finite field. For example, suppose we now have an algebra name K5 for GF(5), then we can write the following expressions:

```K5[2] + K5[4]

K5[1]

K5[2]^3

K5[3]

(K5[4] + K5[3] )^-1

K5[3]
```
In this case, the order of K5 is a prime, 5, therefore the integers that appear in the brackets [ ] are 0,1,..., or 4. In the case of a extension field GF(qn), the regular representation is used for the integers in the brackets. The regular representation has some advantages as listed below:
• 0 is the additive identity and 1 is the multiplicative identity for any field.
• In a finite field GF(qn) with the base field GF(q), 0,1,,..., q-1 are always the elements of its base field.
• In a finite field with characteristic p, {0, 1,..., p-1} is always a subfield ( prime field).
• Between an extension field of degree m and a extension field of degree n over GF(q), (m i , of homomorphism with respect to the additions.
Let K9 be the algebra name of GF(32). Then, for instance, K9[3] , K9[4], K 9[5], K9[6] are corresponding to vector representations (0,1), (1,1), (2,1), (0,2), respectively.
```K9[4] + K9[5]

K9[6]

K9[6]^-1

K9[7]

K9[3]^0

K9[1]
```
K9[0] is the additive identity and K9[1] is the multiplicative identity of K9. K[0], K9[1], K[2] are the elements of the base field GF(3) of K9. Algebra names are defined as Listable in Mathematica, therefore, it is easy to define a vector:
```K9[{1,3,5}]

{K9[1], K9[3], K9[5]}
```
Most of operations and functions of Mathematica is designed so that they act separately on each elements of a list. Therefore, if you declare two Galois fields, we can compute over a direct product of two Galois fields by writting two constants in a list.
```{K5[4], K9[6]}^4

{K5[1], K9[2]}```
You can input K9[0] as
```K9[0] K9[4]

0
```
however, if its result is zero then the output form is 0 instead of K9[0]. The reason is that some Mathematica functions, like Nullspace, Solve,... , may not understand K9[0] as 0. Therefore, when a result is zero in a Galois field , then this package always returns 0.

Mathematica does not request to declare algebra and variables (symbols ) before use those. But in the Galois field package, It is necesary to declare a name with attributes of a Galois field. Then constants of the Galois filed can be used. If you like to use a symbol which represent a element of the declared Galois field, then you have to declare it. You can also declare symbolic indeterminatcies which are called algebraic variables over the declared Galois field. When you add or multipy polynomials over a Galois filed, you can use the algebraic variables. Basic process of the Galois field package is in the following: