A Question from Algebraic Geometry For any two disjoint closed subsets $Y_1$ and $Y_2$ of $ \mathbb A ^n$ show that there exists $g \in\mathbb C [x_1, x_2, ..., x_n]$ such that $g(Y_1)=0$ and $g(Y_2)=1$.
 A: Let $A=\mathbb C [x_1, x_2, ..., x_n]$.
Since by the Nullstellensatz  any maximal ideal of $A$ is of the form $I=\langle x_1-a_1,\cdots,x_n-a_n\rangle $ and $Y_1,Y_2$ are disjoint, we deduce that no maximal ideal contains both $I(Y_1)$ and $I(Y_2)$, so that $I(Y_1)+I(Y_2)=A$.
We may thus apply the Chinese Remainder Theorem and conclude that the canonical morphism $A\to A/I(Y_1) \times A/I(Y_2)$ is surjective.
Thus there exists a polynomial $g\in A$ mapping to $(\overline 0,\overline 1)\in A/I(Y_1) \times A/I(Y_2)$ and such a polynomial $g$ solves your problem. 
Remark
Did I really have to use the heavy artillery of the Nullstellensatz to solve the problem? Yes!
Indeed the result is false over $\mathbb R$:
Consider  the line $Y_1=V(x-2)\subset \mathbb A^2(\mathbb R)$ and the  the  circle $Y_2=V(x^2+y^2-1)\subset \mathbb A^2(\mathbb R)$.
The varieties $Y_1,Y_2$ are disjoint but  no polynomial $g\in \mathbb R[x,y]$ can vanish on $Y_1$ and be equal to $1$ on $Y_2$. (This is not quite trivial but can be proved by looking at the complexified situation.)
