3 Monomial orders and the division algorithm We address the problem of deciding which term of a polynomial is the leading term. We noted above that, unlike in the univariate case, the total degree does not solve this problem for multivariate polynomials. 3.1 Ordering the set of monomials The first point to make is that the set of monomials in the ring k[x 1,..., x n ] is in natural bijection with N n via (a 1,..., a n ) x a 1 1 x an n This is a semigroup isomorphism, in fact, meaning only that addition in N n corresponds under this map to multiplication of monomials. Because of this, it is very common to blur the distinction between N n and the set of monomials in k[x 1,..., x n ]. Definition 11 A monomial order > on k[x 1,..., x n ] is a total ordering on the set of monomials of k[x 1,..., x n ] having two additional properties: (1) m > 1 for every monomial m 1. (2) whenever m 1 > m 2 and n is a monomial, then nm 1 > nm 2. We will see a lot of examples of monomial orders in a moment, but note first in passing that a monomial order gives a natural way to identify the leading term of a polynomial, which is what we really wanted. Definition 12 Let > be a monomial order on k[x 1,..., x n ]. For f = a m m k[x 1,..., x n ] define the leading monomial of f to be LM(f) = max > {m : a m 0}. Also define the leading term of f as LT(f) = a m m and the leading coefficient of f as LC(f) = a m, where LM(f) = m. Of course, the max > in this definition simply means take the largest element of the finite set of monomials {m : a m 0} with respect to the monomial order >. The most important monomial orders of them all There are, in fact, infinitely many monomial orders on k[x 1,..., x n ] (at least when n 2), and a great many of them are useful. But three stand out from the crowd. We define these now, and we will use them almost exclusively when calculating examples for most of these notes. Definition 13 The lexicographic order > lex on k[x 1,..., x n ] with x 1 > lex x 2 > lex > lex x n is defined as follows: for two non-equal monomials x a 1 1 x an n > lex x b 1 1 x bn n if and only if a i > b i where i is the smallest number in {1,..., n} for which a i b i. 1
The phrase lexicographic order is usually abbreviated to lex. As with all orders, we are not confused by writing m 2 < m 1 as a synonym for m 1 > m 2, even though we only defined the latter. Lex is an intuitive monomial order. A monomial m 1 is bigger than m 2 if the power of x 1 appearing in m 1 is greater than that appearing in m 2. Of course, x 1 may appear to the same power in both monomials, in which case you compare the power of x 2 in each monomial. If those are also equal, then you look at the power of x 3, and so on. Notice that lex has nothing much to do with the total order of a monomial: x 1 > lex x 100 2, for instance. When the names of the variables are ordinary letters, such as in the ring k[x, y, z], it is tempting to think of lex order as being alphabetical order. For instance, with the lex order on k[x, y, z] with x > lex y > lex z, it is certainly true that xy > lex xz, and it is also true that these two words are in alphabetical order and accordingly xy would appear in the dictionary before xz if it could. But this is not a rule: xy comes before xyz in the dictionary but xyz > lex xy. Notice, too, that we cannot write a list of monomials in increasing lex order, at least not in the usual way: in k[x, y, z], the lex order would give 1 < z < z 2 < < y < yz < < y 2 < y 2 z < < x < xz <... where in each case the dots replace infinitely many monomials. It is convenient to express the definition of the lex order in terms of tuples of exponents in N n : if a = (a 1,..., a n ) and b = (b 1,..., b n ), then a > lex b if and only if the leftmost nonzero entry of the vector a b is positive. It is important to remember that the lex order involves fixing in advance some sequential order on the variables. In the definition we have decided that x 1 is bigger than x 2, which is bigger than x 3 and so on, when measured by > lex. We could have chosen a different sequential order on the variables, and indeed there is a lex order, defined in exactly the same way, for any choice of sequential order. Definition 14 Let σ Sym(n) be a permutation of {1,..., n}. The lexicographic order > lex,σ on k[x 1,..., x n ] with respect to σ is defined as follows: for two nonequal monomials x a 1 1 x an n > lex,σ x b 1 1 x bn n if and only if a σ(i) > b σ(i) where i is the smallest number in {1,..., n} for which a σ(i) b σ(i). Two graded monomial orders The next monomial order involves a very small twist on the lex order in sympathy with our instinct that the total order of a monomial ought to be an important part of deciding which of two monomials is the bigger. Definition 15 The graded lexicographic order > glex on k[x 1,..., x n ] with x 1 > glex > glex x n 2
is defined as follows: m 1 > glex m 2 if and only if deg m 1 > deg m 2, or deg m 1 = deg m 2 and m 1 > lex m 2. The phrase graded lexicographic order is usually abbreviated to glex, grlex or dlex (where the d stands for degree ). In this order, we can write down monomials in an increasing list: in k[x, y, z] we write 1 < z < y < x < z 2 < yz < y 2 < xz < xy < x 2 < z 3 <. There is a third starring monomial order, called the graded reverse lexicographic order and denoted > grevlex, which appears prominantly because it has good computational properties. It is easiest to define > grevlex in N n first: if a = (a 1,..., a n ) and b = (b 1,..., b n ), then a > grevlex b if and only if the rightmost nonzero entry of the vector a b is negative. The corresponding monomial order (with some choice of order of the variables) follows as for lex. The phrase graded reverse lexicographic order is usually abbreviated to grevlex. With respect to grevlex, we can again write down monomials in an increasing list: in k[x, y, z] we write 1 < z < y < x < z 2 < yz < xz < y 2 < xy < x 2 < z 3 < which is different from the glex order. 3.2 The division algorithm and reduction Example 1 Consider the lex order (with x > y) on k[x, y]. We divide f by the pair of polynomials f 1, f 2, comparing leading terms and subtracting as usual. Since LT(f) = xy 2 and LT(f 1 ) = y 2, we compute f xf 1 = xy + x + y 3 + 1. This has leading term xy which is not divisible by LT(f 1 ), but it is divisible by LT(f 2 ) so we compute f yf 1 f 2 = x + y 3. This has leading term x, and this is not divisible by either LT(f 1 ) or LT(f 2 ). When doing long division for univariate polynomials, we would stop now and declare x + y 3 to be the remainder after division. But we do not do that here. Instead, we move x into the remainder, and continue working on the rest of the polynomial. So we set the remainder r to be x, at least for the time being. What is left is y 3. This is divisible by LT(f 1 ) and so we compute y 3 yf 1 = y. This has leading term y, which again is not divisible by either leading term. So we add y to the remainder: r = x + y. There is nothing left, so see that f = (x + y)f 1 + f 2 + r, where r = x + y. This is the complete division with remainder, although we must admit that it has not yet given the expression f = yf 1 + (y + 1)f 2 that we might have been hoping for. 3
As an array, we work out this calculation as follows. f 1 : y 2 1 f 2 : xy + 1 ) q 1 : x + y q 2 : 1 f : xy 2 + xy + y 3 + 1 xf 1 : xy 2 x xy + x + y 3 + 1 f 2 : xy + 1 x + y 3 r : x + y At this point we add x to the remainder and continue with y 3 as the working polynomial. During the division process, a term under consideration is added to the remainder r exactly when there is no LM(f i ) that divides it. So no term of the resulting remainder r is divisible by any LM(f i ). Definition 16 Let f 1,..., f s k[x 1,..., x n ]. A polynomial g k[x 1,..., x n ] is reduced with respect to {f 1,..., f s } if and only if for every term t in g there is no f i such that LT(f i ) divides t. Notice that, by definition, a polynomial is reduced with respect to a set of polynomials: the order of f 1,..., f s does not matter in the definition. We formalise the division process used in the example above as an algorithm. Algorithm 1 (The division algorithm) input f 1,..., f s, f k[x 1,..., x n ] output q 1,..., q s k[x 1,..., x n ] and r k[x 1,..., x n ] reduced w.r.t. f 1,..., f s start q 1 := 0,..., q s := 0, r := 0, q := f repeat i := 1 repeat if LT(f i ) divides LT(q) then q i := q i + LT(q)/ LT(f i ) q := q LT(q)/ LT(f i )f i i := n + 2 else i := i + 1 end if until i n + 1 if i = n + 1 then q := q LT(q) r := r + LT(q) end if until q = 0 4
Proof of Algorithm 1 We must check that every calculation can be performed, that the algorithm does terminate, and that the final values of the q i and r are as claimed. Since we work in a ring, the only troublesome arithmetic operation is division. But the algorithm only ever divides by a term, and then only after checking that the division works; so there is no problem there. There are two ways of coming out of the repeat loop lines 3 to 11: either no LT(f i ) divided LT(q) and i clocked up to n + 1, or some division did take place and i was set by force to n + 2. In the former case, the leading term of q is moved to the remainder r, so the leading term of q reduces. In the latter case, the leading term of q is removed again, because this time we use some f i to cancel it. We need to check that r is reduced at the end of the algorithm. But this is clear: a term is only added to r during the algorithm if it is not divisible by the leading term of any f i, and this is what it means to be reduced. Q.E.D. We can formulate the division algorithm as a theorem. Theorem 17 Fix a monomial order on k[x 1,..., x n ] and polynomials f 1,..., f s k[x 1,..., x n ]. Then for any f k[x 1,..., x n ] there are polynomials q 1,..., q s, r k[x 1,..., x n ] such that f = q 1 f 1 + + q s f s + r where r is reduced with respect to {f 1,..., f s }. Proof The division algorithm returns such an expression, and we have already noted that the remainder is reduced as claimed. Q.E.D. This theorem is a little bit weaker than the division algorithm. The point is that the division algorithm is deterministic: if you run it twice with the same input it will return the same collection of polynomials q 1,..., q s, r and moreover they will satisfy LT(f) LT(q i ) LT(f i ) for each i = 1,..., s. However, the theorem does not claim that these polynomials are uniquely determined for given input, which is good because they certainly are not. So while it is tempting to define f mod f 1,..., f s to be the remainder r guaranteed by the theorem, this is not well defined. But we can use the division algorithm itself to make this definition. Definition 18 The reduction of f by f 1,..., f s is the polynomial r returned by the division algorithm, Algorithm 3.2, which is applied strictly and with the f i in the given order. This reduction is denoted by either f f 1,...,f s or f mod f1,..., f s, and the division algorithm process is denoted by f f 1,...,f s + r. The division algorithm has some idiosyncracies. If you change the order of the polynomials f 1,..., f s, the resulting quotients q i and remainder r will change. In fact, even if f = p i q i is expressed in terms of the f i with no remainder, it may happen that the division algorithm computes a different expression in which the remainder is nonzero. In the end, we will want to assign a meaning to the remainder after division of a polynomial f by the whole ideal generated by f 1,..., f s, and this 5
seems to defy us at the very first step. Indeed, setting I = (f 1,..., f s ) and f is a polynomial, then if r = 0 after division we know that f I, but the converse does not hold. This problem cannot be solved directly. Instead, we will characterise those sets of polynomials for which the problem does not happen. Example 1 (continued) Check that using the division algorithm to divide f by f 2, f 1 in that order yields the expression f = yf 1 + (y + 1)f 2. The divisors and remainder in this expression are not the same as those for f divided by f 1, f 2. Homework Exercise 1 Write the following monomials in decreasing order with respect to the lexicographic monomial order with x 1 > x 2 > x 3 : x 3 1x 2 2x 3, x 3 2, x 3, x 3 1x 2 2, x 9 1, x 2 2x 3. Repeat it with glex and grevlex, and also change the starting order on the x i, for example to x 2 > x 3 > x 1. Exercise 2 (Recall the bijection between monomials of k[x, y] and N 2.) Sketch the region of N 2 that consists of monomials m satisfying m x 2 y 3 with respect to the lex monomial order with x < y. Repeat with glex and grevlex, both with x < y and x > y. Exercise 3 Carry out the division algorithm for f divided by f 1, f 2 of the example in the text several different times using lex, glex and grevlex and both x > y and y > x and choosing either f 1 first or f 2 first. How many different division expressions with remainder do you get? Exercise 4 Let f 1 = x t 3, f 2 = y t 2 and f = x 2 y 3. Compute the division of f by f 1, f 2 with respect to the lex order x > y > t. Predict the usual variations and carry them out if necessary. 6