[proofplan]
We first separate the zero ideal, whose normalized generator is $0$. For a nonzero ideal, we use closure under additive inverses to produce positive elements and then choose the least positive element $d$ using the well-ordering property of $\mathbb{Z}$. The ideal property gives $(d) \subseteq I$, while the [division algorithm](/theorems/725) forces every element of $I$ to have remainder $0$ upon division by $d$, giving $I \subseteq (d)$. Finally, equality of two principal ideals with nonnegative generators implies mutual divisibility, and nonnegativity forces the generators to be equal.
[/proofplan]
[step:Handle the zero ideal by choosing the normalized generator $0$]
Suppose first that
\begin{align*}
I = \{0\}.
\end{align*}
By the definition of the principal ideal generated by $0$,
\begin{align*}
(0)=0\mathbb{Z}=\{0n:n\in\mathbb{Z}\}=\{0\}.
\end{align*}
Thus $I=(0)$, and the required generator in this case is $d=0$, which satisfies $d \ge 0$.
[/step]
[step:Choose the least positive element of a nonzero ideal]
Assume now that $I \ne \{0\}$. Choose an element $a \in I$ with $a \ne 0$. Since $I$ is an ideal of $\mathbb{Z}$, it is an additive subgroup of $\mathbb{Z}$, so $-a \in I$. Hence either $a \in I$ is positive or $-a \in I$ is positive.
Define
\begin{align*}
S=\{n\in I:n>0\}.
\end{align*}
The preceding paragraph shows that $S$ is nonempty. Since every element of $S$ is bounded below by $1$, [citetheorem:9702] gives a least element of $S$. Let $d$ denote this least element. Then
\begin{align*}
d\in I
\end{align*}
and
\begin{align*}
d>0.
\end{align*}
[guided]
Because $I$ is assumed nonzero, there is some nonzero integer $a \in I$. This element may be negative, but ideals are additive subgroups, so they are closed under additive inverses. Therefore $-a \in I$ as well. Exactly one of $a$ and $-a$ is positive, so the ideal contains at least one positive integer.
We collect all positive integers in $I$ into the set
\begin{align*}
S=\{n\in I:n>0\}.
\end{align*}
This set is nonempty by the previous argument. It is also bounded below, for every $n \in S$ satisfies $n \ge 1$. The ordered-ring property of the integers in [citetheorem:9702] says that every nonempty subset of $\mathbb{Z}$ that is bounded below has a least element. Applying that result to $S$, we obtain a least element. We call it $d$.
Thus $d$ is not an arbitrary nonzero element of $I$; it is the smallest positive element of $I$. This minimality is the key point that will force all remainders in the next step to vanish. We have
\begin{align*}
d\in I
\end{align*}
and
\begin{align*}
d>0.
\end{align*}
[/guided]
[/step]
[step:Show that the principal ideal generated by $d$ is contained in $I$]
We prove
\begin{align*}
(d)\subseteq I.
\end{align*}
Let $x\in(d)$. By definition of $(d)$, there exists $n\in\mathbb{Z}$ such that
\begin{align*}
x=dn.
\end{align*}
Since $d\in I$ and $I$ is an ideal of $\mathbb{Z}$, absorption under multiplication by elements of $\mathbb{Z}$ gives
\begin{align*}
nd\in I.
\end{align*}
Because multiplication in $\mathbb{Z}$ is commutative, $dn=nd$, and therefore $x\in I$. Hence $(d)\subseteq I$.
[/step]
[step:Use division with remainder to prove that every element of $I$ is a multiple of $d$]
We prove
\begin{align*}
I\subseteq(d).
\end{align*}
Let $a\in I$. Since $d>0$, the [division algorithm for integers](/theorems/9333) gives integers $q,r\in\mathbb{Z}$ such that
\begin{align*}
a=qd+r
\end{align*}
and
\begin{align*}
0\le r<d.
\end{align*}
Because $d\in I$ and $I$ is an ideal, $qd\in I$. Since $a\in I$ and $I$ is closed under subtraction,
\begin{align*}
r=a-qd\in I.
\end{align*}
If $r>0$, then $r\in S$ and $r<d$, contradicting the definition of $d$ as the least element of $S$. Therefore $r=0$. Hence
\begin{align*}
a=qd\in(d).
\end{align*}
Since $a\in I$ was arbitrary, $I\subseteq(d)$.
Combining this inclusion with $(d)\subseteq I$, we obtain
\begin{align*}
I=(d).
\end{align*}
[guided]
Take an arbitrary element $a\in I$. Our goal is to prove that $a$ is a multiple of $d$, because that is exactly what it means to prove $a\in(d)$.
Since $d>0$, the division algorithm for integers applies to the pair $(a,d)$. It gives integers $q,r\in\mathbb{Z}$ satisfying
\begin{align*}
a=qd+r
\end{align*}
and
\begin{align*}
0\le r<d.
\end{align*}
The quotient $q$ is not important by itself; the important object is the remainder $r$. We will show that the ideal condition forces this remainder to belong to $I$, and then the minimality of $d$ forces the remainder to be zero.
Because $d\in I$ and $I$ is an ideal of $\mathbb{Z}$, multiplying $d$ by the integer $q$ keeps us inside $I$:
\begin{align*}
qd\in I.
\end{align*}
We also have $a\in I$ by choice. Since ideals are additive subgroups, they are closed under subtraction, so
\begin{align*}
r=a-qd\in I.
\end{align*}
Now compare this with the inequalities from the division algorithm:
\begin{align*}
0\le r<d.
\end{align*}
If $r>0$, then $r$ is a positive element of $I$, so $r\in S$. But $r<d$, contradicting the choice of $d$ as the least positive element of $I$. Therefore the only possible value is
\begin{align*}
r=0.
\end{align*}
Substituting back into the division equation gives
\begin{align*}
a=qd.
\end{align*}
Thus $a\in(d)$. Since the element $a\in I$ was arbitrary, this proves
\begin{align*}
I\subseteq(d).
\end{align*}
Together with the previous inclusion $(d)\subseteq I$, this gives
\begin{align*}
I=(d).
\end{align*}
[/guided]
[/step]
[step:Prove uniqueness of the nonnegative generator]
Let $d,e\in\mathbb{Z}$ satisfy $d\ge0$, $e\ge0$, and
\begin{align*}
(d)=(e).
\end{align*}
We prove $d=e$.
First suppose $d=0$. Then
\begin{align*}
(e)=(d)=(0)=\{0\}.
\end{align*}
Since $e\in(e)$, it follows that $e=0$, so $d=e$. The same argument with $d$ and $e$ interchanged handles the case $e=0$.
It remains to consider the case
\begin{align*}
d>0
\end{align*}
and
\begin{align*}
e>0.
\end{align*}
Since $d\in(d)=(e)$, there exists $m\in\mathbb{Z}$ such that
\begin{align*}
d=me.
\end{align*}
Since $d>0$ and $e>0$, this forces $m>0$, hence $m\ge1$, and therefore
\begin{align*}
d=me\ge e.
\end{align*}
Similarly, since $e\in(e)=(d)$, there exists $n\in\mathbb{Z}$ such that
\begin{align*}
e=nd.
\end{align*}
Because $e>0$ and $d>0$, we have $n\ge1$, and hence
\begin{align*}
e=nd\ge d.
\end{align*}
Thus $d\ge e$ and $e\ge d$, so $d=e$.
Therefore the integer $d\ge0$ with $I=(d)$ is unique. This completes the proof.
[/step]