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.