# 4. Mixed operations with integers or constants of the base field.

Let GF9 be a Galois field of order 9 with base field GF3. Regular representations of GF3 , 0, 1, 2 correspond to those of GF9. So

```GF3[2] + GF9[7]

GF9[6]

and

GF9[2] + GF9[7]

GF9[6]
```
have the same results. If you consider that GF9 is the 3-dimensional vector space over GF3, then addition of vectors and scalar product work as a vector space without any modification.

The Galois Field Package allows addition and multiplication with integers. An integer k in a mixed expression is recognized as Sum[GF9[1],{i,k}], when we compute in GF9. Hence k is translated to the regular representation k (mod p), where p is the characteristic of the field.

```3 + GF9[4]

GF9[4]

4 GF9[3]

GF9[3]

DeclareVariables[GF9,x]

5 x

x GF9[2]
```
This feature guarantees that the next theorem works for both variables and algebraic variables.

Theorem 3. (x+y)p = xp + yp over a finite field with characteristic p.

```Expand[ (x+y)^3]            ( x, y are variables of GF9 )

3    3
x  + y

Expand[ (X + Y)^3]          (X, Y are algebraic variables of GF9)

3    3
X  + Y

Expand[ (u + v)^3 ]         ( u, v are just symbols in Mathematica)

3      2          2    3
u  + 3 u  v + 3 u v  + v
```
And also Derivation over a finite field works.
```DeclareVariables[GF9,a,b,c]

DeclareAlgebraicVariables[GF9,X]

D[a X^2 + b X + c, X]

b + a X GF9[2]```