# How do I change to a different modulo?

I'm trying to solve the following problem:

What remainder does integer $n$ have when divided by $142$ if we know that $20n + 4$ and $72n - 12$ have the same remainder when divided by $142$?

I 'translated' the problem to maths:

$$20n + 4 \equiv 72n - 12 \pmod {142} \\ n \equiv x \pmod {142}$$

And we are essentially looking for $x$. Solving the linear congruence on top:

$$20 + 4 \equiv 72n - 12 \pmod {142} \\ 52n \equiv 16 \pmod {142} \\ 13n \equiv 4 \pmod {71} \\ 13n \equiv 4 + 8 \times 71 \pmod {71} \\ 13n \equiv 572 \pmod {71} \\ n \equiv 44 \pmod {71} \\$$

So $n = 71k + 44$ for any $k \in \mathbb{Z}$.

The problem is that I can't answer the original question as there, the modulo is $142$ and now it is $71$. How could I somehow 'change' the modulo and get the right answer? Or what would be a way to think about this problem?

PS: I realise that I'll get more solutions. For example, if I had $2x \equiv 4 \pmod 8$, I would divide by $2$ and get $x \equiv 2 \pmod 4$. Then $x = 4k + 2$. For these numbers are for example $6, 9, 11, \ldots$. I can see that if we were dividing these by $8$, not $4$, the remainders would be $2$s and $6$s.

So $n=71k + 44$ for $k \in \mathbb{Z}$. If $k=2a$, where $a \in \mathbb{Z}$, then $n = 142a+44$. On the other hand, if $k =2a +1$ then $n=142a+71+44$. Therefore, $$n \equiv 44,115 \mod{142}.$$

In general, if we know that $$n \equiv \alpha \mod{\beta}$$ and want to compute $n \mod{(k \beta)}$ then we use the fact that $n = \alpha + r\beta$ for $r \in \mathbb{Z}$.

By noting that $r \beta \equiv 0, \beta, \cdots, (k-1)\beta \mod{(k \beta)}$, we get $$n \equiv \alpha, \alpha+\beta, \cdots, \alpha+(k-1)\beta \mod{(k\beta)}.$$

Let's think this through:

$x \equiv 44 \mod 71$

$x = 44 + k*71$ for some $k$.

$x = 44 + \frac k2 *142$

$x = 44 + \frac {2m +i}2*142$ for some $m$ and $i= 0, 1$ where $k = 2m + i$.

$x = 44 + \frac i2*142 + \frac {2m}2*142$

$x = 44 + i *71 + m*142$

$x \equiv 44 + i*71 \mod 142$.

So for $x \equiv a \mod M$

Then $x \equiv a + i*M \mod MN$. That is because:

If $x$ has remainder $a$ when divided by $M$ then it will have remainder $a$ plus some multiple of $M$ when divided by $MN$.

Likewise if $\frac xM = \frac {jM + r}M= j + \frac rM \implies$ a remainder of $r$,

then $\frac x{MN} = \frac {jM + r }{MN} = \frac {(kN + s)M + r}{MN} = k + \frac sN + \frac r{MN} = k + \frac {sM + r}{MN} \implies$ a remainder of $sM + r$.

If the doesn't convince you.

$x \equiv 3 \mod 7 \implies x = 3,10,17,24,31,38,45,52,59, 66, 73, 80\equiv 3 + k*7 etc....$

$x \mod 35 \equiv (3,10,17,24,31),(38,45,52,59, 66), (73, 80.... etc \equiv 3+ k*7 + j*35 \mod 35 \equiv (3,10,17,24,31),(3,10, 17, 24, 31), (3,10...... \mod 35\equiv 3 + k*7 \mod 35$