* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Polynomials and Gröbner Bases
Quartic function wikipedia , lookup
Linear algebra wikipedia , lookup
Field (mathematics) wikipedia , lookup
History of algebra wikipedia , lookup
Basis (linear algebra) wikipedia , lookup
Horner's method wikipedia , lookup
Algebraic geometry wikipedia , lookup
Algebraic variety wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
Commutative ring wikipedia , lookup
Fundamental theorem of algebra wikipedia , lookup
Factorization wikipedia , lookup
System of polynomial equations wikipedia , lookup
Eisenstein's criterion wikipedia , lookup
Polynomial greatest common divisor wikipedia , lookup
Polynomial ring wikipedia , lookup
Factorization of polynomials over finite fields wikipedia , lookup
Polynomials and Gröbner Bases Alice Feldmann January 13, 2015 Abstract This report is intended to elaborate the topics covered in the presentation on December 16, 2014 about polynomials and Gröbner basis held by Alice Feldmann in the student seminar in combinatorics on mathematical software in the autumn semester 2014 at ETH Zurich. The concept of polynomials and Gröbner bases is a typical subject in computational algebra. First of all, this report gives a short introduction into computational algebra. Then, after providing the mathematical background and explaining related notions, it explains Buchberger’s algorithm for the construction of Gröbner bases. Finally some mathematical software tools are presented, which are widely used for problems in computational algebra, whereby a focus lays on the software Singular. 1 Introduction: Computational Algebra Computational algebra has developed a lot during the second half of the 20th century. It describes the process of tackling and studying algebraic problems with algorithmic methods using computational help of appropriate software tools. An easy example students get to know very early is solving an inhomogenous system of linear equations. There are many efficient implementations of the famous Gauss algorithm. Using matrices as the underlying algebraic notion, the system can be transformed into an equation of the form Ax = b with A 2 F n⇥n and b 2 F n \ {0} for a field F . One experiences that a computer helps a lot in this case due to an efficient implementation of the computation of the determinant: there exists a unique solution for an inhomogenous system, if and only if det(A) 6= 0. A widely spread topic in computational algebra is the effient calculation of Gröbner bases, which can be used in various applications. They provide solutions to basic problems in ring theory like the membership problem: “Let R be a ring and I an ideal of R. Given r 2 R, is r 2 I?”. Furthermore they come up with an approach for solving systems of non-linear equations by the reduction of the number of variables. 2 Polynomials and Gröbner Bases 2.1 Mathematical Background: Algebraic Construction First of all, we want to repeat some basic algebraic definitions and concepts. Basic definitions: • A monomial over a collection of variables x1 , x2 , ..., xn is defined as the product of powers ↵i ↵1 ↵2 ↵n ↵ (for i = 1, . . . , n) of these variables: Pn x1 x2 · · · xn =: x . We can determine the total degree of ↵ ↵ the monomial x : deg(x ) = i=1 ↵i =: |↵|. 1 • A term is a product of a non-zero element c of a field F and a monomial.PHence, a polynomial p can be written as a finite sum of terms with coefficients in F , such as p = ↵ c↵ x↵ for c↵ 2 F 8↵. • Let F [x1 , . . . , xn ] denote the polynomial ring, which is the set of all polynomials in n variables x1 , . . . , xn with coefficients in F . Note that F [x1 , . . . , xn ] is a commutative ring with addition and multiplication of polynomials defined as usual. Furthermore, n o define the field of rational f functions as F (x1 , . . . , xn ) := g | f, g 2 F [x1 , . . . , xn ] and g6=0 . • An ideal I ⇢ F [x1 , . . . , xn ] of a polynomial ring is a non-empty subset such that f + g 2 I for f, g 2 I and furthermore pf 2 I for an arbitraty polynomial p 2 F [x1 , . . . , xn ]. Ideals can be generated by a set of s polynomials, say {f1 , . . . , fs } ⇢ F [x1 , . . . , xn ]. Denote the ideal generated by this set of functions by hf1 , . . . , fs i := {p1 f1 + . . . + ps fs | pi 2 F [x1 , . . . , xn ] for i = {1, . . . , s}}. We remark that hf1 , . . . , fs i is the smallest ideal which contains all the polynomials f1 , . . . , fs . Example: 2 Consider the polynomials f1 := x2 + z 2 1, f2 := x2 + y 2 + (z 1) 4 and p := x2 + 12 y 2 z z 1. Note that f1 , f2 , p 2 R [x, y, z]. We want to check whether p lies in the ideal hf1 , f2 i generated by f1 and f2 . Observe that p can be written as a sum of terms as follows: ✓ ◆ ✓ ◆⇣ ⌘ 1 1 1 2 p = x2 + y 2 z z 1 = z + 1 x2 + z 2 1 + z x2 + y 2 + (z 1) 4 2 2 2 ✓ ◆ ✓ ◆ 1 1 = z + 1 f1 + z f2 = ↵1 f1 + ↵2 f2 2 2 with ↵1 = 1 2z + 1 and ↵2 = 12 z, both in R [x, y, z]. We conclude that p 2 hf1 , f2 i. The Hilbert basis theorem and the division algorithm We want to remind the reader of the famous Hilbert basis theorem at this point: it states that every ideal I in F [x1 , . . . , xn ] has a finite generating set. This means that for any given ideal I, there exists a finite set of polynomials {f1 , . . . , fs } ⇢ F [x1 , . . . , xn ] such that I = hf1 , . . . , fs i. We will see later that this theorem is of quite a big importance. The division algorithm in F [x] Furthermore, we know a division algorithm in the polynomial ring F [x] in one variable x which works in the following way: assume that we are given two polynomials f, g 2 F [x]. We can divide f by g producing a unique quotient q 2 F [x] and a unique remainder r 2 F [x] such that f = qg + r, and it is either r = 0, or r has a degree strictly smaller than the degree of g. Since we often have to operate with functions in more than one variable the question arises, if there exists an equivalent division algorithm for polynomials in many variables? To answer this question, we first have to introduce the notion of monomial orders. Definition: monomial orders A monomial order on F [x1 , . . . , xn ] is any relation > on the set of monomials x↵ in F [x1 , . . . , xn ] satisfying: 2 1. > is a total (linear) ordering relation, i.e. it is antisymmetric (a b and b a ) a = b), transitive (a b and b c ) a c) and total (we either have a b or b a for two distinc elements a, b 2 F [x1 , . . . , xn ]). 2. > is compatible with multiplication in F [x1 , . . . , xn ], i.e. if a < b and we pick an arbitraty non-zero c 2 F [x1 , . . . , xn ], then it holds true that ca < cb. 3. > is a well-ordering, i.e. every non-empty collection of monomials has a smallest element under >. The two most common monomial orders are the lexicographic order and the graded reverse lexicographic order, which are defined as follows: Lexicographic order Let x↵ and x be monomials in F [x1 , . . . , xn ]. We say x↵ >lex x , if the left-most entry in the difference ↵ 2 Zn is positive. Graded reverse lexicographic order Pn Pn Let x↵ and x be monomials in F [x1 , . . . , xn ]. We say x↵ >grevlex x , if either i=1 ↵i > i=1 or in case the sums are equal, the right-most entry in the difference ↵ 2 Zn is negative. i, We want to illustrate these monomial orders with some easy examples. We naturally always assume that x > y > z. • We have that x3 y 2 z >lex x2 y 6 z 12 . Looking at the difference vector (3, 2, 1) (2, 6, 12) = (1, 4, 11) shows that the left-most entry is positive. Hence the term x3 y 2 z is greater than x2 y 6 z 12 in the lexicographic order. • It is also true that x2 y 2 z 2 >lex xy 4 z, because we have (2, 2, 2) (1, 4, 1) = (1, 2, 1). • However, we get x2 y 6 z 12 >grevlex x3 y 2 z in this case, because the total degree (equal to 20) of the term x2 y 6 z 12 is greater than the total degree (equal to 6) of the other term. • Furthermore, looking at the terms from the second example using the graded reverse lexicographic order, we obtain xy 4 z >grevlex x2 y 2 z 2 , because the monomials have equal total degrees, but the difference vector is equal to (1, 4, 1) (2, 2, 2) = ( 1, 2, 1) and we need the right-most entry to be negative. The examples show that two polynomials can be ordered in several ways depending on how one defines the monomial ordering. This is a very important aspect, because different orderings yield different results. Definition: leading term of a polynomial Before we finally get to explain the division algorithm in the Ppolynomial ring F [x1 , . . . , xn ], we need to define what the leading term of a polynomial is. Let f := ↵ c↵ x↵ be a polynomial in F [x1 , . . . , xn ]. Fix an arbitrary monomial order >. The leading term of f with respect to > is the product c↵ x↵ , where x↵ is the largest monomial appearing in the ordering >. Denote the leading term of polynomial f by LT> (f ). 3 Example: Consider the polynomial f = 3x3 y 2 + x2 yz 3 2 Q [x, y, z]. Observe that we have different leading terms depending on the choice of the monomial order. We get LT>lex (f ) = 3x3 y 2 for the lexicographic order, whereas LT>grevlex (f ) = x2 yz 3 for the graded reverse lexicographic order. The division algorithm in F [x1 , . . . , xn ] Fix any monomial order > in F [x1 , . . . , xn ] and let P := (p1 , . . . , ps ) be an ordered s-tuple of polynomials in F [x1 , . . . , xn ]. Then every f 2 F [x1 , . . . , xn ] can be written as f = a1 p1 + . . . + as ps + r, where ai , r 2 F [x1 , . . . , xn ], and either r = 0, or r is a linear combination of monomials, of which none is divisible by any of the leading terms LT> (p1 ), . . . , LT> (ps ) of the polynomials in P . We want to point out, that - analogously to the division algorithm in the polynomial ring F [x] - r is called the remainder of f on division by P . We sometimes use the notation r = f¯P . Furthermore, note that the division algorithm allows us to divide f by an s-tuple of polynomials. This is due to the fact that if we regard f as a polynomial generated by the polynomials in P , we want to divide it by more than one polynomial to see whether it can be written as a linear combination of exactly those s polynomials. As a last remark, we again want to bring the reader’s attention to the fact that the outcome of the division depends on the choice of the monomial order. 2.2 Gröbner Bases Motivation By applying the division algorithm, one can decide whether a given polynomial f 2 F [x1 , . . . , xn ] is a member of a given ideal I = hf1 , . . . , fs i. If the remainder r = f¯P of f on division by P := (p1 , . . . , ps ) is zero, i.e. f¯P = 0, then we have f = a1 p1 +. . .+as ps , and by definition it is true that f 2 hp1 , . . . , ps i. 1 2 2 D Now, recall one of our previous Eexamples: define p := x + 2 y z z 1 and I = hf1 , f2 i = x2 + y 2 1, x2 + y 2 + (z 1) 2 4 . We have already showed that p 2 I. However, if we divide p by P = (f1 , f2 ) using our division algorithm (assume we have fixed the lexicographic order), we obtain a non-zero remainder p̄P = 12 y 2 z z z 2 . The reason is that none of the leading terms of f1 or f2 (LT(f1 ) = LT(f2 ) = x2 ) divides the leading term of the rest of p (LT p̄P = 12 y 2 z) after the first step (which is the division of p by f1 ). Gröbner bases will help us to solve this problem by gernerating a new basis for the same ideal. Then it is guaranteed that the division algorithm works when dividing by the corresponding Gröbner basis. Definition: Gröber basis Fix a monomial order > on F [x1 , . . . , xn ] and let I ⇢ F [x1 , . . . , xn ] be an ideal. A Gröbner basis for I with respect to > is a finite collection of polynomials G = {g1 , . . . , gt } ⇢ I with the property that for every non-zero polynomial f 2 I, the leading term LT> (f ) of f is divisible by the leading term LT> (gi ) of some gi for some i. We call a Gröbner Basis G for an ideal I ... • reduced, if no monomial appearing in p 2 G is a multiple of the leading term LT> (q) of any other monomial q 2 G. 4 • monic, if it is reduced and if the leading coefficient of all polynomials is 1. Note that a Gröbner basis G is indeed a basis for I, i.e. I = hg1 , . . . , gt i as we will see later. Moreover, if G is a Gröbner basis for I and we have a polynomial f 2 I, then the remainder of f on division by G is zero due to the construction of the Gröbner basis, i.e. f 2 I , f¯G = 0. Before coming to Buchberger’s algorithm, one last remark should be that the remainder obtained through division by polynoimals of a Gröbner basis for an ideal is unique. 2.3 Buchberger’s Algorithm Motivation We have seen before that Gröbner bases promise better results when it comes to various problems, for example the ideal membership problem. Hence it is desirable to work with Gröbner bases instead of arbitrary bases. Buchberger’s algorithm takes an arbitrary generating set {f1 , . . . , fs } of an ideal I = hf1 , . . . , fs i as input and produces a Gröbner basis G for I from it. Buchberger developed his algorithm in the 1970s and by now it has become one of the most powerful tools in computational algebra. How it works... Let f, g 2 F [x1 , . . . , xn ] be non-zero polynomials. Fix a monomial order and let LT (f ) = cx↵ and LT (g) = dx be the leading terms of f and g, respectively, where c, d 2 F. Furthermore, define x := lcm x↵ , x as the least common multiple of the monomials in the leading terms. Now, define the S-polynomial of f and g as follows: S (f, g) := x ·f LT (f ) x ·g LT (g) and observe that S (f, g) 2 hf, gi. Now, apply Buchberger’s criterion: G A finite set G = {g1 , . . . , gt } ⇢ I is a Gröbner basis of I if and only if S (gi , gj ) = 0 for all pairs i and j with i 6= j. Buchberger’s Algorithm Input: F = {f1 , . . . , fs } Output: a Gröbner basis G = {g1 , . . . , gt } for the ideal I = hF i with F ⇢ G G := F REPEAT G0 := G FOR each pair p 6= q in G0 DO G0 S := S (p, q) IF S6=0 THEN G := G [ {S} UNTIL G = G0 Analysis of the Algorithm We now want to explain that the algorithm is correct: first of all, G is indeed a basis for I, because the algorithm simply adjoins polynomials lying in the ideal I to our set G. This means that the core of the basis, i.e. F = {f1 , . . . , fs } , is still kept and no new generators are added. Hence G is a basis for I as well. 5 Further, we observe that only polynomials with leading terms different from the leading terms of the current basis are added to the set. These leading terms have a smaller total degree than any of the other terms by construction of the division algorithm and since we just look at polynomials of finite degree, one eventually reaches the point when the leading term of every polynomial occuring in the ideal can be divided by the leading term of a polynomial in the set. Then, the set forms a Gröbner basis by definition and we have reached our goal. It follows that the algorithm terminates at some point and hence the running time is finite. Note that in this version of Buchberger’s algorithm, the resulting Gröbner bases are not reduced. However, this can be implemented as well with some effort. Example We want to apply Buchberger’s Algorithm to an easy example. Consider the polynomials f = x3 y 2x2 y 2 + x and g = 3x4 y. Fix the monomial order to be the lexicographic order >lex . First of all, note that we have LT (f ) = x3 y and LT (g) = 3x4 in the lexicographic order. Hence, we get by definition x = lcm x3 y, x4 = x4 y. Now compute the S-polynomial: S (f, g) = xf ⇣y⌘ 3 g= 2x3 y 2 + x2 + y2 3 and divide it by F = (f, g) . Note that the leading term of S (f, g) is divisible by the leading term of f . The division algorithm yields the remainder y2 . 3 ⇣ ⌘ F Now observe that the leading term of the remainder LT S (f, g) = F S (f, g) = 4x2 y 3 + x2 + 2xy + 4x2 y 3 is not divisible by any F of the leading terms of f or g anymore. Hence, adjoin h := S (f, g) to our set F of polynomials and consider the two new S-polynoimals S (f, h) and S (g, h). Continue with this procedure and adjoin the remainders of further divisions, if they are non-zero. Conclusion In this chapter, the reader was introduced to the mathematical basics needed in computation alegbra. We have motivated the notion of Gröbner bases and explained the functioning of Buchberger’s algorithm. In fact, there exist many implementations of Buchbgerger’s algorithms in various software packages nowadays and the application of it is made really easy for the user. 3 Mathematical Software in Computational Algebra During the second half of the 20th century, many advancements have been achieved to make the work with computers possible and highly useful in different areas. We now want to introduce the reader to some mathematical software tools for studying problems in computational algebra. 3.1 Singular Singular was started in 1984 in Berlin, Germany, and is now settled at the University of Kaiserslautern. It is a computer algebra system for polynomial computations with emphasis on commutative algebra, algebraic geometry and singularity theory. 6 The main operating objects are ideals and modules in polynomial rings over fields or quotient rings. Singular features algorithms for the computation of Gröbner bases (implementations of Buchberger’s and Mora’s algorithm) and polynomial factorizaton, for instance. Furthermore it is possible to classify singularities and to perform resultant, characteristic set and gcd (greatest common divisor) calculations. It works as a free and open-source software under the GNU General Public Licence. The kernel of Singular is written in C. For more details and examples of implementations see Chapter 4 of this report. 3.2 CoCoA CoCoA was originally initiated in Genova in 1987 to perfom calculations using Buchberger’s algorithm. The name is a shortcut for Computations in Commutative Algebra. CoCoA puts emphasis on computations in multivariate polynomial rings over rational integers and on their ideals and modules. Similarly to Singular, it is available as a free software and also features CoCoALib - an opensource GPL library. Hence it enables users to work with already written templates and also to further develop the software. The library contains source codes for applications in various areas, for example in statistics or integer programming. A huge advantage of CoCoA is its efficiency: it performs calculations with very big integers and rational numbers reliably and delivers implementations of Buchberger’s algorithm using different orderings. The kernel of CoCoA is written in C, whereas users write in a Pascal-like syntax. 3.3 Gfan The origins of Gfan are in 2003 in Aarhus, Denmark, where it has been written and developed by A. N. Jensen. Gfan is a special sofware package for computing Gröbner fans of polynomial ideals in Q [x1 , . . . , xn ] and tropical varieties based on Buchberger’s algorithm. Hence, the emphasis is clearly on tropical and polyhedral geometry in combination with algebraic methods. Gfan features highly efficient implementations and with the help of various subprograms it enables fast computations and an easy handling. The kernel of Gfan is written in C++. 4 Implementation in Singular Programming basics When working with Singular, one experiences that the language is very similar to C respectively C++, for example: all inputs must be terminated by a semicolon, there exist types for variables which are just like the ones in C/C++, the user can write loops and functions and much more. However, different from standard software, when operating with non-trivial algorithms, the definition of an underlying ring is always required at the beginning: Singular uses the ring syntax ring name = (coefficients), (names of ring variables), (ordering). Singular also provides already implemented functions for basic operations on ideals, polynomials and matrices, like the factorization of polynomials into irreducible factors (implementation of the Cantor-Zassenhaus algorithm), the computation of the determinant of a square matrix and the calculation of the greatest common divisor of polynomials. However, the most interesting feature of Singular is probably the generation of Gröbner bases out of standard bases. Furthermore, there exist basic operations like a type-characterization command (typeof variable) and the possibility of converting types. The user can include libraries with the command lib libraryname. It is also possible to specify the monomial ordering when it comes to determining the leading term, for example. Hereby, dp stands for the grevlex ordering and lp denotes the lex ordering. Sometimes it is also useful to apply block ordering. Another important feature is the execution of the 7 division algorithm (with respect to a specific ordering). Using the appropriate commands will return the (unique) quotient and remainder of a division. Implementation examples First of all, we want to start with some basic calculations and the introduction of various objects of different types. Note that the second command shows that every statement must be terminated with a semicolon. The following code segment shows a basic operation on matrices, namely the calculation of the determinant, and a typical type membership request. Now, we want to define several rings - see code below and note how the syntax works. Since we want to operate in our ring r, we need to explicitly state this again using the command setring ringname, see below: 8 Look at the next code segment to see how we can define a polynomial f in our ring and request the number of monomials and its degree. We now want to define an ideal I which is generated by f , respectively by f and g. We can use the command subst to set the values of our variables to specific numbers. In this example, we set x = 1 and y = 2. We can use this for example to evaluate functions f and g at a specific point, in this case we set (x, y) = (1, 2). 9 Note that we have defined our function f and our ideal I in the ring r. If we set a different ring as our domain, we will see that f is undefined in this ring. Hence, we need to set our ring to r again - and we can ensure with some quick variable calls that our previously defined objects still exist. We now want to factorize our functions f and g. Observe that the first part of the output yields the factors and the second part gives us the corresponding powers. We can tell from the result that f is already irreducible in ring r, but g = x4 + x2 can be factorized into irreducible polynomials in the following way: g = x2 x2 + 1 . Therefore the greatest common divisor of f and g is 1. Last but not least we want to see how to compute the Gröbner basis of a given ideal I. Singular provides a command just for that purpose. 10 Conclusion The examples above show that Singular’s syntax is very intuitive and that basic and important operations with algebraic objects can be done without much effort. This makes Singular a very useful software tool to work with. 5 References Computational algebra Computational Algebra K. G. Fischer, P. Loustaunau, J. Shapiro, E. L. Green, D. Farkas: Lecture Notes in Pure and Applied Mathematics – Computational Algebra (1994) Algebraic background David A. Cox, John Little, Donal O‘Shea: Graduate Texts in Mathematics - Using Algebraic Geometry (2005) Ralf Fröberg: An Introduction to Gröbner Bases (1997) Software http://www.singular.uni-kl.de http://cocoa.dima.unige.it/flyer4.html http://home.math.au.dk/jensen/software/gfan/gfan.html http://en.wikipedia.org/wiki/List_of_computer_algebra_systems Implementation Groebner Bases – Statistics and Software Systems. Takayuki Hibi, Springer Japan, 2013 Singular Manual (online) 11