In $\mathbb{Z}/(n)$, does $(a) = (b)$ imply that $a$ and $b$ are associates? [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.
 A: (1) Nudge: break the problem up using the remainder theorem.
(2) If you want something, make it happen: $R=k[a,b,u,v]/(a-bu,b-av)$.
The above is in some sense a "universal" counterexample. While it is straightforward (relatively, I suppose) to prove $uv\ne 1$ in this quotient, proving that $a$ and $b$ are not associate by any unit is more involved; see the link below by user26857.
A: Answer to the title question: Yes, $(a) = (b)$ in $\mathbb{Z}/(n)$ iff $a, b$ are associates in $\mathbb{Z}/(n)$.
Hint: by Chinese Remainder it suffices to consider the case $n = p^k$ is a prime power. Then show that every ideal of $\mathbb{Z}/(p^k)$ is of the form $(p^n + (p^k))$ for some $n = 0, \ldots, k$. Then check directly that $p^n + (p^k)$, $p^m + (p^k)$ are associates iff $n = m$.
For a "universal" counterexample outside $\mathbb{Z}/(n)$, take $R = k[x,y]/(yx^2-y)$, where $k$ is any field: here $(y) = (xy)$, but $y$ and $xy$ are not associates.
Edit: The last point is subtle, and deserves clarification. If $\text{char}(k) \ne 2$, there is an injection
$$R \hookrightarrow k[x,y]/(y) \times k[x,y]/(x^2-1) \cong k[x] \times (k[x]/(x-1))[y] \times (k[x]/(x+1))[y]$$
(notice $(x-1), (x+1)$ are comaximal in $k[x]$ since $\text{char}(k) \ne 2$). This induces an injection
$$R^\times \hookrightarrow (k[x] \times (k[x]/(x-1))[y] \times (k[x]/(x+1))[y])^\times \cong k^\times \times k^\times \times k^\times$$
A unit in $R$ is thus (the image of) a polynomial $f \in k[x,y]$ that is simultaneously a nonzero constant modulo $y, x-1$, and $x+1$. Being a unit modulo $y$ means $f = u + yg$ for some $g \in k[x,y]$, $u \in k^\times$. Then $f \bmod (x-1)$ constant in $k[y] \implies g(1,y) = 0$ (otherwise $\deg_y f(1,y) > 0$), so $(x-1) \mid g$ (by expanding $g$ in terms of $x-1$). By the same reasoning $(x+1) \mid g$, so in fact $(x^2-1) \mid g$. Thus $f = u + y(x^2-1)h \implies f \equiv u$ in $R$ is constant. 
If $\text{char}(k) = 2$, then $x^2-1 = (x+1)^2$. Setting $S := k[x,y]/(x+1)^2$, there is an injection
$$R^\times \hookrightarrow (k[x,y]/(y) \times S)^\times \cong k^\times \times S^\times$$
Under the projection $S \to k[y]$ (quotienting by $x+1$), every unit in $S^\times$ differs modulo $x+1$ from a unit in $k[y]^\times = k^\times$. Thus $S^\times = k^\times + (x+1)S$, so if $f \in k[x,y]$ reduces to a unit in $S$ and $k[x]$, $f = u + (x+1)g$ for some $u \in k^\times, g \in k[x,y]$. Moreover $y \mid g$ (otherwise $\deg_x f(x,0) > 0$), so in fact $f = u + y(x+1)h$, which are indeed all units in $R$ (since $(y(x+1))^2 = 0$ in $R$, so $f^2 = u^2$). Thus $R^\times = \{k^\times + y(x+1)h \mid h \in R\}$, so for any $v \in R^\times$, $xy \ne vy$ (indeed, either $vy \in k^\times y$ or $\deg_y(vy) \ge 2$). 
A: 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.

