Surjectivity of the induced map of affine algebraic sets For a morphism $f: X\rightarrow Y$ of affine algebraic sets, I want to show that if the induced map $f^*:k[Y]\rightarrow k[X]$ is surjective then $f(X)$ is closed.
I am trying to prove that $f(X)=Z(\ker f^*)$. The direction $f(X)\subset Z(\ker f^*)$ is easy but I am stuck for the other one.
I know it was asked before (Why does surjectivity of the induced map show that a morphism of affine varieties has closed image?) but the solution offered showed that $f$ surjective implied $f^*$ has a closed image.
Thanks!
 A: The stars may be a bit confused so let me give everything a letter, let $f\colon X \to Y$ be the map of affine algebraic sets, $g\colon k[Y] \to k[X]$ the induced map on coordinate rings, and $h\colon\mathrm{Spec} \ k[X] \to \mathrm{Spec} \ k[Y]$ the map that $g$ induces on the prime spectrum.
Assume $g$ is surjective.  The answer you linked to shows that the image of $h$ is closed.  You want to know why the image of $f$ is closed.  To answer your question let 
$$\mathrm{MSpec} \ R = \{\mathfrak m \in \mathrm{Spec} \ R \ | \ \mathfrak m \ \text{maximal}\}$$
be what's called the maximal ideal spectrum of the ring $R$.  It's a subspace of the normal spectrum and as such has a topology.  The key point now is:
Theorem: If $k$ is algebraically closed and $X$ is affine algebraic over $k$ then $X$ is naturally isomorphic to $\mathrm{MSpec} \ k[X]$.
Moreover, if $f$, $g$, and $h$ are as above then under this isomorphism $f$ is just the restriction of $h$ to the maximal ideal spectrum.
Once you understand this you'll see that the question you've linked to does indeed answer the question you've asked because it proves that the image of $h$ is closed in the prime ideal spectrum and we now know that the image of $f$ is simply the intersection of the image of $h$ with the maximal ideal spectrum, and hence is closed in the maximal ideal spectrum.
A: Let  $X \subset k^m$.  For every $1 \le i \le m$ there exist  $g_i$ in $k[Y]$ so that for the coordinate function $x_i$ in $k[X]$ we have
$$x_i = g_i(f(x))$$
We get a map $g \colon Y \to k^m$ such that 
$$x = g(f(x))$$ for all $x \in X$. ($\tiny{ \text{ We got the inverse map, just a bit more work needed.} }$)
Let $Z$ the Zariski closure of $\phi(X)$ in $Y$. Let's show first that 
$$g(Z) \subset X$$ 
Indeed, let $p_{\alpha}(x)=0$ equations giving $X$. Want to show that $p_{\alpha}(g(z))= 0$ for all $z \in Z$. Now $p_{\alpha}(g(f(x))= p_{\alpha}(x) = 0$ for all $x \in X$. Since $Z$ is the Zariski closure of $f(X)$ we conclude that $p_{\alpha}(g(z)) = 0$ for all $z \in Z$. 
We have maps 
$$f \colon X \to Z\\
g \colon Z \to X$$ 
and $$\mathbb{1}_X = g \circ f$$ Let's show that $$f\circ g = \mathbb{1}_Z$$ It's enough to show the equality on the dense subset $f(X)\subset Z$. We have
$$f\circ g( f(x) = f(g(f(x)) = f(x)$$
So $g$ is the inverse map of $f$, and therefore $f(X) = Z$ is closed. Moreover, the map $f\colon X \to f(X)$ is an isomorphism.
$\tiny{ \text{The proof works in other categories (analytic, smooth).}}$
A: Here is a proof of the other inclusion wich does not take the detour via affine schemes:
Because of the inclusion already shown, we can switch the codomain from $Y$ to $Z(\operatorname{ker}(f^*))$. This corresponds to taking the quotient of $k[Y]$ by $\operatorname{ker}(f^*)$. This quotient is isomorphic to $k[X]$ by the homomorphism theorem because $f^*$ is surjective. But then this implies that $X$ and $Z(\operatorname{ker}(f^*))$ are isomorphic via $f$. In particular $f(X)=Z(\operatorname{ker}(f^*))$.
what we are using here is the equivalence between algebraic sets and reduced finitely generated k-algebras. I hope I didn't mix up the order in which things are usually shown here.
