Show that if $a\in R$ is not a zero divisor, then $a$ is unit. Let $R$ be a commutative ring with 1 which has exactly 3 ideals$\{0\},J$, and $R$. If $a\in R$ is not a zero divisor then show that $a$ is a unit.
My attempt: Suppose that $a$ is not a unit.
Then, $R.a=R.a^2$. This implies $R.a-R.a^2=0$ i.e. $Ra(1-Ra)=0$.
Since, $a$ is not a unit, then $1-Ra\neq 0$. This implies $Ra=0$. This is a contradiction.
Anyone please suggest me mistakes in this proof. This is first time for me do solve these types of problems.
 A: In your answer, what does it mean $R.a$? And why $R.a=R.a^2$?
Anyway, here I post my answer:
Lemma 1. If $a\notin J$ then $a$ is unit.
Take $a\in R\backslash J,$ then take $\langle a \rangle$ the ideal generated by $a,$ that is, $\langle a \rangle =\{ax\mid x\in R\},$ (you can check it is an ideal). Therefore, $\langle a \rangle \in\{{0},J,R\}.$
As $a\notin J,$ then $a\notin \{0\},$ so $\langle a\rangle$ must be $R.$ Therefore, there exists $x\in R$ such that  $ax=1.$
Lemma 2. The set $J\backslash \{0\}$ is the set of all zero divisors of $R.$
Take $a,b$ non zero elements of $J$ and suppose $a$ is not a zero divisor of $R.$ Clearly, $\langle a \rangle \in\{\{0\},J,R\}$ and $\langle a \rangle \subseteq J,$ so it is not $R,$ and since $a\ne 0,$ then $\langle a\rangle$ must be $J.$ Similarly, $\langle b \rangle=J.$ That is, $\langle a \rangle =\langle b \rangle.$ Hence, there exists $c,c'\in R$ such that $ac=b$ and $bc'=a.$
Then, $acc'=(ac)c'=bc'=a.$ Now, $a(cc'-1)=0.$ As $a$ is not a zero divisor, $cc'=1$ so $c$ is an unit. Look at what we have. If $ax\ne 0,$ then $ax\in\langle a\rangle\backslash\{0\}=J\backslash\{0\},$ so $x$ is a unit. Since $a$ is not an unit (otherwise $\langle a \rangle =R$), then $a^2$ must be $0.$
Final step. If $a\ne 0$ is not a zero divisor, by Lemma 2, $a\notin J,$ so by Lemma 1, $a$ is a unit.
