# how to solve 2x=4 in $Z_{12}$

How do I solve 2x=4 in $$Z_{12}$$

I know the $$gcd(2,12) = 2$$ and $$2|4$$ therefore there are 2 solutions, but I'm not sure how to solve this. I tried using the euclidean algorithm but it doesn't seem to work with numbers this small.

\begin{align}{\bf Hint}\qquad\ \ \ 2x&\equiv 2a\!\pmod{\!2n}\\[.2em] \iff \color{#c00}2x &= \color{#c00}2a + \color{#c00}2nk \ \ \ {\rm for\ some}\ \ k\in\Bbb Z\\[.2em] \iff\ \ x &= \ \ a +\ \ nk \ \ \ {\rm for\ some}\ \ k\in\Bbb Z\\[.2em] \iff\ \ x&\equiv\ \ a\!\pmod{\!n} \end{align}
That's very simple: since $$d$$ divides all coefficients and the modulus, you can simplify, since $$\mathbf Z$$ is an integral domain: $$2x\equiv 4\mod 12\iff x\equiv 2\mod 6$$
• Ok thank you, so just to be clear, you can only simplify like this when $Z_m$ is an integral domain? also why is Z an integral domain in this case as 12 is not prime?? – user520403 Feb 12 at 20:53
• @user520403 I elaborated in my answer. As you can see, it amounts to cancelling $2$ in $\,\Bbb Z,\,$ which is possible since $2$ is a nonzero element of a domain, so not a zero-divisor. – Bill Dubuque Feb 12 at 20:58
• No. What I meant is that, as $\mathbf Z$ is an integral domain, when you interpret the congruence in terms of integers, you can simplify and interpret the relation you obtain as another congruence. Is tat clear? – Bernard Feb 12 at 20:58