# Strange behavior of GroebnerBasis

Recently I tried to solve a multivariate quadratic equation over the reals, but with a parameter value. Since that took too long, I decided to try GroebnerBasis, but encountered a strange behavior. My polynomials are too long, but I could find a reduced case with the same behavior.

When I try GroebnerBasis[1/(Pi (Pi - 1)) + x, {x}], I get

{-(1/((1 - \[Pi]) \[Pi])) + x}


which is to be expected, but when I try GroebnerBasis[1/(n (n - 1)) + x, {x}], I get

{1 - 1/(1 - n) + n/(1 - n), -(1/(1 - n)) - 1/n +
1/((1 - n) n), -(1/(1 - n)) - 1/n + x}


Here, $$n$$ is supposed to be a parameter value.

Of course, among these 3 items, the first two are zeros, and we get the original polynomial as the third item, so technically the ideal spanned by these three items are the same as the principal ideal generated by the given polynomial. But why do I get two additional zeros in the Groebner basis of a principal ideal?

• Under the hood GB creates new internal variables and relations to handle the denominators. In post-processing it converts back to the original expressions. Hence one can get these "zeros" as rational functions in the result. The proper way to handle this is as shown in the reply by @DanielHuber. Nov 27, 2023 at 17:18

GroebnerBasis[1/(n (n - 1)) + x, {x, n}]

GroebnerBasis[1/(n (n - 1)) + x, {x}, CoefficientDomain -> RationalFunctions]