Showing the set of zero-divisors is a union of prime ideals I'm working on an exercise from Atiyah and MacDonald's Commutative Algebra, and have hit a bump on Exercise 14 of Chapter 1. 

In a ring $A$, let $\Sigma$ be the set of all ideals in which every element is a zero-divisor. Show that set $\Sigma$ has maximal elements and that every maximal element of $\Sigma$ is a prime ideal. Hence the set of zero-divisors in $A$ is a union of prime ideals.

I see by an application of Zorn's Lemma that $\Sigma$ has maximal elements. I take $\mathfrak{m}$ to be maximal in $\Sigma$, with $xy\in\mathfrak{m}$. Since $xy$ is a zero divisor, $xyz=0$ for some $z\neq 0$. If $yz=0$, then $y$ is a zero divisor, otherwise $x$ is a zero divisor. So I guess I then want to show $x\in\Sigma$ or $y\in\Sigma$. If neither is, then $\mathfrak{m}$ is properly contained in both $(\mathfrak{m},x)$ and $(\mathfrak{m},y)$. However, I'm not sure how to show either of these ideals is again in $\Sigma$. 
If my understanding is correct, elements of $(\mathfrak{m},x)$ are finite sums of the form $\sum_ia_im_i+bx$ for $a_i\in A$, $m_i\in\mathfrak{m}$ and $b\in A$. To show this sum is a zero divisor, my hunch is that if $c_im_i=0$ for $c_i\neq 0$ and $dx=0$ for $d\neq 0$, then 
$$
\left(\sum_ia_im_i+bx\right)(d\prod_ic_i)=0.
$$
My concern is that perhaps $d\prod_ic_i=0$, so the above wouldn't show that $(\mathfrak{m},x)$ consists of only zero divisors. How can I get around this? Or is there perhaps a better approach? Thank you for your help.
 A: An elements of $(\mathfrak{m},x)$ can be described as $m_1+a_1 x$ where $m_1 \in \mathfrak{m}$ and $a_1 \in A$, a little simpler than yours. And I think it is better to assume that $x \notin \mathfrak{m}, y \notin \mathfrak{m} $ then deduce a contradiction, since $(\mathfrak{m},x)$ alone may properly contain $\mathfrak{m}$, but both $(\mathfrak{m},x) \supsetneq \mathfrak{m}$, $(\mathfrak{m},y) \supsetneq \mathfrak{m}$ makes a contradiction.
