15-355: Modern Computer Algebra 1
Gröbner Bases Victor Adamchik Carnegie Mellon University
Buchberger's algorithm Theorem. (Buchberger's S-pair criterion)
A finite set G = g1, ..., gs for an ideal I is a Gröbner basis if and only if * S gk, gn G 0
(the remainder of8 division S< gk , gn by G is zero) for any k and n. H L H L Buchberger's algorithm Fix a monomial order.
A Gröbner basis G for ideal I = < f1, ..., fs > is obtained by the following procedure: * 1. for each i and j execute S fi, f j G ri j
2. if all remainders are zero, return f1, ..., fs
3. otherwise add ri j to basis IG andM goto step 1 This procedure gives us an ascending chain of ideals that must eventually stop growing because
F x1, ..., xn is Noetherian. This proves that algorithm terminates. Unfortunately, there is no bound on the running time.
In@put: A polynomialD set F = f1, ..., fs that generates an ideal I
Output: A Gröbner basis G = g1, ..., gr that generates I. G := F 8 <
M := set of pairs fi, f j where8 fi and f j are< in G. WHILE (M<>Ø) DO {p, q} := 8a pair
M := M U fi, R for all gi in G G := G U R 8 < 8 < Input: A polynomial set F = f1, ..., fs that generates an ideal I
Output: A Gröbner basis G = g1, ..., gr that generates I. G := F 8 <
M := set of pairs fi, f j where8 fi and f j are< in G. 2 Groebner Bases WHILE (M<>Ø) DO {p, q} := 8a pair
M := M U fi, R for all gi in G G := G U R 8 < à Example 1 8 < Consider the ideal < x2 - y, x3 - z > and build a Gröbner basis wrt to lex order x > y > z. We start with computing
3 3 S x2 - y, x3 - z = x * x2 - y - x * x3 - z = -x y + z x2 x3 2 Its leading term x y is not contained in < LM f1 , LM f2 > = < x >, therefore we must add it to the basis, which is nowI is M I M I M < x2 - y, x3 - z, -x y + z > H L H L Now we compute
2 2 S x2 - y, -x y + z = x y * x2 - y - x y * -x y + z = x z - y2 x2 -x y We add it to the basis, which now is I < x2M- y, x3 -I z, -xM y + z, x zH- y2 > L Keep computing
S f2, f3 = z * f1
S f1, f4 = y * f3
S f2, H f4 = L x y + z * f3
3 2 SHf3, f4 L = y - z The last has leading term that is not in < xH2, x y,L x z H>.AddingL the new generator completes the Gröbner basis H L < x2 - y, x3 - z, -x y + z, x z - y2, y3 - z2 > You check this by computing S-polynomials. 15-355: Modern Computer Algebra 3
GroebnerBasis x2 - y, x3 - z , x, y, z , MonomialOrder ® Lexicographic
A9 = 8 < y3 - z2, -y2 + x z, x y - z, x2 - y E
à Example9 2 = Compute a Gröbner basis for the ideal < x y3 - x2, x3 y2 - y > wrt to graded lex order x > y .
3 3 3 3 S x y3 - x2, x3 y2 - y = x y * x y3 - x2 - x y * x3 y2 - y = -x4 + y2 x y3 x3 y2
4 Its leading term x is not contained in < LM f1 , LM f2 >, therefore we must add it to the basis, which is now is I M I M I M < x y3 - x2, x3 y2 - y, -x4 + y2 > H L H L Now we compute
4 2 4 2 S x3 y2 - y, -x4 + y2 = x y * x3 y2 - y - x y * -x4 + y2 = y4 - x y x3 y2 -x4
4 It's leading term y is not contained in < LM f1 , LM f2 , LM f3 >, therefore we must add it to the basis. I M I M I M
4 3 4 3 S x y3 - x2, -x4 + y2 = x y * x y3 - x2 - x y * -x4 + y2 = -x5 + y5 x y3 H L H L -x4 H L
5 5 5 2 -x + y ®-x4+y2 = y - x y ®y4-x y = 0 I M I M I M The basis now is < x y3 - x2, x3 y2 - y, -x4 + y2, y4 - x y > Next we compute
4 4 S x y3 - x2, y4 - x y = x y * x y3 - x2 - x y * y4 - x y = 0 x y3 y4
4 4 4 4 4 2 4 x y 4 2 x y 4 6 5 S -x + y , y - x y = 4 * -x + y - 4 * y - x y = - y + x y I -M x I M y I M 6 5 5 3 - y + x y ®y4-x y = x y - x y ®-x4+y2 = 0 I M I M I M 4 Groebner Bases
GroebnerBasis x y3 - x2, x3 y2 - y , x, y , MonomialOrder ® DegreeLexicographic
A9 = 8 < x y - y4, -x2 + x y3, -x4 + y2, -y + x3 y2 E
à Timing9s =
Clear x, y, z ; polys = x6 + y4 + z3 - 1, x5 + y3 + z2 - 1 ; gb = Timing GroebnerBasis polys, y, z, x ; First gb , Length gb 2 @ D 9 =
0.063, 7 @ @ 8
gb8 = Timing< GroebnerBasis polys, z, y, x ; First gb , Length gb 2
1.33357 ´ 10-@17, 5 @ 8
gb9 = Timing GroebnerBasis= polys, x, y, z ; First gb , Length gb 2
1.422, 11 @ @ 8
gb8 = Timing< GroebnerBasis polys, y, z, x , MonomialOrder ® DegreeLexicographic ; First gb , Length gb 2 @ @ 8 <
1.661 ´ 10-16, 2 DD 8 @ D @ @@ DDD<
9 = 15-355: Modern Computer Algebra 5
gb = Timing GroebnerBasis polys, x, y, z , MonomialOrder ® DegreeReverseLexicographic ; First gb , Length gb 2 @ @ 8 < 0., 3 DD 8 @ D @ @@ DDD<
8 < à Monomial orders
GroebnerBasis x + y + z, x - 2 y + z^3, x^2 - 2 y^3 + z , x, y, z
Reverting the order of the @variables8 gives now one univariate polynomial in x.< 8 Calculating a Gröbner basis@8 is typically a very time consuming process for larger< polynomial sys- 8 GroebnerBasis x^7 + y^5 + z^2, x - 2 y^3 + 5 z^3, x^2 - 7 y^3 + z^4 , z, y, x , MonomialOrder -> Lexicographic ; Timing @8 < 8 < GroebnerBasis x^7 + y^5 + z^2D, x- 2 y^3 + 5 z^3, x^2 - 7 y^3 + z^4 , z, y, x , MonomialOrder -> DegreeReverseLexicographic ; Timing @8 The DegreeReverseLexicographic< 8is not directly< useful for equation solving. But it is very useful D for detecting an inconsistent system of equations. For eliminating variables the term order MonomialOrder -> EliminationOrder is often the most appropriate one. GroebnerBasis x - s t^2 + s, y - s^2 + t^2, z - s^3 + t , z, y, x , s, t , MonomialOrder -> EliminationOrder @8 < 8 < 8 < D 6 Groebner Bases à Coefficients Growth In[4]:= eqs = 2 x4 y + x3 y3 - x z2 + 1, x2 + y2 z3 - 1, x2 y - 7 y3 z2 + y2 z3 ; In[5]:= gb = GroebnerBasis9 eqs, x, y, z ; = In[6]:= Exponent ð, x, y@, z 8& gb Out[6]= 0, 0, 44 , 0, 1, 43 , 1, 0, 43 @ 8 In[7]:= 8Max8 Abs Cases< 8 gb, _Integer< 8 , 3 << Out[7]= 660 315 050 284 902 405 127 753 569 085 965 903 934 655 262 562 978 197 853 379 515 @ @ @ DDD 017 909 418 018 128 358 017 411 114 728 904 394 324 209 494 316 198 167 365 922 715 648 404 225 906 493 353 093 640 012 381 786 701 916 234 271 606 424 340 544 687 009 397 545 950 038 307 082 551 077 348 818 498 311 022 761 249 117 137 174 194 545 028 à Minimal Gröbner basis Buchberger's algorithm does not guarantee that obtained basis will be unique. There are two places in the algorithm where we make choices: a) the order of polynomials in the basis b) in the while loop: {p, q} := a pair in M - we choose two polynomials at random. Definition. A Gröbner basis is called minimal if all LC gk = 1 and for all i ¹ j LM gi does not divide LM g j . How to obtain a minimal basis? We must eliminate all gHi forL which there exists H L j ¹ i such thatI MLM g j divides LM gi .The minimal basis is not unique as well. Example. Consider a basis (lex order y > x). I M Definition. A Gröbner basis is called reduced if all LC gk = 1 and each gi is reduced with respect to G - gi H L 8 < 15-355: Modern Computer Algebra 7 Definition. A Gröbner basis is called reduced if all LC gk = 1 and each gi is reduced with respect to G - gi Lemma. Let G = g1, ..., gs be a minimal Gröbner basis.H L Consider the following reduction process 8 < g1 ®H1 h1 , where H1 = g2, ..., gs 8 gs ®Hs hs , where Hs =8 h1, h2, ..., hs-1 < Then H = h1, h2, ..., hs is a reduced Gröbner basis Theorem (Buchberger) Fix a monomial order. Then every8 non-zero ideal< has a unique reduced Gröbner basis 8 < Example.Consider a basis < y2 + y x + x2, y + x, y, x2, x > We constructed two minimal bases < y, x > and < y + x, x >. The last one is not reduced, we can reduce y + x to y using x. Buchberger's Refined Algorithm Here we will discuss some improvements on the Buchberger algorithm. The most expensive opera- tion in the algorithm is the reduction of the S-polynomials modulo G. Buchberger developed two criterias for detecting 0-reductions a priori. He also developed other strategies that significantly speed up the calculations. Buchberger's First Criteria. If LCM LM p , LM q = LM p * LM q then * H H LS p, Hq LLG 0 H L H L This means that we can ignore those pairs whose leading monomials are relatively prime. Buchberger's Second Criteria. H L If, when considering the pair { fi, f j}, there exist an element fk such that LCM(LM( fi), LM( f j)) is a multiple of LM( fk) and S( fi, fk) and S( f j, fk) have already been computed 8 Groebner Bases then * S fi, f j G 0 Another strategy. Always select pairs { fi, f j} such that LCM ILM fiM , LM f j is as small as possible. Example: Buchberger's Refined Algorithm à I H L I MM Consider the ideal < x2 + 2 x y, x y + 2 y2 - 1 > and compute its Gröbner basis wrt to lex order x > y. 2 2 S x2 + 2 x y, x y + 2 y2 - 1 = x y * x2 + 2 x y - x y * x y + 2 y2 - 1 = x x2 x y Adjust the basis: I < x2 +M 2 x y, x yI + 2 y2 -M1, x > I M Look at LCMs: 2 2 LCM LM f1 , LM f3 = LCM x , x = x LCM LM f2 , LM f3 = LCM x y, x = x y and choose f2, f3 . H H L H LL I M x y x y S f , f H= H *L x y +H 2LLy2 - 1 - H * xL = 2 y2 - 1 2 3 x y x Adjust the basis:8 < H 2 2 LCM LM f1 , LM f3 = LCM x , x = x 2 2 2 2 LCM LM f1 , LM f4 = LCM x , y = x y H H L H LL I 2M 2 LCM LM f2 , LM f4 = LCM x y, y = x y H H L H LL I 2M 2 LCM LM f3 , LM f4 = LCM x, y = x y H H L H LL I M We can choose f2, f4 or f3, f4 - the lowest in x. We skip the last one, since the firstH criteriaH L H LL I M 2 2 8 < 8 x y < 2 x y 2 x 3 S f2, f4 = * x y + 2 y - 1 - * 2 y - 1 = + 2 y - y x y 2 y2 2 H L I M I M 15-355: Modern Computer Algebra 9 x 3 3 + 2 y - y ® = 2 y - y ® 2 = 0 2 x 2 y -1 Two pairs left f1, f3 and f1, f4 - the lowest in x. We skip f1, f4 , since the first criteria 2 2 x 2 x S f1, f3 = * x + 2 x y - * x = 2 x y x2 x 8 < 8 < 8 < 2 x y ®x = 0 Therefore, here is the basis H L I M H L < x2 + 2 x y, x y + 2 y2 - 1, x, 2 y2 - 1 > We can cancel first two polynomials, since they are reduced wrt f3. Hence 1 < x, y2 - > 2 Hilbert's Nullstellensatz If the ideal is 1 then the polynomials have no common zeros. Gröbner bases are very useful for solving systems of polynomial equations. Let F be a finite set of polynomials in K x , ..., x . The variety of F is a set of all common complex zeros: X \ 1 n V F = z1, ..., zn fk z1, ..., zn = 0 for all fk Î F The variety does notH change ifL we replace F by another set of polynomials that generates the same ideal, in particular, by the reduced Gröbner basis. The advantage of G is that it reveals geometric H L 8H L H L < properties of the variety that are not visible from F. What is the size of the variety? Hilbert’ s Null- stellensatz implies The variety V(F) is empty if and only if G = 1 Example. x + y2 = 0 X \ -x + y + 1 = 0 y3 - y = 0 10 Groebner Bases GroebnerBasis x + y2 0, -x + y + 1 0, y3 - y 0 , x, y A9 = 1 8 2 3 8Solve< x + y 0, -x + y + 1 0, y - y 0 , x, y A9 = 8 Definition. Given a fixed ideal I Í K x1, ..., xn and a monomial order, then a monomial Α Α Α x = x1 1 ...xn n is called standard if it is not in the leading ideal LT I . Example. Consider LT I = < x 5 x 4 x 2 >, then there are sixty standard monomials. 1 H 2 3 L The variety V I is finite if and only if the set of standard monomialsX H isL\ finite, In a univariate case this is the Fundamental Theorem of Algebra, which states that the variety of a univariate polyno- X H L\ mial of degree n consists of n complex numbers. H L References [1] D. Cox, J. Little, and D. O'Shea. Ideals, Varieties, and Algorithms: An Introduction to Computa- tional Algebraic Geometry and Commutative Algebra. Springer-Verlag, 1991. [2] B. Buchberger, Theoretical Basis for the Reduction of Polynomials to Canonical Forms. SIGSAM Bull. 39(1976), 19-24, [3] B. Buchberger, A Life Devoted to Symbolic Computation. Journal of Symbolic Computation, 41(2006), 255-258. [4] Bruno Buchberger’s PhD thesis 1965: An algorithm for finding the basis elements of the residue class ring of a zero dimensional polynomial ideal. Journal of Symbolic Computation, 41(2006), 475-511.