## Polynomial Arithmetic with Rests

First, we define an univariate polynomial:

poly: x^6 +19*x^5 + x^4 - 14*x^3 - x^2 - 3*x + 1;

6 5 4 3 2
x + 19 x + x - 14 x - x - 3 x + 1

To convert this polynomial into one with coefficients that are
rests modulo 11, we use the function **mod**:

mod(poly, 11);

And we get this result:

6 5 4 3 2
x - 3 x + x - 3 x - x - 3 x + 1

if set to a positive prime p, then all arithmetic in the rational function routines will be done modulo p. That is all integers will be reduced to less than p/2 in absolute value (if p=2 then all integers are reduced to 1 or 0). This is the so called "balanced" modulus system, e.g. N MOD 5 = -2, -1, 0, 1, or 2.

To factor the polynomial **poly** modulo 11, we have to add the
option **modulus:11** to the command **factor**:

factor(poly), modulus:11;

and obtain

2 3 2
(x + 1) (x + 5 x + 3) (x + 2 x + 3 x + 4)

Expansion of that product is performed over the integers:

expand(%)

6 5 4 3 2
x + 8 x + 23 x + 41 x + 54 x + 41 x + 12

Reduction modulo 11 gives the polynomial that we obtained
by reduction of **poly**:

mod(%, 11)

6 5 4 3 2
x - 3 x + x - 3 x - x - 3 x + 1