# 3. Variables on Galois fields

The Galois Field Package has two kinds of variables over finite fields. One is a variable which represents an element of a field. When we see in a mathematics book "for an element x of the field K" , the symbol x represents a constant of K. This variable works like an element of K and may be substituted by a constant later. The second kind of variable is called an indeterminate or an algebraic variable. The algebraic variable can never be substituted by a constant and dose not work like an element.

The following is a well known theorem on the Galois field:

Theorem 1. For any element c of GF(q), cq=c.

This theorem works for a variable which represents an element but not for an algebraic variable. When we declare variables which represent elements of the finite field K9.

```DeclareVariables[K9,x,y]
```
Since K9 is a finite field of order 9, the theorem 1 works like
```x^9

x

x^-10

-2
x
```
From the theorem 1, x9 = x in GF(9). Exponents of variable x in outputs can never be larger than 8 ( generally "order" - 1).

you can see algebra name in which a variable was declared by the function AlgebraName.

```AlgebraName[x^2-1]

K9
```
Mathematica does not print in the form " x0 ". Therefore, the Galois Field Package prints with the form
x Zero. The symbol Zero exactly works as the numeric number 0.
```x^0

Zero
x

% /. x-> K9

K9
```
Theorem 2. For any nonzero element d of GF(q), d(q-1) = 1.

The theorem 2 says that if x is an nonzero element of K9 then x8=1. The Galois Field Package have a declaration function for nonzero variable.

```NonZero[x]

x^{0,1,2,3,4,5,6,7,8,9,10}

2   3   4   5   6   7             2
{K9, x, x , x , x , x , x , x , K9, x, x }
```
You can compare with a ordinal variable y of K9.
```y^{0,1,2,3,4,5,6,7,8,9,10}

Zero      2   3   4   5   6   7   8      2
{y    , y, y , y , y , y , y , y , y , y, y }

{x , y }^16

8
{K9, y }
```
Note that 0-th power of 0 is indeterminate.
```K9^0

Power:K9^-1 and K9^0 are undefined

Indeterminate
```
Nonzero variables can also be declared by the NonZero option in the function DeclareVariables.
```DeclareVariables[K9,x, NonZero -> True]

Inverse[{{ x,1},{0,x}}]

1  K9       1
{{-, -----}, {0, -}}
x    2         x
x
```
Next, when we declare an algebraic variable, we use the function DeclareAlgebraicVariables or DeclareIndeterminates.
```DeclareAlgebraicVariables[K9,X,Y]
```
Using the algebraic variable, we can define a polynomial ring GF(9)[X]. Since algebraic variables are not elements of a finite field, the theorem 1 and 2 have no effect on X and Y.
```X^9

9
X
```
We define the 0-th power of an algebraic variable to be 1.
```X^0

K9
```
Since X, Y are indeterminate, you can not substitute a constant to these variables.
```X = K9

Set::wrsym: Symbol X is Protected.

K9
```
The Factor function of a polynomail over a Galois field is contained in the subpackage Factor.m
```<<Factor.m