Questions about a commutative ring with exactly three ideals 
Let $R$ be a commutative ring with identity. Assume that $R$ has exactly three distinct ideals: $\{0\},I, R.$
1) Show that if $a \in R-I$, then $a$ is a unit in $R$.
2) Let $a,b\ne0$ in $I$. Show that $ab=0$.

 A: HINT for 1: $Ra$ is an ideal containing $a$, so what can we say about $Ra$?
HINT for 2: Consider the ideal generated by $ab$.
A: $\underline{\text{Part 1.}}$  Let $a\in R-I$, in particular this means that $a\neq 0$ since $0\in I$.  Now take the principal ideal generated by $a$, I'll write as $(a)=aR$.  This is an ideal and a subset of $R$.  Since $1\in R$ we have that $1\cdot a\in(a)$ which means that $(a) \neq I$ because $a\notin I$.  Also, $(a)\neq (0)$ since $a\neq 0$.  Therefore, we must have that $(a)=R$.
This tells us that $1\in (a)$, so for some ring element $r\in R$ we have,
$$r a=1 $$
and thus $a$ is a unit.
$\underline{\text{Part 2.}}$ Let $a,b\neq 0$ be elements of $I$.  Take the principal ideal generated by the element $ab$, which I will write as $(ab)$.  Since $ab\in I$ by the ideal property, we have that $(ab)\subset I$.  Since $(ab)$ is an ideal, this means we have two choices, either $(ab)=(0)$ or $(ab)=I$.  
By way of contradiction, assume that $(ab)=I$.  Since $a\in I $ this means that $a\in (ab)$.  So for some $r_1\in R$ we have,
$$a=abr_1=a(br_1) $$
This implies that $b r_1=1$.  So $b$ is a unit.  But we also that that $b\in (ab)=I$, and any ideal containing a unit is the whole ring.  We know that $R$ and $I$ are distinct ideals though.  Contradiction.  Therefore, our assumption that $(ab)=I$ was incorrect.  So we are only left with the option that $(ab)=(0)$, thus $ab=0$.   
