How to find all the maximal ideals of $\mathbb Z_n?$ 
How to find all the maximal ideals of $\mathbb Z_n?$

I think $(0)$ is the only maximal ideal of $\mathbb Z_n$ for if $a$ is a non-unit in a maximal ideal of $\mathbb Z_n$ then $(a,n)=1\implies\exists~u,v\in\mathbb Z$ such that $au+nv=1\implies au=1~(\equiv\mod n)\implies 1\in$ the maximal ideal !
Am I right?
 A: Hint: The maximal ideals in $\mathbb Z_n$ are precisely the ideals in $\mathbb Z$ properly containing $(n)$ which are maximal w.r.t. this condition.
A: I'm afraid not - in fact, $a\in \mathbb{Z}_n$ is a non-unit if and only if $(a,n)>1$.
A: The ideals of $\mathbb{Z}_n$ are, first of all, additive subgroups of $\mathbb{Z}_n$. These we know to all have the form $\langle d\rangle$, where $d$ divides $n$. But, as we know, the set $\langle d\rangle$ is the ideal generated by $d$. So we have just proven that
the ideals in $\mathbb{Z}_n$  are precisely the sets of the form $\langle d\rangle$ where $d$ divides $n$.
Since we are interested in maximal ideals, and this concept is defined in terms of containment
of ideals in one another, we now need to determine when we can have $\langle d_1\rangle\subset \langle d_2\rangle$. This is the case if and only if $d_1 \in \langle d_2\rangle$.
Here is the main result that you are seeking for: An ideal $I$ in $\mathbb{Z}_n$ is maximal if and only if
$I = \langle p \rangle$ where $p$ is a prime dividing $n$.
A: The ring $\mathbb Z_p$ is a principal ideal domain: its ideals are $\{0\}$ and $p^k \mathbb Z_p$ ($k \in \mathbb N$).
Proof. Let $I \neq \{0\}$ be a nonzero ideal of $\mathbb Z_p$ and $0 \neq a \in I$ an element of minimal order, say $v(a) = k$. Write $a = p^k u$ with $p$-adic unit $u$. Hence $p^k = u^{-1} a \in I$ and $(p^k) \subseteq I$. Conversely, for any $b \in I$ let $w(b) \ge k$ and write $$b = p^w u' = p^k p^{w-k} u' \in p^k \mathbb Z_p.$$ This shows that $I \subseteq p^k\mathbb Z_p$. $\mathbb Z_p$ is a local ring, its maximal ideal is $p\mathbb Z_p$.
Unless you meant $\mathbb Z/n\mathbb Z$ and not the ring of $p$-adic numbers...
A: Try an example like $\mathbb Z_6$!
