Solving systems of congruences using Chinese remainder theorem

258 Views Asked by At

I am learning how to solve system of congruences and I am having some trouble with one exercise.

$5x=3mod7$

$2x=4mod8$

$3x=6mod9$

For

$x=2mod7$

$x=2mod8$ and $x=6mod8$

$x=2mod9$, $x=5mod9$, and $x=8mod9$

$M: M=7*8*9=504.$

Now to figure out M1, M2, and M3:

M1=72, M2=63, and M3=56

Here is were I am having some trouble.

72X1=1mod7----------->X1=4

63X2=1mod8----------->X2=7

56X3=1mod9----------->X3=5

Therefore $X0= 5(4)72+2(7)(63)+3(5)(56)$

$X0=3162$

So $X=138 mod504$

Is this correct? I feel like I am missing some steps.

1

There are 1 best solutions below

0
On BEST ANSWER

First we can cancel factors from the final two congruences as follows.

$2x\equiv 4\pmod{8}\iff 2x = 4+8j\iff x = 2+4j\iff x=2\pmod{4}$

Similarly $\,3x \equiv 6\pmod{9}\iff x\equiv 2\pmod{3}$

Note $\,x\equiv 2\,$ is also the (unique!) solution of $\,5x\equiv 3\pmod{7}$

So the congruences are equivalent to $\,x\equiv 2\pmod{\!3,4,7}\!\iff x\equiv 2\pmod{\!84}\,$ by CCRT.

If you must use the CRT formula then you can make it easy as follows. Let $X = x-2.\,$ Solve the system $X\equiv \color{#c00}0$ for all three moduli. The CRT formula will have a factor of $\,\color{#c00}0\,$ in all $3$ summands, so the result is $0$. Thus $\,x-2 = X \equiv 0\,$ so $\,x \equiv 2\,$ is the solution by the CRT formula. Note that we don't need to compute inverses of moduli etc since all those terms are annihilated by the $0$ factors.