# Matrix % GroebnerBasis -- calculate the normal form of ring elements and matrices using a (partially computed) Gröbner basis

## Synopsis

• Operator: %
• Usage:
f % G
• Inputs:
• f, , or
• G,
• Outputs:
• the normal form of f with respect to the partially computed Gröbner basis G

## Description

In the following example, the seventh power of the trace of the matrix M is in the ideal generated by the entries of the cube of M. Since the ideal I is homogeneous, it is only required to compute the Gröbner basis in degrees at most seven.
 i1 : R = QQ[a..i]; i2 : M = genericMatrix(R,a,3,3) o2 = | a d g | | b e h | | c f i | 3 3 o2 : Matrix R <--- R i3 : I = ideal(M^3); o3 : Ideal of R i4 : f = trace M o4 = a + e + i o4 : R i5 : G = gb(I, DegreeLimit=>3) o5 = GroebnerBasis[status: DegreeLimit; all S-pairs handled up to degree 3] o5 : GroebnerBasis i6 : f^7 % G == 0 o6 = false i7 : gb(I, DegreeLimit=>7) o7 = GroebnerBasis[status: DegreeLimit; all S-pairs handled up to degree 7] o7 : GroebnerBasis i8 : f^7 % G o8 = 0 o8 : R i9 : gb I o9 = GroebnerBasis[status: done; S-pairs encountered up to degree 9] o9 : GroebnerBasis
In these homogeneous situations, Macaulay2 only computes the Gröbner basis as far as required, as shown below.
 i10 : I = ideal(M^3); o10 : Ideal of R i11 : G = gb(I, StopBeforeComputation=>true) o11 = GroebnerBasis[status: not started; all S-pairs handled up to degree -1] o11 : GroebnerBasis i12 : f^7 % I o12 = 0 o12 : R i13 : status G o13 = status: DegreeLimit; all S-pairs handled up to degree 7