# System of congruences with moduli not coprime and chinese remainder theorem application

Find all solutions, if any, to the system of congruences $$\Bigg\{ \begin{array}{c} x \equiv 1 (\mod 6)\\ x \equiv 7 (\mod 9)\\ x \equiv 4 (\mod 15)\\ \end{array}$$ we can see that

$$x \equiv 1 \pmod 6 \implies \left\{ \begin{array}{l} x\equiv 1 \pmod 2 \\ x \equiv 1 \pmod 3 \end{array} \right.$$

as well as $$x \equiv 7 \pmod 9\\ \qquad \Rightarrow \quad x=7+9k\\ \qquad \Rightarrow \quad x=1+3(2+3k)\\ \qquad \Rightarrow \quad x\equiv 1 \pmod 3\\$$

and $$x \equiv 4 \pmod{15} \implies \left\{ \begin{array}{l} x\equiv 4 \pmod 5 \\ x \equiv 1 \pmod 3 \end{array} \right.$$

After removal of redundant congruences and picking the one with the highest power of 3 we are left with:

$$\Bigg\{ \begin{array}{c} x \equiv 1 \pmod 2\\ x \equiv 7 \pmod {3^2}\\ x \equiv 4 \pmod 5\\ \end{array}$$

Now we reduced it to standard CRT problem.

$$x=2k+1 \\ 2k+1 \equiv 7\pmod{9}\\ 2k \equiv 6\pmod{9}\quad \gcd{(2,9)}=1\\ k\equiv 3\pmod{9}\\ k=9\cdot l+3$$

$$x=2\cdot(9\cdot l+3)+1=18l+7$$

$$18l+7\equiv 4\pmod{5}\\ 18l\equiv -3\pmod{5}\\ 18l\equiv 2\pmod{5}\\ 3l\equiv 2\pmod{5}\\ \quad \Rightarrow \quad 7\pmod{5}\\ \quad \Rightarrow \quad 12\pmod{5} \quad \gcd{(3,5)}=1\\ l\equiv 4\pmod{5}\\ l=5\cdot m +4\\$$

The solution to the original system:

$$x=2\cdot(9\cdot (5\cdot m +4)+3)+1=90\cdot m+79\\ x\equiv 79\pmod{90}$$

with the smallest x = 79

Is it a correct approach?

• This looks good. At the most, I'd rephrase the first part as "ensure system of congruences is consistent". Nov 18, 2020 at 0:27
• There could be a few ways to optimize the CRT part, based on recognition of the terms. (To be clear, there are no issues with the current approach.) For example, we have $x \equiv -1 \pmod{2} , x \equiv -1 \pmod{5} \Rightarrow x\equiv -1 \pmod{10}$ directly. Of course, this doesn't easily generalize, and is situation specific. Nov 18, 2020 at 0:29
• To be correct the arrows $(\Rightarrow)$ should be $(\iff)$ to ensure the splitting yields an equivalent system (else you could have extraneous solutions which you'd need to check and exclude at the end). The prior mentioned optimization follows by CCRT (see the Linked questions there for around 50 applications of it, many similar to ths). Nov 18, 2020 at 0:34

It is correct, but you can make the solution a bit shorter using the explicit inverse isomorphism in the C.R.T. for two coprime moduli $$a$$ and $$b$$, given a Bézout's relation $$ua+vb=1$$:
$$x\equiv \begin{cases}\alpha\mod a,\\\beta\mod b,\end{cases}\iff x\equiv \beta ua+\alpha vb\mod ab$$
As $$4\cdot 3^2-7\cdot 5=1$$, the last two final congruences yield as a first step $$x\equiv 4\cdot 4\cdot 9-7\cdot 7\cdot 5=144-245=-101\mod 45.$$ Next, from $$45-22\cdot 2=1$$, you deduce from this congruence and the first above that $$x\equiv 45+101\cdot 22\cdot 2=4489\equiv 79\mod 90.$$