TITLE: In $\mathbb{Z}/(n)$, does $(a) = (b)$ imply that $a$ and $b$ are associates?
QUESTION [12 upvotes]: [Update: Based on the hints provided by @zcn and @whacka, I believe I have found a solution. See my answer below.]
Below, $R$ is a commutative ring with $1$.
In John J. Watkins' Topics in Commutative Ring Theory, the author observes that if $a$ and $b$ are associates in $R$, then they generate the same ideal: $(a) = (b)$. This is clearly true, because $a = ub$ and $b = va$ for some units $u$ and $v$, and so $a \in (b)$ and $b \in (a)$, whence $(a) \subset (b)$ and $(b) \subset (a)$. Indeed, we didn't even require $u$ and $v$ to be units to reach this conclusion.
The author then claims that if $R$ is not a domain, then the converse may not be true: we may have $(a) = (b)$ even if $a$ and $b$ are not associates. As a "counterexample" he gives $R = \mathbb{Z}/(6)$, with $a = 2 + (6)$ and $b = 4 + (6)$. Clearly these elements generate the same ideal: $(a) = (b) = \{0, 2 + (6), 4 + (6)\}$. The author asserts that $a$ and $b$ are not associates, but this is false: $5 + (6)$ is a unit, and $(2 + (6))(5 + (6)) = 4 + (6)$, so $a$ and $b$ actually are associates.
I figured that the author botched the example but that surely the basic fact must be true: if $R = \mathbb{Z}/(n)$ then there may be nonassociates $a,b \in R$ with $(a) = (b)$. However, I was not able to find a counterexample and eventually resorted to writing a computer program and found that there are no counterexamples in $\mathbb{Z}/(n)$ for $n \leq 100$.
So now I'm starting to think that there is no counterexample in $\mathbb{Z}/(n)$ at all, but I have not yet been able to prove this.
My questions:

If I am correct that $(a) = (b)$ in $\mathbb{Z}/(n)$ implies that $a$ and $b$ are associates, I would appreciate a nudge in the right direction toward a proof. (But if the proof is elementary, please give only a hint, not a solution :-) I'll post my solution once I have one.
In either case, could you please point me to a genuine counterexample? If there is one in $\mathbb{Z}/(n)$ for some $n$, that would be ideal (no pun intended), otherwise a counterexample in any commutative ring with $1$ would be great.

REPLY [3 votes]: OK, I reviewed the Chinese remainder theorem in Dummit and Foote. I will first provide a quick summary and then apply it to this problem.
Chinese Remainder Theorem
Let $R$ be a commutative ring with $1$, and let $I_1, \ldots I_m$ be distinct ideals of $R$ with the property that $I_j + I_k = R$ for all $j \neq k$. Then:

$I_1 I_2 \ldots I_m = I_1 \cap I_2 \cap \ldots \cap I_m$; let's call this $K$ for short.
The map $\phi : R \rightarrow (R / I_1) \times (R / I_2) \times \ldots \times (R/I_m)$ defined by $\phi(r) = (r + I_1, r + I_2, \ldots, r + I_m)$ is a surjective ring homomorphism with kernel $K$, and therefore by the first isomorphism theorem, $R / K \cong (R / I_1) \times (R / I_2) \times \ldots \times (R/I_m)$.
Since the units of $(R / I_1) \times (R / I_2) \times \ldots \times (R/I_m)$ are precisely $(R / I_1)^{\times} \times (R / I_2)^{\times}  \times \ldots \times (R/I_m)^{\times}$, and since any isomorphism maps units to units, $(R / K)^{\times} \cong (R / I_1)^{\times} \times (R / I_2)^{\times}  \times \ldots \times (R/I_m)^{\times} $.

