# hilbertFunction -- the Hilbert function

## Synopsis

• Usage:
hilbertFunction(d,X)
• Inputs:
• d, an integer (or a list of integers) specifying a degree (or multidegree)
• M, a ring, module, ideal, coherent sheaf, or projective variety
• Outputs:
• an integer, the dimension of the degree d part of M. For an ideal, the corresponding quotient ring is used. For a projective varieties and coherent sheaves, the functionality is not yet implemented.

## Description

In the following example, compare the rank of the source of the basis map to the number provided by hilbertFunction.

 i1 : R = QQ[x,y,z, Degrees=>{3:{1,1}}]; i2 : hilbertFunction({3,3}, R) o2 = 10 i3 : basis({3,3},R) o3 = | x3 x2y x2z xy2 xyz xz2 y3 y2z yz2 z3 | 1 10 o3 : Matrix R <--- R
The standard meaning of subscripts on functions permits a simpler syntax to be used.
 i4 : hilbertFunction_{3,3} R o4 = 10
Here is a singly graded example.
 i5 : R = QQ[x,y,z];, o6 = (, ) o6 : Sequence i7 : hilbertFunction({3}, R) o7 = 10 i8 : hilbertFunction(3, R) o8 = 10
Here is an example with a module.
 i9 : R = QQ[a..d, Degrees=>{4:{1,1}}]; i10 : M = coker matrix {{a,c,d},{c,b,d}} o10 = cokernel | a c d | | c b d | 2 o10 : R-module, quotient of R i11 : hilbertFunction({2,2}, M) o11 = 8 i12 : B = basis({2,2},M) o12 = | b2 bc c2 cd d2 0 0 0 | | 0 0 0 0 0 a2 ac c2 | o12 : Matrix i13 : numgens source B o13 = 8
Here is an example with an ideal.
 i14 : R = QQ[a..f, Degrees=>{6:{1,1}}]; i15 : I = ideal (a*b, c*d, e*f); o15 : Ideal of R i16 : hilbertFunction({2,2}, I) o16 = 18 i17 : S = R/I; i18 : basis({2,2},S) o18 = | a2 ac ad ae af b2 bc bd be bf c2 ce cf d2 de df e2 f2 | 1 18 o18 : Matrix S <--- S

## Caveat

It can be much faster to compute a basis for the desired degree, because hilbertFunction works by expanding the Hilbert series to a sufficiently high order, thus, in effect, computing many values of the Hilbert function simultaneously. If several values of the Hilbert function are desired, it is best to compute the ones of higher degree first, so the expansion will be done to sufficiently high order at the first attempt, and thus be done just once.

## Ways to use hilbertFunction :

• "hilbertFunction(List,CoherentSheaf)"
• "hilbertFunction(List,Ideal)"
• "hilbertFunction(List,Module)"
• "hilbertFunction(List,ProjectiveVariety)"
• "hilbertFunction(List,Ring)"
• "hilbertFunction(ZZ,CoherentSheaf)"
• "hilbertFunction(ZZ,Ideal)"
• "hilbertFunction(ZZ,Module)"
• "hilbertFunction(ZZ,ProjectiveVariety)"
• "hilbertFunction(ZZ,Ring)"

## For the programmer

The object hilbertFunction is .