Problem: How to measure the “size” of an ideal \(I\), or equivalently “dimension” of the affine variety \(\mathcal {V}(I)\)?
Definition 4.14. Let \(I \subset k[X_1,\ldots ,X_n]\) be an ideal and \(s \in \mathbb {N}\), and let us write \[ k[X_1,\ldots , X_n]_{\leq s} \coloneqq \{ f\in k[X_1,\ldots , X_n] : f=0 \text { or } \mathrm {deg}(f) \leq s \} \] and \[ I_{\leq s} \coloneqq I \cap k[X_1,\ldots , X_n]_{\leq s} \] We define \[ HF_I(s) = \mathrm {dim}_{k} \left ( \frac {k[X_1,\ldots , X_n]_{\leq s}}{I_{\leq s} } \right ) < \infty \] Hilbert function of \(I\), as a function \(HF_I : \mathbb {N} \to \mathbb {N}\).
Example. (a) Let \(I = k[X_1,\ldots , X_n]\). Then \(HF_I(s)=0\) for all \(s\in \mathbb {N}\).
(b) Let \(I = \{0 \}\) Then \begin {align*} HF_I(s) &= \mathrm {dim}_k k[X_1,\ldots , X_n]_{\leq s} \\ &= \text { number of monomials } X^\alpha \text { with } |\alpha | \leq s \\ &= \{ (\alpha _1,\ldots ,\alpha _n) \in \mathbb {N}^n : \alpha _1 + \ldots + \alpha _n \leq s \} = { s+n \choose n } \\ &= \frac {1}{n!}(s+n)(s+n-1)\cdots (s+1) = \frac {1}{n!} s^n + \frac {1}{n!} { n+1 \choose 2 } s^{n-1} + \ldots + \sum _{i=1}^n \frac {1}{i} s + 1 \end {align*}
is a polynomial of degree \(n\).
(c) Suppose that \(I=(f)\) where \(f \in k[X_1,\ldots ,X_n]\) with \(deg(f) = d \geq 0\). Then \[ HF_I(s) = \mathrm {dim}_k k[X_1,\ldots ,X_n]_{\leq s} - \mathrm {dim}_k I_{\leq s} \] We have \[ I_{\leq s} = \{ g \cdot f | g \in k[X_1,\ldots ,X_n], deg(g) + d \leq s \} \] Thus, if \(s < d\), then \(I_{\leq s} = \{0 \}\). If \(s \geq d\), then \(\mathrm {dim}_k I_{\leq s} = | \{ X^\alpha : |\alpha | \leq s-d \} |\). Hence, \begin {align*} HF_I(s) &= { n+s \choose n } \text {\ \ if \ \ } s < d \\ &= { n+s \choose n} - {n+s-d \choose n} = \frac {d}{(n-1)!} s^{n-1} + \text {lower order terms}. \text {\ \ if \ \ } s \geq d \end {align*}
Lemma 4.15. (Macaulay) Let us equip \(k[X_1,\ldots , X_n]\) with graded lexicographic order \(\leq _{grlex}\). Let \(I\) be an ideal, and \(\ini (I) = (LT(f) : f \in I)\). Then, \[ HF_{I}(s) = HF_{\ini (I)}(s) \text {\ \ for all\ \ }s \geq 0. \]
Proof. \(I_{\leq s}\) contains only a finite number of monomials \[ \{ LM(f) : f \in I_{\leq s} \} = \{ LM(f_1),\ldots , LM(f_m) \} \] where \(f_1, \ldots , f_m \in I_{\leq s}\) and \(LM(f_1) > LM(f_2) > \ldots > LM(f_m)\).
We will show that (a) \(\{f_1,\ldots , f_m\}\) is a \(k\)-basis of \(I_{\leq s}\), (b) \(\{ LM(f_1), \ldots , LM(f_m) \}\) gives a \(k\)-basis for \(\ini (I)_{\leq s}\). (This implies the stated result.)
Linear independence for (a): Suppose there exists \(a_i\) not all zero such that \(\sum _{i=1}^m a_i f_i =0\). Choose the smallest \(i=i_0\) such that \(a_{i_0} \neq 0\). Then \[ 0 = a_{i_0} f_{i_0} + a_{i_0+1} f_{i_0+1} + \ldots + a_m f_m \] but \(LM(f_i) < LM(f_{i_0})\), so we have a contradiction.
Linear independence for (b): clear.
Spanning property for (a): Let \(f \in I_{\leq s}\). Then \(LM(f) = LM(f_i)\) for some \(i\). Hence \(LT(f) = c LT(f_i)\) for some \(c \in k\). Consider \(f' = f - c f_i \in I_{\leq s}\). If \(f'=0\), then \(f = cf_i\) as desired. Otherwise, \(LM(f') < LM(f)\) (strictly smaller). Hence, repeat the argument with \(f'\).
Spanning property for (b): Let \(g \in \ini (I)_{\leq s}\). Then \(g = \sum _j h_j LT(g_j)\) for some \(h_j \in k[X_1,\ldots , X_n]\) and \(g_j \in I\). We write \(h_j = \sum _\alpha a_{\alpha ,j} X^{\alpha _j}\) with \(a_{\alpha ,j} \in k\). Hence, \(g = \sum _{j, \alpha } a_{\alpha , j} X^{\alpha _j} LT(g_j) = \sum _{j,\alpha } a_{\alpha ,j} LT(X^{\alpha _j} g_j)\). Since \(X^{\alpha _j} g_j \in I\), by letting \(g_{\alpha ,j} = X^{\alpha _j}g_j\), we can write \(g = \sum _{\alpha , j} a_{\alpha ,j} LT(g_{\alpha ,j})\) with \(a_{\alpha ,j} \in k\) and \(g_{\alpha ,j} \in I\). Now, \(LT(g_{\alpha ,j}) \leq LT(g)\), hence (using the graded lex order) we see that \(deg(g_{\alpha ,j}) \leq deg(g) \leq s\). Therefore, \(g\) is a linear combination of \(LM(f_1), \ldots , LM(f_m)\). □
\(\blacktriangleright \) Let \(I = (Y-X^2, Z-X^3) \subset k[X,Y,Z]\). Using \(\leq _{grlex}\), one can show that \(G=\{ X^2-Y,XY-Z, XZ-Y^2,Y^3-Z^2 \}\) is a Gröbner basis. For example, here is how to do it in Macaulay2:
R = QQ[x,y,z, MonomialOrder => GLex]; I = ideal (y-x^2,z-x^3); gens gb I
Thus, \(\ini (I) = (X^2,XY,XZ,Y^3)\). From which, we deduce that \(C(I) = \{1, X, Y,Z \} \cup \{ Z^{s}, Y Z^{s-1}, Y^2 Z^{s-2}\}_{s \geq 2}\) and \(HP_I(t) = 3t+1\).
Theorem 4.16. Let \(I \subset k[X_1,\ldots , X_n]\). There exists a unique polynomial, called the Hilbert polynomial, \(HP_I(t) \in \mathbb {Q}[t]\) and a positive number \(s_0 \geq 0\) such that \[ HF_I(s) = HP_I(s) \text { \ \ for all \ \ } s \geq s_0 \] If \(I=k[X_1,\ldots ,X_n]\) then \(HP_I(t)=0\), otherwise \(HP_I(t) \neq 0\). Write \[ HP_I(t) = a_d t^d + a_{d-1}t^{d-1} + \ldots +a_0\] then \(a_i d! \in \mathbb {Z}\) for all \(i\) and \(a_d d! > 0\).
Proof. By the previous lemma, we may assume without loss of generality that \(I = \ini (I) = (X^{\beta ^{(1)}}, \ldots , X^{\beta ^{(m)}})\) is a monomial ideal with \(\beta ^{(i)} \in \mathbb {N}^n\). Now, since \(I\) is a monomial ideal, a polynomial \(f\) is in \(I\) if and only if each term of \(f\) is divisible by an \(X^{\beta ^{(i)}}\) for some \(i\). Therefore \(f \in I_{\leq s}\) is generated by \(\{ X^\alpha : |\alpha | \leq s \text { and } X^{\beta ^{(i)}} \mid X^\alpha \text { for some } i \}\). Put \(C(I) \coloneqq \{\alpha \in \mathbb {N}^n : X^{\beta ^{(i)}} \nmid X^\alpha \text { for any } i \}\) and \(C(I)_{\leq s} \coloneqq \{ \alpha \in \mathbb {N}^n : |\alpha | \leq s, \alpha \in C(I) \}\). Thus, it follows that \[ HF_I(s) = | C(I)_{\leq s} |. \]
Next, we need to compute \(|C(I)_{\leq s}|\). We will show that \(C(I)\) is a finite union of translates of coordinate subspaces, which we denote as follows: for \(J \subset \{1,2,\ldots , n\}\) and a function \(\tau : J \to \mathbb {N}\), we set \[ C(J,\tau ) \coloneqq \{ (\alpha _1,\ldots , \alpha _n) \in \mathbb {N}^n : \alpha _j = \tau (j) \text { for all } j \in J \} \] Extend \(\tau \) to \(\{1,\ldots , n\}\) by setting \(\tau (i)=0\) for \(i \notin J\). Then \[ C(J,\tau ) = \{ (\alpha _1 + \tau (1), \ldots , \alpha _n + \tau (n)) : \alpha = (\alpha _1,\ldots , \alpha _n) \in \mathbb {N}^n \text { such that } \alpha _j = 0 \text { for all } j \in J \} \] Let \(\tau = \sum _{j \in J} \tau (j)\). We have \begin {align*} |C(J,\tau )_{\leq s}| = | \{ \alpha \in \mathbb {N}^n : |\alpha | \leq s - |\tau | \text { and } \alpha _j = 0 \text { for all } j \in J\} | &= { n- |J| + s - |\tau | \choose n - |J| } \\ &= \frac {1}{d!} (s^d + \text { lower order terms )} \end {align*}
provided \(s > |\tau |\), in which case it is a polynomial in \(s\) of degree \(d=n-|J|\).
We also note that for two pairs \((J,\tau )\) and \((J',\tau ')\), we have \[ C(J,\tau ) \cap C(J',\tau ') = \begin {cases} \emptyset \text { if } J \cap J' \neq \emptyset \text { and } \tau (j) \neq \tau '(j) \text { for some } j \in J\cap J' \\ C(J \cup J', \tau \cup \tau ') \text { otherwise } \end {cases} \] Claim: There exists a finite collection \(\mathcal {J}\) of pairs \((J,\tau )\) such that \[ C(I) = \bigcup _{(J,\tau ) \in \mathcal {J}} C(J,\tau ) \]
For \(\beta \in \mathbb {N}^n\) let \(C(\beta ) = \{ \alpha \in \mathbb {N}^n : X^\beta \nmid X^\alpha \}\). Then \(C(I) = \bigcap C(\beta ^{(i)}) \). We first show that \(C(\beta )\) can be covered by some \(C(J,\tau )\). Indeed, \(\alpha \in C(\beta )\) if and only if there exists an \(i \in \{1,\ldots , n\}\) such that \(\alpha _i < \beta _i\). Hence, \[ C(\beta ) = \bigcup _{i=1}^n \bigcup _{t_i=0}^{\beta _i -1} \{ (\alpha _1,\ldots ,\alpha _n) : \alpha _i = t_i \} = \bigcup _{i=1}^n \bigcup _{t_i} C(\{ t_i \} , \tau : i \to t_i) = \bigcup _{(J,\tau )} C(J,\tau ) \] where in the last equality, we have avoided to specify which specific \((J,\tau )\) are used in order to avoid cumbersome notation. It suffices to note that there are only finitely many \((J,\tau )\) that are being used. Now, the claim follows from \[ C(I) = \bigcap _{i=1}^m C(\beta ^{(i)}) = \bigcap _{i=1}^m \bigcup _{(J,\tau )} C(J,\tau ) = \bigcup \{\text {\ intersections of\ }C(J,\tau )\ \} = \bigcup _{(J,\tau ) \in \mathcal {J}} C(J,\tau ) \] The theorem now follows from the inclusion-exclusion principle: If \(A_1,\ldots , A_k\) are finite sets then \[ |A_1 \cup A_2 \cup \ldots \cup A_k| = \sum _{r=1}^k \sum _{1 \leq i_1 < \ldots < i_r \leq m} (-1)^{r-1} | A_{i_1} \cap \ldots \cap A_{i_r} | \] Applying this to \(C(I)\) written as a union of \(C(J,\tau )\) gives the desired polynomial \(HP_I(t)\). Moreover, the degree can be computed as \[ \mathrm {deg} HP_I(t) = \mathrm {max} \{ n- |J| : \exists (J,\tau ) \text { with } C(J,\tau ) \subset C(I) \} \] □