Application to this problem
Let $R = \mathbb{Z}/(n)$, and let $n = p_1^{k_1} p_2^{k_2} \cdots p_m^{k_m}$ be the prime factorization of $n$. For each $1 \leq i \leq m$, let $I_i = (p_i^{k_i})$, the principal ideal generated by $p_i^{k_i}$. If $i \neq j$, then the gcd of $p_i^{k_i}$ and $p_j^{k_j}$ is $1$, so $I_i + I_j = R$ and the Chinese remainder theorem applies. Note also that $K = I_i \cap I_2 \cap \ldots \cap I_m = (n)$, which is the "zero" element in $R$, so $R/K$ is simply $R$, and the map $\phi$ described in the CRT statement is an isomorphism.
Claim 1: $(a) = (b)$ in $R$ if and only if $(a) = (b)$ in each $R/I_j$.
Proof: Suppose $(a) \subset (b)$ in $R$. Then $a = bx$ for some $x \in R$, so $\phi(a) = \phi(b)\phi(x)$ (since $\phi$ is an isomorphism), which means that $a = bx$ in each $R/I_j$, and therefore $(a) \subset (b)$ in $R/I_j$.
Conversely, suppose that $(a) \subset (b)$ in each $R/I_j$. Then in $R/I_j$ we have $a = bx_j$ for some $x_j$. Therefore, in $(R/I_1) \times (R/I_2) \times \cdots \times (R/I_m)$ we have $(a,a,\ldots,a) = (b,b,\ldots,b)(x_1,x_2,\ldots,x_m)$. Applying $\phi^{-1}$ to this equation, we get $a = bx$ for some unique $x \in R$. Therefore, $(a) \subset (b)$ in $R$.
Reversing the roles of $a$ and $b$ gives the proof for the opposite containment. $\square$
Claim 2: $a$ and $b$ are associates in $R$ if and only if $a$ and $b$ are associates in each $R/I_j$.
Proof: Suppose that $a = ub$ for some unit in $R$. Then $\phi(a) = \phi(u)\phi(b)$, so $a = ub$ in each $R/I_j$. Moreover, $\phi$ maps units to units, so $u$ is a unit in each $R/I_j$.
Conversely, suppose that in each $R/I_j$, we have $a = u_jb$, where $u_j$ is a unit. Therefore, in  $(R/I_1) \times (R/I_2) \times \cdots \times (R/I_m)$ we have $(a,a,\ldots,a) = (u_1,u_2,\ldots,u_m)(b,b,\ldots,b)$. Applying $\phi^{-1}$, we get $a = ub$ in $R$, for some unique unit $u \in R$. $\square$
Because of the two claims, it suffices to solve the problem for $R/(p^k)$, where $p^k$ is any prime power. Note that $R = \mathbb{Z}/(n)$, but $p^k$ divides $n$, so $R/(p^k)$ is really (isomorphic to) $\mathbb{Z}/(p^k)$.
Proof for $R = \mathbb{Z}/(p^{k})$
Let $I = (p^{k})$, and and suppose that $(a) = (b) = J$ in $R$. Then $J = (x + I) = (x + (p^{k}))$ for some $x \in \mathbb{Z}$. As $J$ is an additive subgroup of $R$, $|J|$ must divide $|R| = p^{k}$. Thus $|J| = p^{k-j}$ for some $0 \leq j \leq k$. This forces $J = (p^{j} + (p^k))$.
We have established that $(a) = (b) = (p^{j} + (p^k))$. Thus, working modulo $p^k$, we have:

$a = rp^j$ for some $r$.
$r$ cannot be divisible by $p$, for if it were, say $r = sp^m$ where $m \geq 1$, then $a = sp^{m+j}$, so $p^{k-m-j}a = 0$, which means that the size of $(a)$ is strictly smaller than $p^{k-j} = |J|$.
$u$ is a unit in $R$ if and only if it is not divisible by $p$.
Therefore, $r$ is a unit.
By the same argument, $b = sp^j$ for some unit $s$.
Therefore, $b = r^{-1}sa$, and $a$ and $b$ are associates.