I had to calculate $x$ from $x^2 =x\pmod{10^3}$
I knew that $a = b\pmod{cd} \Rightarrow a=b \pmod c\ \land a=b \pmod d$ when $\gcd(c,d)=1$
Therefore I got two equations :
- $x^2 = x \pmod 8$
- $x^2 = x \pmod{125}$
My next step was to go for Chinese remainder but it only got me to $x=x$ and this was not very usefull. What should I do to calculate this $x$ ?
$\pmod{8}$ you can simply test the 8 possible solutions. Or:
$$x^2 \equiv x \pmod{8} \Rightarrow \\ 8 | x(x-1) $$
Now, only one of $x$ and $(x-1)$ is even. Therefore, that one must be divisible by $8$. This implies that $8|x$ or $8|x-1$.
$\pmod{125}$
$$x^2 \equiv x \pmod{125} \Rightarrow \\ 125 | x(x-1) $$
Now, since $x$ and $(x-1)$ are relatively prime, only one of them can be divisible by $5$. This implies that $125|x$ or $125|x-1$.
The Solutions
By the CRT you have 4 solutions, given by the following 4 possibilities. $$ x \equiv 0 \pmod{8,125}$$ $$ x-1 \equiv 0 \pmod{8,125}$$ $$ x \equiv 0 \pmod{8} \mbox { and } x-1 \equiv 0 \pmod{125} $$ $$ x-1 \equiv 0 \pmod{8} \mbox { and } x \equiv 0 \pmod{125} $$