Let $D$ be a principal ideal domain and let a be some fixed element of $D$. Let $(a)$ denote the ideal generated by $a$. Prove that if $a$ is irreducible and $I$ is an ideal of $D$ such that $(a)\subseteq I \subseteq D$ then either $(a)=I$ or $I=D$.
This is the proof I've been given:
We suppose that $D$ is a principal ideal domain and that a is some fixed element of $D$ that is irreducible. Further we supposed that $I$ is an ideal of $D$ with $a\in I$. We want to see that either $(a)=I$ or that $I=D$
There are two cases
$(a)=I$ , this case is fine since it is the one of the two alternative we are looking for
$(a)\neq I$.
We have to show that the other alternative holds, that is that $I=D$. Since $D$ is a principal ideal domain we pick an element $d$ so that $I=(d)$. Now $a\in I$. This means that $a$ is a multiple of $d$. Pick $u\in D$ so that $a=ud$. Since $a$ is irreducible we see that either $u$ is a unit or $d$ is a unit. In the first of these alternatives, i.e. $u$ is a unit, $a$ and $d$ generates the same ideal, i.e. $(a)=I$. This can't happen. So we see that $d$ is a unit. But this means that every element of $D$ is a multiple of $d$. Therefore, $I=(d)=D$.
Questions:
I. Why is $(a)=I$ fine?
II. Explain the process or the second part when $(a)\neq I$. I don't understand the reasoning behind it. Like in the case that $u$ is a unit, why do $a$ and $d$ generate the same unit? Or, if $d$ is a unit, why does that mean every element of $D$ is a multiple of $D$?
I assume your domain $D$ is commutative. If $a=ud$ with $u$ a unit, then $au^{-1}=d$. So if $xa\in (a)$, then $xa=xud\in (d)$, so $(a)\subseteq(d)$. Conversely, if $yd\in(d)$, $yd=yu^{-1}a\in(a)$, so $(d)\subseteq (a)$. Thus $(a)=(d)$.
If $d$ is a unit, then for any $x\in D$, $x=xd^{-1}d\in(d)$, so $D=(d)$.