Proof regarding $\operatorname{Spec}A$ being irreducible (Atiyah-MacDonald). I'm working on exercise 19 on chapter 1 of Atiyah-MacDonald's Commutative Algebra. The question asks to prove that $X=\operatorname{Spec}A$ is irreducible (any intersection of open sets is non-empty) if and only if the nilradical $\mathfrak{N}$ is a prime ideal.
To prove the forward implication, suppose $X$ is irreducible, and that $ab\in\mathfrak{N}$. Since $X$ is irreducible, $(X-V(a))\cap(X-V(b))\neq\varnothing$ where $V(E) = \{\mathfrak{p}\in X : E\subset\mathfrak{p}\}$, thus there is some prime ideal $\mathfrak{p}$ containing neither $a$ nor $b$ (since $\mathfrak{p}\in X-V(a)\iff\mathfrak{p}\not\ni a$), but then $ab \in \mathfrak{N}\subset\mathfrak{p}$, but $\mathfrak{p}$ is prime, so we can't have $ab\in\mathfrak{p}$ while neither $a$ nor $b$ belong to $\mathfrak{p}$. 
What went wrong? The use of the nilradical here isn't important either. I believe the assertion is true, but why am I running into an evident contradiction before the proof even starts? I didn't start by assuming anything contradictory to start.
Edit: I think I see the error, I erroneously assumed that $X-V(a)$ is necessarily non-empty. Assuming that both $X-V(a)$ and $X-V(b)$ are non-empty yields a contradiction. WLOG, say $X-V(a)$ is empty, that is $X=V(a)$ meaning every prime ideal must contain $a$, thus $a$ is in the nilradical which proves the nilradical is prime. Is this right?
 A: The nilradical $\mathfrak{N}$ of a commutative ring is the intersection of all the prime ideals in the ring. 
Suppose first that $\mathrm{Spec}(A)$ is irreducible. Now let $ab \in \mathfrak{N}$. This means that every prime ideal of $A$ contains $ab$. Therefore, $\mathrm{Spec}(A) = V(ab) = V(a) \cup V(b)$. Since $\mathrm{Spec}(A)$ is irreducbile, this means either $\mathrm{Spec}(A) \subset V(a)$ or $\mathrm{Spec}(A) \subset V(b)$. Therefore, either $a$ or $b$ is contained in all the primes ideals of $\mathrm{Spec}(A)$, that is, either $a \in \mathfrak{N}$ or $b \in \mathfrak{N}$. I think it's more 'natural' to work with closed subsets as the Zariski topology is defined in terms of closed subsets.
Suppose $\mathfrak{N}$ is a prime ideal of $A$. Now $\mathrm{Spec}(A) = V(\mathfrak{N})$. Any closed subset $V(I)$, where $I$ is an ideal of $A$, contains $\mathfrak{N}$ if and only if $I$ is contained in all the prime ideals of $A$, that is, $I \subset \mathfrak{N}$, which implies $V(\mathfrak{N})\subset V(I)$. So $V(\mathfrak{N})$ is the smallest closed subset containing  $\mathfrak{N}$. So $\mathrm{Spec}(A) = \overline{ \{ \mathfrak{N} \}}$ is the closure of a single point, therefore it is irreducible.
More generally, for any subset $Y$ of $\mathrm{Spec}(A)$, you can define $I(Y) := \bigcap_{\mathfrak{p} \in Y} \mathfrak{p}$. Similar arguments as above also show that $Y$ is irreducible if and only if $I(Y)$ is a prime ideal.
