Polynomials and affine space
I’m working my way through Cox, Little and O’Shea’s book  on computational aspects of algebraic geometry and commutative algebra. The title of the book certainly sounds abstract, but for computational oriented people the good news is that it incorporates the use of a computer algebra system (CAS) into the exposition. The bad news is that the CASs covered are Maple, Mathematica and REDUCE, well not exactly all bad news since REDUCE has recently been open sourced under a BSD-like license. The text by Greuel and Pfister  incorporates the open source CAS Singular into its exposition, substantially more so than . Singular is a standard package of Sage so you could also work your way through any of  or  with Sage. Feeling a little adventurous, I thought I might try using Sage while studying .
Polynomials: from one to many
To study commutative algebra and algebraic geometry, one needs to study polynomials in variables. But polynomials are made up of monomials.
A monomial in variables is a product
where the exponents are non-negative. The total degree of the monomial is the sum of its exponents.
The quadratic is certainly a monomial in 1 variable with total degree 2, and is a monomial in 3 variables with total degree 6. To simplify the notation for monomials, we let the variables be an -tuple and similarly the exponents can be packed into a tuple of the same dimension: . Now (1) can be simply written as
with total degree . OK, so this isn’t always a compact way of writing a monomial, because when requires two characters to express the integer 1. We can now use this shorthand notation for monomials to define polynomials with coefficients in some field .
A polynomial in variables with coefficients in a field is a finite linear combination of monomials of the form
where the sum is over an -tuple . The set of all polynomials in with coefficients in is denoted .
We also have a notion of total degree similar to the case of monomials, in addition to ideas such as coefficients and terms as in the case of single variable polynomials.
Let be a polynomial in . The factor is called the coefficient of the monomial . In case , the expression is called a term of . The total degree of , denoted , is the maximum such that .
The polynomial has 3 variables with total degree 3, which is also the total degree of the terms and . The solution set of can be visualized as three cones meeting at a common point. The field in which coefficients of a polynomial live can be any arbitrary field. For concreteness we can study multivariate polynomials with coefficients in the complex field , the real field , the rational field , or finite fields such as the Galois fields of prime number of elements. Here’s a Sage session on multivariate polynomials.
sage: R. = RR; R Multivariate Polynomial Ring in x, y, z over Real Field with 53 bits of precision sage: f = z^3 - z*x^2 + y^2 sage: f.base_ring() Real Field with 53 bits of precision sage: f.coefficients() [-1.00000000000000, 1.00000000000000, 1.00000000000000] sage: sage: # change the ring to the rationals sage: f = f.change_ring(QQ) sage: f.base_ring(); f Rational Field -x^2*z + z^3 + y^2 sage: f.coefficients() # coefficients of the terms [-1, 1, 1] sage: f.degrees() # degree of each term (2, 2, 3) sage: f.total_degree() # the total degree 3
Note that in the latter Sage session the command
sage: R. = RR
constructs an object R that represents the multivariate polynomial ring in three indeterminates with coefficients over . But how do we know that is a polynomial ring, let alone ? For the case of univariate polynomials, the answer lies in Theorem 1, a proof of which can be found in [3, Appendix G]. Having established the univariate case, one can adapt the same technique to prove the multivariate case.
Let be a ring. Then there exists a ring containing an element such that the following properties are satisfied:
- is a subring of .
- For all we have .
- Every element can be written in the form
- The representation of elements as is unique in the sense that if and
then for and for each . Here, we use to denote the additive identity of .
- Finally iff for .
From calculus and linear algebra, we learn about real and complex vectors in 1, 2 and 3 dimensions and represent them as tuples of the form , and respectively. If each then we have , and respectively. The quadratic evaluates to a real number for any real value of . For example, if then
sage: f = 2*x^2 + x - 3 sage: f(2) 7
and so we obtain the map . The point is that a polynomial can be thought of as a function. For brave souls among us who deal with polynomials in more than one indeterminate, it’s handy to identify a multivariate polynomial with a function of the form
where is the -dimensional affine space over the field with an integer. Evaluating a multivariate polynomial follows the same procedure as one would expect: replace each occurrence of a variable in the polynomial by its value. For example:
sage: P. = ZZ sage: f = z^3 - z*x^2 + y^2 sage: sage: def solfZZ(n): ....: """ ....: Return positive integer solutions of z^3 - z*x^2 + y^2 = 0. ....: """ ....: for i in xrange(1, n): ....: for j in xrange(1, n): ....: for k in xrange(1, n): ....: if f(x=i, y=j, z=k) == 0: ....: print "x = %s, y = %s, z = %s" % (i,j,k) ....: sage: solfZZ(50) x = 5, y = 6, z = 4 x = 6, y = 8, z = 2 x = 6, y = 9, z = 3 x = 15, y = 36, z = 9 x = 20, y = 48, z = 16 x = 21, y = 36, z = 3 x = 34, y = 48, z = 2
The base ring of a multivariate polynomial can be a finite field say , in which case some polynomials in are zero functions. Such functions have the singleton consisting of zero, or the additive identity, as their image.
sage: P. = GF(2) sage: f = x * (x^2 + x) * (x - 1) sage: sage: def solfGF(): ....: for i in GF(2): ....: for j in GF(2): ....: for k in GF(2): ....: print "f(%s, %s, %s) = %s" % (i,j,k, f(i,j,k)) ....: sage: solfGF() f(0, 0, 0) = 0 f(0, 0, 1) = 0 f(0, 1, 0) = 0 f(0, 1, 1) = 0 f(1, 0, 0) = 0 f(1, 0, 1) = 0 f(1, 1, 0) = 0 f(1, 1, 1) = 0
However, when the base ring is an infinite field and , then in iff is the zero function. We can use this result to show that two polynomials are equal in iff and are the same function on the affine space .
The idea of a variety is very simple: it is simply the solution set of a system of equations.
Let be a field and let be polynomials in . Then the set
is called the affine variety defined by .
If our base field is , then the variety is the unit circle centred at (see Figure 1). That is because the solution set of consists of all points on the unit circle whose centre is the origin of the -plane. The unit circle in Figure 1 can be generated using the following commands:
sage: c = circle((0,0), 1, rgbcolor=(0,0,1)) sage: c.show(figsize=[5,5])
In three dimensions, the variety defines the paraboloid in Figure 2:
sage: var("x,y"); sage: f = x^2 + y^2 sage: p = plot3d(f, (x,-4,4), (y,-4,4)) sage: p.show(zoom=1.2)
One of the more familiar varieties is the linear variety arising from linear algebra. Let be a fixed field and consider a system of linear equations in variables with coefficients in , that is:
The variety of this system is its solution set, which can be obtained using Gaussian elimination. A linear system can have a unique solution, infinitely many solutions, or no solutions at all. Moving on to a more complicated example, we can view the method of Lagrange multipliers in terms of affine variety. Suppose we want to find minima and maxima points of a function, say, where the variables are related by for some constant in the base field . The method of Lagrange multipliers shows that at a local minimum or maximum point, where
The system of equations resulting from using the method of Lagrange multipliers is an affine variety. A basic fact about affine varieties is that the intersection or union of any two affine varieties is again an affine variety.
- D. Cox, J. Little, and D. O’Shea. Ideals, Varieties, and Algorithms: An Introduction to Computational Algebraic Geometry and Commutative Algebra. Springer-Verlag, 1992.
- G.-M. Greuel and G. Pfister. A Singular Introduction to Commutative Algebra. Springer-Verlag, 2002.
- T. W. Hungerford. Abstract Algebra: An Introduction. Thomson Learning, 2nd edition, 1997.