[proofplan]
The proof rests on two general principles in commutative algebra: every proper ideal lies in some maximal ideal (a Zorn's-lemma argument applied to the partially ordered set of proper ideals), and the maximal ideals are exactly the proper ideals not containing any unit. We prove the equivalence by separately establishing the two implications. The "if" direction is short: if $R \setminus R^\times$ is an ideal, every proper ideal consists of non-units and hence lies inside it, so it is the unique maximal ideal. The "only if" direction requires showing that the set of non-units of a local ring is closed under addition and absorbs multiplication; absorption is automatic, and additive closure follows because the sum of two non-units, if it were a unit, would not lie in the unique maximal ideal — contradiction.
[/proofplan]
[step:Record the standing conventions and the existence of maximal ideals]
We work with a commutative ring $R$ with identity $1 \neq 0$. Write $R^\times$ for the group of units, i.e. $\{u \in R : \exists v \in R,\ uv = 1\}$. By definition, $R$ is \emph{local} if it has exactly one maximal ideal.
We use the following two facts repeatedly:
\begin{itemize}
\item \textbf{Existence of maximal ideals containing a proper ideal.} Every proper ideal $I \subsetneq R$ is contained in some maximal ideal $\mathfrak{m}$ of $R$. This follows from Zorn's lemma applied to the poset of proper ideals containing $I$ (non-empty since $I$ is in it; chain-complete because the union of a chain of proper ideals is again a proper ideal — properness because none contains $1$, hence neither does the union).
\item \textbf{Characterisation of units via maximal ideals.} An element $x \in R$ is a unit if and only if $x$ lies in no maximal ideal. The "only if" direction is immediate: if $x \in R^\times$ and $x \in \mathfrak{m}$ for some maximal ideal $\mathfrak{m}$, then $1 = x x^{-1} \in \mathfrak{m}$, contradicting properness of $\mathfrak{m}$. The "if" direction: if $x$ is a non-unit, then $(x) \subsetneq R$ (proper, since otherwise $1 \in (x)$ would yield $1 = rx$ for some $r$, making $x$ a unit), so by the previous bullet $(x) \subset \mathfrak{m}$ for some maximal $\mathfrak{m}$, hence $x \in \mathfrak{m}$.
\end{itemize}
Equivalently, $R \setminus R^\times = \bigcup \{\mathfrak{m} : \mathfrak{m} \subset R \text{ maximal ideal}\}$.
[/step]
[step:Prove "if": when $R \setminus R^\times$ is an ideal, $R$ is local]
Suppose $\mathfrak{n} := R \setminus R^\times$ is an ideal of $R$. Note $\mathfrak{n}$ is a proper ideal: it does not contain $1$, since $1 \in R^\times$.
We claim $\mathfrak{n}$ is the unique maximal ideal of $R$.
\emph{$\mathfrak{n}$ contains every proper ideal.} Let $I \subsetneq R$ be any proper ideal. Then $I$ contains no units: if $u \in I \cap R^\times$, then $1 = u u^{-1} \in I$, contradicting properness. Hence $I \subset R \setminus R^\times = \mathfrak{n}$.
\emph{$\mathfrak{n}$ is maximal.} By the existence-of-maximals fact (Step 1), the proper ideal $\mathfrak{n}$ is contained in some maximal ideal $\mathfrak{m}$. By the previous paragraph applied to $I = \mathfrak{m}$, we have $\mathfrak{m} \subset \mathfrak{n}$. Hence $\mathfrak{m} = \mathfrak{n}$, and $\mathfrak{n}$ is itself maximal.
\emph{Uniqueness.} Any maximal ideal $\mathfrak{m}'$ of $R$ is in particular a proper ideal, and so by the first paragraph $\mathfrak{m}' \subset \mathfrak{n}$; maximality of $\mathfrak{m}'$ then forces $\mathfrak{m}' = \mathfrak{n}$. Hence $\mathfrak{n}$ is the unique maximal ideal, so $R$ is local with unique maximal ideal $\mathfrak{n}$.
[/step]
[step:Prove "only if": when $R$ is local, $R \setminus R^\times$ is the unique maximal ideal]
Suppose $R$ is local with unique maximal ideal $\mathfrak{m}$. We claim $\mathfrak{m} = R \setminus R^\times$.
\emph{$\mathfrak{m} \subset R \setminus R^\times$.} If $u \in \mathfrak{m}$ and $u \in R^\times$, then $1 = u u^{-1} \in \mathfrak{m}$, contradicting properness of $\mathfrak{m}$. So no element of $\mathfrak{m}$ is a unit.
\emph{$R \setminus R^\times \subset \mathfrak{m}$.} Take any non-unit $x \in R \setminus R^\times$. By the unit-characterisation of Step 1, $x$ lies in some maximal ideal $\mathfrak{m}'$ of $R$. By the locality assumption, $\mathfrak{m}'$ must equal $\mathfrak{m}$. Hence $x \in \mathfrak{m}$.
Combining, $R \setminus R^\times = \mathfrak{m}$. Since $\mathfrak{m}$ is an ideal by hypothesis, so is $R \setminus R^\times$, and it is the unique maximal ideal.
[guided]
We are given that $R$ has a unique maximal ideal $\mathfrak{m}$, and we want to identify $\mathfrak{m}$ with the set of non-units $R \setminus R^\times$. This will simultaneously show that $R \setminus R^\times$ is an ideal (the substantive content) and that it is the unique maximal ideal (the "in which case" clause).
\textbf{Strategy.} We show double inclusion.
\textbf{Forward inclusion: every element of $\mathfrak{m}$ is a non-unit.} Suppose, for contradiction, that some $u \in \mathfrak{m}$ is a unit, with inverse $v$. Then $uv = 1$, and since $\mathfrak{m}$ is an ideal it absorbs multiplication: $1 = uv \in \mathfrak{m}$. But $\mathfrak{m}$ is a proper ideal (maximal ideals are proper by definition), so $1 \notin \mathfrak{m}$. Contradiction. Hence $\mathfrak{m}$ contains no units, i.e. $\mathfrak{m} \subset R \setminus R^\times$.
\textbf{Reverse inclusion: every non-unit lies in $\mathfrak{m}$.} This is where locality enters. Take a non-unit $x \in R \setminus R^\times$. The principal ideal $(x)$ is proper: if $(x) = R$, then $1 \in (x)$, so $1 = rx$ for some $r \in R$, exhibiting $x$ as a unit with inverse $r$, contradiction. So $(x) \subsetneq R$.
By the existence-of-maximals fact (Step 1), the proper ideal $(x)$ is contained in some maximal ideal $\mathfrak{m}'$. The hypothesis is that $R$ has \emph{unique} maximal ideal $\mathfrak{m}$, so $\mathfrak{m}' = \mathfrak{m}$. Hence $x \in (x) \subset \mathfrak{m}' = \mathfrak{m}$.
\textbf{Conclusion.} The two inclusions give $\mathfrak{m} = R \setminus R^\times$. Since $\mathfrak{m}$ is an ideal, so is $R \setminus R^\times$. And since $\mathfrak{m}$ is the unique maximal ideal of $R$ by hypothesis, $R \setminus R^\times$ is the unique maximal ideal.
\textbf{Why uniqueness of $\mathfrak{m}$ matters.} Without uniqueness, the reverse inclusion fails: if $R$ had multiple maximal ideals $\mathfrak{m}_1, \mathfrak{m}_2$, a non-unit $x$ might lie in $\mathfrak{m}_1$ but not in $\mathfrak{m}_2$, so $R \setminus R^\times$ — the union of all maximal ideals — would strictly contain each $\mathfrak{m}_i$. In a local ring, this union is a single ideal because there is a single maximal ideal.
\textbf{Aside: additive closure of non-units.} An equivalent formulation of "$R \setminus R^\times$ is an ideal" is "the sum of two non-units is a non-unit". For a local ring this is sometimes shown directly: if $x, y$ are non-units and $x + y$ were a unit with inverse $u$, then $1 = u(x+y) = ux + uy$, so $1 \in \mathfrak{m} + \mathfrak{m} = \mathfrak{m}$, contradicting properness. Our argument above absorbs this directly through identifying the set with $\mathfrak{m}$.
[/guided]
[/step]
[step:Combine the two implications]
Step 2 establishes: if $R \setminus R^\times$ is an ideal, then $R$ is local with unique maximal ideal $R \setminus R^\times$. Step 3 establishes: if $R$ is local, then $R \setminus R^\times$ is the unique maximal ideal of $R$ — in particular, an ideal. Combining,
\begin{align*}
R \text{ is local} \iff R \setminus R^\times \text{ is an ideal of } R,
\end{align*}
and in either case $R \setminus R^\times$ is precisely the unique maximal ideal. This completes the proof.
[/step]