# Are integers mod n a unique factorization domain?

I am trying to learn abstract algebra from scratch, jolly stuff, but in the process of doing so this puzzles me:

Having a ring of integers mod n, where $n=pq$ is composite, as I understand we have that $\mathbb{Z}/n\mathbb{Z}$ is Principal Ideal Domain (PID) (by this ME question). Therefore by the pretty chain of inclusions located here, it is also a unique factorization domain.

And this is where I am lost, as I keep thinking of for example $\mathbb{Z}/8\mathbb{Z}$ where I can have $4\equiv 2*2 \equiv 2*2*5 \mod 8$. Also, $p*q \equiv 0 \mod n$ which gives two non-zero divisors of zero. In my world, this means that $\mathbb{Z}/8\mathbb{Z}$ is not a UFD and not even integral domain.

I feel like I am missing something very simple yet crucial :-).

-

You have misinterpreted the question to which you linked. What is asserted there is that all ideals of $\mathbb Z/n$ are principal. But that does not make $\mathbb Z/n$ a PID unless it is an integral domain, and, as Bill Dubuque said, that happens only when $n$ is prime.

-
Let's stress domain. –  Pedro Tamaroff Mar 30 '14 at 2:35
@PedroTamaroff OK: Principal ideal $\mathbf{domain}$. –  Andreas Blass Mar 30 '14 at 2:36
;) ${}{}{}{}{}{}{}{}$ –  Pedro Tamaroff Mar 30 '14 at 2:38
I see! That makes so much sense now. I started to wonder what is wrong with me. –  user138947 Mar 30 '14 at 2:39

When $\,n\,$ is composite $\,\Bbb Z/n\,$ is not an integral domain. Factorization theory is much more complicated in non-domains, e.g. $\rm\:x = (3+2x)(2-3x)\in \Bbb Z_6[x].\:$ Basic notions such as associate and irreducible bifurcate into a few inequivalent notions, e.g. see

When are Associates Unit Multiples?
D.D. Anderson, M. Axtell, S.J. Forman, and Joe Stickles.
Rocky Mountain J. Math. Volume 34, Number 3 (2004), 811-828.

Factorization in Commutative Rings with Zero-divisors.
D.D. Anderson, Silvia Valdes-Leon.
Rocky Mountain J. Math. Volume 28, Number 2 (1996), 439-480

-
Bill, it is known that if in $A$ irreducibles are primes, then the product of primitive polynomials in $A[X]$ is primitive. Can we weaken this condition? If you could drop by the chat, it'd be better. –  Pedro Tamaroff Mar 30 '14 at 2:36
@Pedro See D.D. Anderson: GCD domains, Gauss' lemma, and contents of polynomials, 2000, for a superb survey on this and related topics. –  Bill Dubuque Mar 30 '14 at 2:40
Seems D.D. Anderson is quite the writer. It seems to be behind a paywall. Maybe I can find it in my library. –  Pedro Tamaroff Mar 30 '14 at 2:42
Even though this answer is awesome in its broadness and a way in which it suggests the unexpected depths of factorization in commutative rings, the other answer makes a better job of answering it so I marked it as accepted. –  user138947 Mar 30 '14 at 2:47