So assume that $xy \in \mathfrak{m}$ with $(\mathfrak{m},x) \supsetneq \mathfrak{m}$, $(\mathfrak{m},y) \supsetneq \mathfrak{m}$, then there are $m_1+a_1 x \in (\mathfrak{m},x)$ and $m_2+a_2 y \in (\mathfrak{m},y)$ which are not 0-divisors. Then $(m_1+a_1 x)(m_2+a_2 y) \in \mathfrak{m}$ since $xy$ is in $\mathfrak{m}$. But this is a contradiction, since a product of non 0-divisors is not a 0-divisor.
A: Zev's answer is excellent. However, here are some exercises that provide practice with the technique Zev introduced (all rings are commutative and have a multiplicative identity):
Exercise 1: Let $A$ be a ring with at least one non-principal ideal. Let $\Sigma$ be the set of all ideals of $A$ that are not principal. Prove that $\Sigma$ has maximal elements and that maximal elements of $\Sigma$ are prime. (Hint: study my answer carefully.)
Exercise 2: Let $A$ be a ring with at least one non-finitely generated ideal. Let $\Sigma$ be the set of all ideals of $A$ that are not finitely generated. Prove that $\Sigma$ has maximal elements and that maximal elements of $\Sigma$ are prime. (Hint: let $I$ be a maximal element of $\Sigma$. If $I$ is not prime, then there exists $x,y\not\in I$ such that $xy\in I$. Use the fact that $I+(x)$ is finitely generated and that $(I:x)$ is finitely generated. Why are these ideals finitely generated?)
Exercise 3: Let $S$ be a multiplicatively closed subset of $A$ such that $0\not\in S$. (Definition: $S$ is closed under multiplication and $1\in S$.) Let $\Sigma$ be the set of all ideals $I$ such that $I\cap S = \emptyset$. Note that $\Sigma\neq \emptyset$ since $0\in \Sigma$. Prove that $\Sigma$ has maximal elements and that a maximal element $I$ of $\Sigma$ is a prime ideal. (Hint: use the technique Zev introduced.)
A: Let $\frak{m}$ be a maximal element in $\Sigma$. We want to show it is prime, i.e. that if $x\notin\frak{m}$ and $y\notin\frak{m}$, then $xy\notin\frak{m}$. 
If $x\notin\frak{m}$ and $y\notin\frak{m}$, then ${\frak{m}}+(x)$ and ${\frak{m}}+(y)$ are both ideals of $A$ that strictly contain $\frak{m}$, and therefore each must contain non-zero-divisors ($\frak{m}$ is maximal among ideals consisting only of zero-divisors, so any ideal strictly containing $\frak{m}$ cannot consist only of zero-divisors). Thus the ideal $({\frak{m}}+(x))({\frak{m}}+(y))\subseteq{\frak{m}}+(xy)$ contains non-zero-divisors (because there is at least one non-zero-divisor in each of ${\frak{m}}+(x)$ and ${\frak{m}}+(y)$, and the product of two non-zero-divisors is a non-zero-divisor). But the fact that ${\frak{m}}+(xy)$ contains non-zero-divisors implies that ${\frak{m}}+(xy)$ strictly contains $\frak{m}$, hence $xy\notin\frak{m}$. Thus $\frak{m}$ is prime.
A: Hint $ $ The non-zero-divisors form a saturated monoid $\rm\:M\:$ (i.e. $\rm\:ab\in M\!\iff\! a\in M\:$ & $\rm\:b\in M$) so its complement is a union of prime ideals (this can be proved either by localization, or by a direct elementary proof using that an ideal maximal wrt the exclusion of a monoid is prime). For a nice exposition see the first few pages of Kaplansky: Commutative Rings.
Note $ $ For generalizations, see Lam and Reyes: Oka and Ako Ideal Families in Commutative Rings mentioned by Zev, and the paper reviewed below.

MR 95i:13023  13G05 06F20
Anderson, D. D.; Zafrullah, Muhammad
On a theorem of Kaplansky.
Boll. Un. Mat. Ital. A (7) 8 (1994), no. 3, 397--402.
The complement of a saturated multiplicatively closed set is a union of prime
ideals (Bourbaki). $\ $ The authors apply this fact to a property (*) of non-zero
elements in an integral domain such that the elements satisfying (*) form
a saturated multiplicatively closed set. Suitable choices of (*) yield
characterizations of UFDs [I. Kaplansky, Commutative rings, Univ. Chicago
Press, Chicago, IL, 1974; MR 49 #10674], GCD domains, valuation and Prüfer
domains. Lattice ordered groups and Riesz groups are characterized similarly. [Reviewed by C. P. L. Rhodes]

Zbl 816.13001
Analyzing the proof of Kaplansky's theorem, that an integral domain is a
unique factorization domain if and only if every nonzero prime ideal contains
a nonzero principal prime ideal, the authors state - leaving the proof to the
reader:
Let D be an integral domain. Let (*) be a property of elements in D.
Assume that the set S of nonzero elements in D with (*) is a nonempty
saturated multiplicatively closed set. Then every nonzero element in D has
(*) if and only if every nonzero prime ideal contains a nonzero element with
(*). This observation is then applied to various situations, to characterize

*

*integral domains that are UFD's,

*integral domains that are valuation domains,

*integral domains that are Pruefer domains,

*directed partially ordered groups that are lattice-ordered,

*directed partially ordered groups that are Riesz groups.

[ K.Roggenkamp (Stuttgart)]
A: The following steps lead to a solution:
(1) If $a\in\Sigma$ is not a prime ideal, we will show that $a$ is not a maximal element of $\Sigma$. Since $a$ is not a prime ideal, there exists $x,y\not\in a$ such that $xy\in a$. The ideal $(a:x)=\{z\in A:xz\in a\}$ can be considered.
(2) Prove that $a\subseteq (a:x)$ and that this inclusion is proper.
(3) Prove that $(a:x)$ consists entirely of zero-divisors. (Hint: If not, then there exists $z\in (a:x)$ such that $z$ is not a zero divisor. Deduce that $(a:z)\in \Sigma$.) 
(4) Show that $a$ is not maximal. (Hint: The inclusion $a\subseteq (a:z)$ is proper. Why?)
