1. ## Chinese remainder theorem

Hello everyone.
This is not really a homework but it is very urgent.
I have a Discrete math exam in one day and this problem is giving me so much headache!

$x\equiv 1(\bmod 4)$ (1)
$x\equiv 2(\bmod 5)$ (2)
$x\equiv 3(\bmod 7)$ (3)

I tried finding inverses as well as reducing these three equations to two equations like:

$x+3\equiv 0(\bmod 28)$
$x+3\equiv 0(\bmod 5)$

and in both cases the result does not work out for the equation (3).
Could anyone please explain me why it is so and how to do this in a right way?

2. The LCD is (4)(5)(7)=140

I like to do it like this:

Divide by the 'mods':

140/4=35, 140/5=28, 140/7=20

Now, find the inverses.

$35p_{1}\equiv 1(mod \;\ 4)\Rightarrow p_{1}=3$

$28p_{2}\equiv 1(mod \;\ 5)\Rightarrow p_{2}=2$

$20p_{3}\equiv 1(mod \;\ 7)\Rightarrow p_{3}=6$

Now, multiply:

(1)(35)(3)+(2)(28)(2)+(3)(20)(6)=577

$x\equiv 577(mod 140)$

$\boxed{x=17}$

Check the solution here:

Javascript Calculator

or the old-fashioned way:

$\frac{17-1}{4}=4$
$\frac{17-2}{5}=3$
$\frac{17-3}{7}=2$

Check.

3. Thank you very much! It turns out I made a miscalculation... few times in a row . {shame on me} But anyway, thank you for your answer and for you time.