Macaulay2 » Documentation
Packages » Macaulay2Doc > modules > basis
next | previous | forward | backward | up | index | toc

basis -- basis or generating set of all or part of a ring, ideal or module

Synopsis

Description

The function basis finds a basis or generating set of a module over a coefficient ring, either for the full module, or for a degree range, or for a specific (multi-)degree. A ring or ideal may also be provided instead of a module. Partial multi-degrees may also be given, see below for the usage and meaning.

If $M$ is a matrix, then the matrix between the corresponding bases of the source and target of $M$ is returned. This feature should be considered experimental.

The following examples show the varied uses of this function.

Basis of the whole ring

If no degree or degree range is given, then a full basis is given. In the example below, the 12 entries generate $R$ over the base ring ${\mathbb Q}$. If the object is not finite, then an error is given.

i1 : R = QQ[a,b,c]/(a^2, b^3, a*c, c^3);
i2 : basis R

o2 = | 1 a ab ab2 b b2 b2c b2c2 bc bc2 c c2 |

             1      12
o2 : Matrix R  <-- R
i3 : sort basis R

o3 = | 1 c b a c2 bc b2 ab bc2 b2c ab2 b2c2 |

             1      12
o3 : Matrix R  <-- R

Basis in a degree or range of degrees

If a single degree or degree range is given, give a basis (or generating set) of that particular degree (or degree range) of $M$.

i4 : R = QQ[x,y,z]

o4 = R

o4 : PolynomialRing
i5 : basis(2,R)

o5 = | x2 xy xz y2 yz z2 |

             1      6
o5 : Matrix R  <-- R
i6 : I = ideal"x2,y3"

             2   3
o6 = ideal (x , y )

o6 : Ideal of R
i7 : phi = basis(3,I)

o7 = {2} | x y z 0 |
     {3} | 0 0 0 1 |

o7 : Matrix
i8 : super phi

o8 = | x3 x2y x2z y3 |

             1      4
o8 : Matrix R  <-- R

Notice that phi is a matrix whose source is a free module, and whose target is the ideal. super is used to get the actual elements of $I$.

Basis in a specific multi-degree

If a multidegree is given, then a range cannot be given. In this example, the dimension over QQ of this multigraded piece of R is 2.

i9 : R = QQ[a..c,Degrees=>{{1,0},{1,-1},{1,-2}}]

o9 = R

o9 : PolynomialRing
i10 : basis({4,-5},R)

o10 = | abc2 b3c |

              1      2
o10 : Matrix R  <-- R

Partially described multidegrees

A partial multidegree can be given. The given columns generate (form a basis in this case) the degree \{2,*\} part of R, over the subring QQ[d] generated by the variables which have degree \{0,*\}.

i11 : R = QQ[a..d,Degrees=>{{1,0},{1,-1},{1,-2},{0,1}}]

o11 = R

o11 : PolynomialRing
i12 : basis(2,R)

o12 = | a2 ab ac b2 bc c2 |

              1      6
o12 : Matrix R  <-- R

The base ring does not need to be a field. In these cases, the given image vectors might only generate over the base ring, not be a basis. For instance, in the following example, $B$ is generated over $A$ by 4 elements, but $B$ is not a free module.

i13 : A = ZZ/101[a..d];
i14 : B = A[x,y]/(a*x, x^2, y^2);
i15 : try basis B
i16 : basis(B, Variables => B_*)

o16 = | 1 x xy y |

              1      4
o16 : Matrix B  <-- B

If $M$ is an ideal or module, the resulting map looks somewhat strange, since maps between modules are given from generators, in terms of the generators of the target module. Use super or cover to recover the actual elements.

i17 : R = QQ[a,b,c]/(a^2, b^3, a*c, c^3);
i18 : I = ideal(a,b^2,c)

                 2
o18 = ideal (a, b , c)

o18 : Ideal of R
i19 : F = basis I

o19 = {1} | 1 b 0 0 0 0  0 0 0  0 |
      {2} | 0 0 1 a c c2 0 0 0  0 |
      {1} | 0 0 0 0 0 0  1 b bc c |

o19 : Matrix
i20 : super F

o20 = | a ab b2 ab2 b2c b2c2 c bc bc2 c2 |

              1      10
o20 : Matrix R  <-- R
i21 : C = B[u,v]/(u^2,u*v,v^2)

o21 = C

o21 : QuotientRing
i22 : basis(C, Variables=>{u,v,x_C,y_C}, SourceRing => A)

o22 = | 1 u xu xyu yu v xv xyv yv x xy y |

              1      12
o22 : Matrix C  <-- A

If Variables is given as an optional argument, only monomial multiples of the generators which involve these variables will be considered. In this case, the resulting elements might not form a generating set over the coefficient ring. They do generate over the subring generated by the other variables.

