Ideals generated by two elements in the polynomial ring of two variables over a field Let $k$ be a field. For example, $k=\mathbb{Q}$ or  $\mathbb{Z}/p$, $p$ prime.
Let $k[x,y]$ be the polynomial ring.  
Let $f,g\in k[x,y]$.
Let the ideal $I=(f,g)$ be the ideal of $k[x,y]$ generqated by $f,g$.
Question. For $h\in k[x,y]$, I want to find whether there exists a smallest integer $n$ such that $h^n\in I$.
Is there any method?
Also I want to compute out the explicit smallest integer $n$. 
 A: If you want to determine whether there is an $n$ such that $h^n\in I$, consider the following (this requires passing to the algebraic closure):
$h^n\in I$ for some $I$ if and only if $h\in\sqrt{I}$ where $\sqrt{I}$ is the radical of $I$.
This is the same as $1\in\langle f,g,1-zh\rangle$ where $z$ is a new variable.  This follows from the following: 
Suppose (for contradiction) that $p\in\mathcal{V}(\langle f,g,1-zh\rangle)$ and $h\in\sqrt{I}$.  Then, $f(p)=0$ and $g(p)=0$, so $h(p)=0$ since $h^n=af+bg$ and $h^n(p)=af(p)+bg(p)=0$.  Therefore, $1-zh(p)\not=0$, a contradiction.  Therefore, $\mathcal{V}(\langle f,g,1-zh\rangle)=\emptyset$, and, by the Nullstellensatz, $1\in\langle f,g,1-zh\rangle$.
On the other hand, if $1\in\langle f,g,1-zh\rangle$, then, at any point $p\in\mathcal{V}(\langle f,g\rangle)$, $h(p)$ is zero because, otherwise, $(p,1/h(p))$ would be in $\mathcal{V}(\langle f,g,1-zh\rangle)$.  Therefore, $h$ vanishes on $\mathcal{V}(\langle f,g\rangle)$ and (again by the Nullstellensatz), $h$ is in the radical of $I$.
To summarize, you must compute a Groebner basis for $\langle f,g,1-zh\rangle$ and determine whether $1$ is in that ideal.
A: The magic words are Grobner basis and "saturation" (search for it in the wiki page).
