Showing a morphism of affine varieties is surjective Let $X$ and $Y$ be affine varieties such that the coordinate ring $A(Y)$ is a subring of $A(X)$. Let
$$\pi:X\to Y$$
be the morphism induced by the inclusion $A(Y)\subseteq A(X)$. I need to show that $\pi$ is surjective if it satisfies the following condition:

If $J=(g_1,\ldots,g_n)\subseteq A(Y)$ is an ideal such that $J\cdot A(X)=A(X)$, then $J=A(Y)$.

I have a lot of trouble understanding how this condition can imply that $\pi$ is surjective. I don't know where to start. I start with "let $P\in Y$", but then what ideal $J$ do we take?
 A: Let $k$ be the field you're working over.  If $A$ is the coordinate ring of an affine variety $Y$, then $Y$ can be identified with the set of maximal ideals of $A$.  Let $X$ be the set of maximal ideals of a ring $B$, and assume $A$ is a subring of $B$.  The inclusion map $A \rightarrow B$ corresponds to the morphism of varieties $X \rightarrow Y$ given by $\mathfrak M \mapsto \mathfrak M \cap A$.  (Since $A, B$ are finitely generated $k$-algebras, $\mathfrak M \cap A$ is actually a maximal ideal of $A$.)
Your problem now becomes the following: suppose $A, B$ are rings with $A$ a subring of $B$. Suppose that whenever $J$ is a proper ideal of $A$, $JB$ is a proper ideal of $B$.  Show that every maximal ideal of $A$ is equal to $\mathfrak M \cap B$ for some maximal ideal $\mathfrak M$ of $B$.
Here's how you can start the proof: let $\mathfrak m$ be any maximal ideal of $A$.  By hypothesis, $\mathfrak m B$ is a proper ideal of $B$.  So it must be contained in at least one maximal ideal $\mathfrak M$ of $B$.  Now what?
A: The key point is that given a subvariety $Z\subset Y$ with ideal $I(Z)=J\subset A(Y)$, its inverse image is the variety  $\pi^{-1}(Z)=V(J.A(X))$ determined by the extension ideal $J^e=J.A(X)$.
[Atiyah-Macdonald, Chapter 1, Exercise 21 ii)]
In particular, taking $Z=\{y\}$, a single point of $Y$, we have $J=I(Z)\neq A(Y)$ so that your hypothesis (displayed in yellow) implies by contraposition that $J. A(X)\neq A(X)$.
The weak Nullstellensatz [Fulton, Chapter 1, §7, page 10] then implies that  $\pi^{-1}(Z)=V(J. A(X))\neq \emptyset$, so that indeed $y\in\pi(X)$ and $\pi$ is surjective, just as you wished.  
Edit (optional !)
Notice that the assumption that $A(Y)$ be a subring of $A(X)$ was not used: the proof works if one only assumes that one starts with an arbitrary  morphism of rings $u:A(Y)\to A(X)$ with the highlighted property on ideals $J\subset A(Y)$.
However, since $\pi=u^\ast$ has now been proved to be surjective, we can actually  deduce that indeed $u$ was injective all along, thanks to Atiyah-Macdonald's Chapter 1, Exercise 21 v). 
A: $\pi$ is induced by a morphism $f:A(Y)\rightarrow A(X)$. The condition implies that if $I$ is an ideal distinct of $A(Y)$, $f^{-1}(I)$ is distinct of $A(X)$. In particular, if $I$ is a prime, $A(X)/f^{-1}(I)\rightarrow A(Y)/I$ is an injective map, thus $A(X)/f^{-1}(I)$ is a non trivial principal domain. Thus $f^{-1}(I)\in Spec(A(X))$ and $\pi(f^{-1}(I))=I$.
