TITLE: Every curve in $\mathbb{A}^3$ is the zero-locus of $3$ polynomials
QUESTION [5 upvotes]: I have the following problem:

Let $X \subset \mathbb{A}^3$ which doesn't contain a vertical line and let $g \in K[x,y]$ such that $g$ hasn't any double factor and the clousure of the projection of $X$ over the plane $z=0$ is equal to $\mathcal{V}(g)$, the zero-locus of $g$ in $\mathbb{A}^2$. Let $h(x,y,z) = \sum_{i=0}^l g_i(x,y)z^i$ be the polynomial in $\mathcal{I}(X)$ with the lower degree in $z$ posible. Then

If $f \in \mathcal{I}(X)$ of degree $m$ in $z$ ($m \geq l$), prove that 
  $$g_l^m f = hu + v$$
  for some $u(x,y,z)$ and $v(x,y)$ with $g|v$.
Deduce that $\mathcal{V}(h,g) = X \cup \mathcal{V}(g_l,g)$ are now seen as $g_l,g \in K[x,y,z]$.
Prove that every curve in $\mathbb{A}^3$ is he zero-locus of $3$ polynomials.


I have no problems with 1., but with 2. I'm stuck proving that $\mathcal{V}(g_l,g) \subset \mathcal{V}(h)$ and with 3. I have no ideas. I've tried everything but nothing works, can someone healp me?
An easy consequence of this is that every curve in $\mathbb{P}^3$ is the zero-locus set of $3$ homogeneous polynomials.

I know that there exist $g$ and $h$ by other exercise and, of course, $K$ is algebraically closed.

I decided to add the exercise I mentioned above, because maybe it is relevant.

Let $X \subset \mathbb{A}^3$ a curve (not necessarily irreducible) which doesn't contain a vertical line.

Show that there exist a non constant polynomial $g \in K[x,y]$ such that $g = \mathcal{I}(X)$.
Deduce thet there exist a principal ideal in $K[x,y]$, radical, whose zero-locus set is the closure of the projection of $X$ over the plane $z = 0$.

REPLY [3 votes]: Let's prove the result of 3) when $X$ is irreducible: 

Any irreducible curve in $\mathbb A^3$ is set-theoretically intersection of three hypersurfaces. 

First in 2) we have $V(h,g)\subseteq X\cup V(g_l, g)$ because if $(a,b,c)\in V(h,g)$ and $(a,b,c)\notin X$, then there exists $f\in I:=\mathcal I(X)$ such that $f(a,b,c)\ne 0$. By 1), $g_l^mf$ vanishes at $(a,b,c)$, hence $(a,b,c)\in V(g_l)$. This point belongs to $V(g)$ by hypothesis, so it belongs to $V(g_l, g)$. 
Denote by $p: \mathbb A^3\to \mathbb A^2$  the projection to the $(x,y)$-plane. As $g_l\notin I$ (otherwise $h$ is not of minimal degree in $z$), $g_l\notin gK[x,y]$. Hence $F:=p(V(g_l, g))$ is finite (here we use the hypotheis $X$ irreducible which implies that $g$ is irreducible). 

Claim: there exists $f_0\in I$ such that $V(f_0)\cap p^{-1}(\alpha)\subset X$ for all $\alpha\in F$. 

If this holds, $p^{-1}(F)\cap V(f_0)\subseteq X$ and $X=V(h,g, f_0)$. 
For any $\alpha\in F$, let $\mathfrak p_\alpha$ be the prime ideal of $K[x,y,z]$ corresponding to the line $p^{-1}(\alpha)$. If $\alpha\ne \beta$, then $K[x,y,z]\cap \mathfrak p_\alpha$ and $K[x,y,z]\cap \mathfrak p_\beta$ are coprime ideals in $K[x,y]$ (they generate the unit ideal). So $\mathfrak p_\alpha$ and $\mathfrak p_\beta$ are coprime in $K[x,y,z]$. By the Chinese remainder theorem, the canonical map
$$ K[x,y,z]\to \prod_{\alpha\in F} (K[x,y,z]/\mathfrak p_\alpha)$$ 
is surjective. So 
$$ I \to \prod_{\alpha\in F} (I/\mathfrak p_\alpha I)\to  \prod_{\alpha\in F} I_\alpha$$ 
are surjective, where $I_\alpha$ is the image of $I$ in $K[x,y,z]/\mathfrak p_\alpha$. We have $V(I_\alpha)=X\cap p^{-1}(\alpha)$ (as sets) and $K[x,y,z]/\mathfrak p_\alpha\simeq K[z]$, so there exists $f_\alpha\in I_\alpha$ such that $V(f_\alpha)=X\cap p^{-1}(\alpha)$. 
Now let $f_0\in I$ whose image in $I_\alpha$ for all $\alpha\in F$ is $f_\alpha$. Then 
$$V(f_0)\cap p^{-1}(\alpha)=V(f_\alpha)\cap p^{-1}(\alpha)\subseteq X$$
and we are done.