## If the set of all nonunits in a commutative ring is an ideal, then it forms the unique maximal ideal

A commutative ring $R$ is called local if it has a unique maximal ideal. Prove that if $R$ is a local ring with a maximal ideal $M$ then every element of $R \setminus M$ is a unit. Prove conversely that if $R$ is a commutative ring with $1 \neq 0$ in which the set of nonunits forms an ideal $M$, then $R$ is a local ring with unique maximal ideal $M$.

Let $u \in R \setminus M$. Consider the ideal $(u)$; if proper, this ideal must be contained in some maximal ideal, and $M$ is the only maximal ideal. Thus $(u) \subseteq M$, a contradiction since $u \notin M$. Thus $(u) = R$, and for some $v \in R$ we have $uv = vu = 1$. Thus $u$ is a unit.

Suppose now that the set $M$ of nonunits in $R$ form an ideal. First we show that $M$ is maximal. If $M \subsetneq I$ for some ideal $I$, then $I$ contains a unit, so that $I = R$. Now we show that $M$ is the unique maximal ideal. Suppose that we have an ideal $N \subseteq R$ such that $N \not\subseteq M$. Then $N$ contains some element $x$ not in $M$, which is a unit. Thus $N = R$. In particular, every proper ideal of $R$ is contained in $M$. Thus $M$ is the unique proper ideal of $R$, and $R$ is local.