I was wondering if for a ring $R$ with $1$, the following is true:
The ideal $(a)$ generated by some element $a \in R$ is the whole ring ($(a) = R$) iff $a \in R^\times$.
The direction $a$ is unit $\Longrightarrow (a) = R$ is clear.
But what about the other direction? I suspect that it might also hold but can't quite prove it.
My attempt is to show that if a non-unit generates $R$, then I need to be able to combine a unit (or in particular $1$) just from $a$ which (hopefully) might not be possibe. Here I get stuck.
Can someone tell me if the implication $(a) = R \implies a \in R^\times$ is correct and help me to prove it, or give me a counterexmaple?
Thanks!
EDIT: To summarize the comments: $R$ has to be commutative otherwise my statement is not true. If $R$ commutative, then the direction I was asking about holds trivially as $(a) = aR$ and $1 \in (a)$ thus $1 = ar$ and $a \in R^\times$.