I am confused about a step in Hartshorne's proof (final part of Corollary 1.4) that an algebraic set $Y$ in affine n-space $\mathbb{A}^n$ having a prime ideal $I(Y)$ in the polynomial ring over $n$ variables $A$. The proof goes as follows:



> 
> Let $\mathfrak{p}$ be a prime ideal, and suppose $Z(p) = Y\_1 \cup Y\_2$. Then $p = I(Y\_1)$ intersection $I(Y\_2)$. Then (here is where I am confused!) $\mathfrak{p}$
>  equals $I(Y\_1)$ or $I(Y\_2)$. Then of course $Y$ equals $Y\_1$ or $Y\_2$, thus $Y$ is irreducible.
> 
> 
> 



If an algebraic set in affine n-space has a prime ideal then it is irreducible. (Hartshorne's Algebraic Geometry, Cor. 1.4)
If $P=I\cap J$ is prime, and if $P$ is not equal to $I$ or $J$, then choose $i\in I\setminus J$ and $j\in J\setminus I$. Then $ij\in P$, so $i\in P$ or $j\in P$. Contradiction either way. Thus $P=I$ or $P=J$.


