In commutative algebra the Hilbert–Samuel function, named after David Hilbert and Pierre Samuel, of a nonzero finitely generated module M {\displaystyle M} over a commutative Noetherian local ring A {\displaystyle A} and a primary ideal I {\displaystyle I} of A {\displaystyle A} is the map χ M I : N → N {\displaystyle \chi _{M}^{I}:\mathbb {N} \rightarrow \mathbb {N} } such that, for all n ∈ N {\displaystyle n\in \mathbb {N} } ,
where ℓ {\displaystyle \ell } denotes the length over A {\displaystyle A} . It is related to the Hilbert function of the associated graded module gr I ( M ) {\displaystyle \operatorname {gr} _{I}(M)} by the identity
For sufficiently large n {\displaystyle n} , it coincides with a polynomial function of degree equal to dim ( gr I ( M ) ) {\displaystyle \dim(\operatorname {gr} _{I}(M))} , often called the Hilbert-Samuel polynomial (or Hilbert polynomial).