A ring which contains a nonprime maximal ideal I found this observation on my book, but I did not understand it well.
Let $R$ a commutative ring without identity, but having a single generator, then $R$ contains nonprime maximal ideal.
We suppose that $R=(a)$. First observe that the principal ideal $(a^2)$ is a proper ideal of $R$, since the generator $a\notin (a^2)$. Indeed, were $a$ in $(a^2)$, we could write $a=ra^2+na^2$ for same $r\in R$ and $n\in \mathbb{Z}$;
Why, in this case, the element $e=ra+na$ is a multiplicative identity for $R$? Therefore, since $e$ is a identity of $R$, they are violated the hypothesis.
Now, since $R\ne (a^2)$, exist a maximal ideal $M$ of $R$ with $(a^2)\subseteq M$. However $M$ is not a prime ideal, as can be seen by considering the product of elements in te complement of $M$ ($r,s\notin M$), the product $rs\in (a^2)\subseteq M$. (Why this is the negation of a definition of prime ideal?)
Anyone could explain to me how things are?
Thanks!
 A: Suppose that $a=ra^2+na^2$. Then, $a(ra+na)=a$, so $ae=a$. Then, for any $x\in R$, $x=ta+ma$ for some $t\in R$, $m\in \mathbb{Z}$. So $xe= (ta+ma)e= tae+mae= ta+ma=x$. Therefore, $e$ is the identity element.
To prove that $M$ is not a prime ideal, it is enough to check that there are two ideals $A$, $B$ with $AB\subseteq M$, and $A$ and $B$ are not contained in $M$. By taking $A=B=(a)$, $AB=(a)(a)\subseteq (a^2)\subseteq M$, but $(a)=R$ is not contained in $M$ because it is a maximal ideal, so by definition $M\neq R$.
A: Since every element of $R$ can be written as $ra+na$ for some $r\in R$ and $n\in\mathbb{Z}$, if we find $e\in R$ such that $ae=a$, then $e$ will be the identity of $R$.
If $a\in(a^2)$, then $a=ra^2+na^2$, for some $r\in R$ and $n\in\mathbb{Z}$. Set $e=ra+na$; then $ae=a$.
Now take an ideal $M$ of $R$ maximal with respect to the property that


*

*$(a^2)\subseteq M$;

*$a\notin M$.


Such a maximal element exists by Zorn's lemma: the union of a chain of ideals containing $(a^2)$ and not containing $a$ is again an ideal satisfying the same property. Clearly such an ideal is not prime, because $a\notin M$, but $aa=a^2\in M$.
Let's prove that $M$ is maximal. If $I$ is an ideal of $R$ properly containing $M$, then $I$ contains $(a^2)$, so by the choice of $M$ we must have $a\in I$. Hence $I=R$.
Note: the fact that $R=(a)$ is crucial. A ring without an identity can fail to have maximal ideals at all.
A: $4\mathbb{Z}$ in $2\mathbb{Z}$.  Note that $4 = 2 \cdot 2 \in 4\mathbb{Z}$, but $2 \not \in 4 \mathbb{Z}$.  There is no ideal between $4\mathbb{Z}$ and $2 \mathbb{Z}$.
(Note that this is a concrete example of your more abstract example.)
A: For the first part, you have the idea, but if $a\in (a^2)$, you can write $a=P(a^2) $ where $P$ is a polynomial. Let $M$ be  a maximal ideal containing $(a^2)$, $a.a=a^2$ is in $M$ but $a$ is not in $ M$. This implies that $M$ is not prime. 
A: For the second question, the definition of a prime ideal is that $I$ is prime if for any $a, b \in R$ such that $ab \in I$ then either $a \in I$ or $b \in I$. So if we can find $a, b \in R \setminus I$ with $ab \in I$ then this would show that $I$ was not prime.
Now in the situation of the question we have a maximal ideal $M$ of $R = (a)$ with $(a^2) \subseteq M$. Let $r, s \in R \setminus M$. Then $r = ta + ma$ and $s = ua + na$ for some $t, u \in R$, $m, n \in \Bbb Z$, so $rs = (tu + tn + mu + mn)a^2 \in (a^2) \subset M$. Thus $rs \in M$ but $r \notin M$, $s \notin M$, as required to show that $M$ was not prime.
