# 19 Polynomials

Let R be a commutative ring-with-one. A (univariate) Laurent polynomial over R is a sequence (..., c_{-1}, c_0, c_1, ...) of elements of R such that only finitely many are non-zero. For a ring element r of R and polynomials f = (..., f_{-1}, f_0, f_1, ...) and g = (..., g_{-1}, g_0, g_1, ...) we define f + g = (..., f_{-1} + g_{-1}, f_0+g_0, f_1+g_1, ...) , rcdot f = (..., r f_{-1}, r f_0, r f_1, ...), and f * g = (..., s_{-1}, s_0, s_1, ...), where s_k = ... + f_i g_{k-i} + .... Note that s_k is well-defined as only finitely many f_i and g_i are non-zero. We call the largest integers d(f), such that f_{d(f)} is non-zero, the degree of f, f_i the i.th coefficient of f, and f_{d(f)} the leading coefficient of f. If the smallest integer v(f), such that f_{v(f)} is non-zero, is negative, we say that f has a pole of order v at 0, otherwise we say that f has a root of order v at 0. We call R the base (or coefficient) ring of f. If f = (..., 0, 0, 0, ...) we set d(f) = -1 and v(f) = 0.

The set of all Laurent polynomials L(R) over a ring R together with above definitions of + and * is again a ring, the Laurent polynomial ring over R, and R is called the base ring of L(R). The subset of all polynomials f with non-negative v(f) forms a subring P(R) of L(R), the polynomial ring over R. If R is indeed a field then both rings L(R) and P(R) are Euclidean. Note that L(R) and P(R) have different Euclidean degree functions. If f is an element of P(R) then the Euclidean degree of f is simply the degree of f. If f is viewed as an element of L(R) then the Euclidean degree is the difference between d(f) and v(f). The units of P(R) are just the units of R, while the units of L(R) are the polynomials f such that v(f) = d(f) and f_{d(f)} is a unit in R.

GAP uses the above definition of polynomials. This definition has some advantages and some drawbacks. First of all, the polynomial (..., x_0 = 0, x_1 = 1, x_2 = 0, ...) is commonly denoted by x and is called an indeterminate over R, (..., c_{-1}, c_0, c_1, ...) is written as ... + c_{-1} x^{-1} + c_0 + c_1 x + c_2 x^2 + ..., and P(R) as R[x] (note that the way GAP outputs a polynomial resembles this definition). But if we introduce a second indeterminate y it is not obvious whether the product xy lies in (R[x])[y], the polynomial ring in y over the polynomial ring in x, in (R[y])[x], in R[x,y], the polynomial ring in two indeterminates, or in R[y,x] (which should be equal to R[x,y]). Using the first definition we would define y as indeterminate over R[x] and we know then that xy lies in (R[x])[y].

```    gap> x := Indeterminate(Rationals);; x.name := "x";;
gap> Rx := LaurentPolynomialRing(Rationals);;
gap> y := Indeterminate(Rx);; y.name := "y";;
gap> y^2 + x;
y^2 + (x)
gap> last^2;
y^4 + (2*x)*y^2 + (x^2)
gap> last + x;
y^4 + (2*x)*y^2 + (x^2 + x)
gap> (x^2 + x + 1) * y^2 + y + 1;
(x^2 + x + 1)*y^2 + y + (x^0)
gap> x * y;
(x)*y
gap> y * x;
(x)*y
gap> 2 * x;
2*x
gap> x * 2;
2*x ```

Note that GAP does not embed the base ring of a polynomial into the polynomial ring. The trivial polynomial and the zero of the base ring are always different.

```    gap> x := Indeterminate(Rationals);; x.name := "x";;
gap> Rx := LaurentPolynomialRing(Rationals);;
gap> y := Indeterminate(Rx);; y.name := "y";;
gap> 0 = 0*x;
false
gap> nx := 0*x;     # a polynomial over the rationals
0*x^0
gap> ny := 0*y;     # a polynomial over a polynomial ring
0*y^0
gap> nx = ny;       # different base rings
false ```

The result `0*x` neq `0*y` is probably not what you expect or want. In order to compute with two indeterminates over R you must embed x into R[x][y].

```    gap> x  := Indeterminate(Rationals);; x.name := "x";;
gap> Rx := LaurentPolynomialRing(Rationals);;
gap> y  := Indeterminate(Rx);; y.name := "y";;
gap> x  := x * y^0;
x*y^0
gap> 0*x = 0*y;
true ```

The other point which might be startling is that we require the supply of a base ring for a polynomial. But this guarantees that `Factor` gives a predictable result.

```    gap> f5 := GF(5);; f5.name := "f5";;
gap> f25 := GF(25);; f25.name := "f25";;
gap> Polynomial( f5, [3,2,1]*Z(5)^0 );
Z(5)^0*(X(f5)^2 + 2*X(f5) + 3)
gap> Factors(last);
[ Z(5)^0*(X(f5)^2 + 2*X(f5) + 3) ]
gap> Polynomial( f25, [3,2,1]*Z(5)^0 );
X(f25)^2 + Z(5)*X(f25) + Z(5)^3
gap> Factors(last);
[ X(f25) + Z(5^2)^7, X(f25) + Z(5^2)^11 ]```

The first sections describe how polynomials are constructed (see Indeterminate, Polynomial, and IsPolynomial).

The next sections describe the operations applicable to polynomials (see Comparisons of Polynomials and Operations for Polynomials).

The next sections describe the functions for polynomials (see Degree, Derivative and Value).

The next sections describe functions that construct certain polynomials (see ConwayPolynomial, CyclotomicPolynomial).

The next sections describe the functions for constructing the Laurent polynomial ring L(R) and the polynomial ring P(R) (see PolynomialRing and LaurentPolynomialRing).

The next sections describe the ring functions applicable to Laurent Ring Functions for Laurent Polynomial Rings).

Previous Up Next
Index

GAP 3.4.4
April 1997