# Compute minimal number of generators of subring

Hi all,

Given a polynomial ring $R = k[x_1,...,x_n]$ over a field $k$ (say $\mathbb{Q}$) and a list of polynomials $p_1,..,p_n$ in $R$ (homogeneous say), is Sage capable of computing the minimal number of generators of the subring generated by $p_1,...,p_n$ over $k$?

Next, suppose $I$ is a homogeneous ideal of $R$. Can the same approach be used to compute the minimal number of generators of this subring after being projected to $R / I$ ?

Edit: Sorry for the bad formatting (see source), please help me fix it if you can!

Edit2: For example, let $R = \mathbb{Q} [x,y]$ and let $p_1 = x^2, p_2 = x^2 y, p_3 = x^4 y$. This generates a principal ideal, but as a subring it has 2 generators and it is those 2 generators that I want.

Edit3: In case it is helpful, the case I'm looking at is a ring with an action of a group, and its subring of invariants for which I have generators.

Edit4: Here's a suggested algorithm: sort the generators by degree. Then sequentially add them, and check if they were already in the subring. Does Sage even have suitable subring capabilities?

Welcome to Ask Sage! Thank you for your question!

Hint: a concrete example would help exploring this question.

For the suggested algorithm you might use the SAGBI functionality in Singular:

If this is sufficient, then I can add an answer showing how to do it from Sage.

Huh I guess so! I don't know Singular syntax - does it work over a base field like QQ? E.g. does sagbiReduce(x4y+(5/2)x6y, A) return 0? And please also let me know how to deal with projecting it to $R/I$ !

Singular works over a field of characteristic zero here, and yes

`sagbiReduce(x4y+(5/2)*x6y, A)`

returns`0`

. In SageMath you can do:Unfortunately I don't know how you would deal with $R/I$.