i23 : D = QQ[a..d]/(a^2, b^2)

o23 = D

o23 : QuotientRing
i24 : basis(D, Variables => {a,b})

o24 = | 1 a ab b |

              1      4
o24 : Matrix D  <-- D

If the base ring has a local term order, then the generating set or basis will be over this ring.

i25 : E = QQ{a..d}

o25 = E

o25 : PolynomialRing
i26 : I = ideal(a+d^3-d^4, b^2 + d^3, c^2 + d^4, d^5)

                  3    4   2    3   2    4   5
o26 = ideal (a + d  - d , b  + d , c  + d , d )

o26 : Ideal of E
i27 : f = basis (E^1/I)

o27 = | 1 b bc bcd bcd2 bcd3 bcd4 bd bd2 bd3 bd4 c cd cd2 cd3 cd4 d d2 d3 d4
      -----------------------------------------------------------------------
      |

o27 : Matrix
i28 : cover f

o28 = | 1 b bc bcd bcd2 bcd3 bcd4 bd bd2 bd3 bd4 c cd cd2 cd3 cd4 d d2 d3 d4
      -----------------------------------------------------------------------
      |

              1      20
o28 : Matrix E  <-- E

Functoriality

basis is functorial, meaning that if $M : A \rightarrow B$ is a matrix between two modules, then the result is the induced matrix on the images of the result of basis applied to A and B.

i29 : R = ZZ/101[a..d]

o29 = R

o29 : PolynomialRing
i30 : M = koszul(2,vars R)

o30 = {1} | -b -c 0  -d 0  0  |
      {1} | a  0  -c 0  -d 0  |
      {1} | 0  a  b  0  0  -d |
      {1} | 0  0  0  a  b  c  |

              4      6
o30 : Matrix R  <-- R
i31 : f1 = basis(2, source M)

o31 = {2} | 1 0 0 0 0 0 |
      {2} | 0 1 0 0 0 0 |
      {2} | 0 0 1 0 0 0 |
      {2} | 0 0 0 1 0 0 |
      {2} | 0 0 0 0 1 0 |
      {2} | 0 0 0 0 0 1 |

              6      6
o31 : Matrix R  <-- R
i32 : f2 = basis(2, target M)

o32 = {1} | a b c d 0 0 0 0 0 0 0 0 0 0 0 0 |
      {1} | 0 0 0 0 a b c d 0 0 0 0 0 0 0 0 |
      {1} | 0 0 0 0 0 0 0 0 a b c d 0 0 0 0 |
      {1} | 0 0 0 0 0 0 0 0 0 0 0 0 a b c d |

              4      16
o32 : Matrix R  <-- R
i33 : f = basis(2,M)

o33 = {2} | 0  0  0  0  0  0  |
      {2} | -1 0  0  0  0  0  |
      {2} | 0  -1 0  0  0  0  |
      {2} | 0  0  0  -1 0  0  |
      {2} | 1  0  0  0  0  0  |
      {2} | 0  0  0  0  0  0  |
      {2} | 0  0  -1 0  0  0  |
      {2} | 0  0  0  0  -1 0  |
      {2} | 0  1  0  0  0  0  |
      {2} | 0  0  1  0  0  0  |
      {2} | 0  0  0  0  0  0  |
      {2} | 0  0  0  0  0  -1 |
      {2} | 0  0  0  1  0  0  |
      {2} | 0  0  0  0  1  0  |
      {2} | 0  0  0  0  0  1  |
      {2} | 0  0  0  0  0  0  |

o33 : Matrix
i34 : source f == image f1

o34 = true
i35 : target f == image f2

o35 = true

Obtain the map of free modules using matrix:

i36 : matrix f

o36 = {2} | 0  0  0  0  0  0  |
      {2} | -1 0  0  0  0  0  |
      {2} | 0  -1 0  0  0  0  |
      {2} | 0  0  0  -1 0  0  |
      {2} | 1  0  0  0  0  0  |
      {2} | 0  0  0  0  0  0  |
      {2} | 0  0  -1 0  0  0  |
      {2} | 0  0  0  0  -1 0  |
      {2} | 0  1  0  0  0  0  |
      {2} | 0  0  1  0  0  0  |
      {2} | 0  0  0  0  0  0  |
      {2} | 0  0  0  0  0  -1 |
      {2} | 0  0  0  1  0  0  |
      {2} | 0  0  0  0  1  0  |
      {2} | 0  0  0  0  0  1  |
      {2} | 0  0  0  0  0  0  |

              16      6
o36 : Matrix R   <-- R

Caveat

If the base ring is not a field, then the result is only a generating set. If the optional argument Variables is provided, then even this might not be correct.

See also

Ways to use basis:

For the programmer

The object basis is a method function with options.