<s>[INST] Efficient way to solve modular arithmetic equations I want to find all integer solutions ($x$ value) the following equation:
$((2(x+2))\mod 3+(x-3)\mod 2+3)\mod 5 = 3$
I have simplified the above equation as
$((2x+4))\mod 3+(x-3)\mod 2+3)\mod 5 = 3$
$((2x+3+1))\mod 3+(x-3)\mod 2+3)\mod 5 = 3$
$((2x+1) \mod 3 + (x-1)\mod 2 +3)\mod 5$  ==> I used the fact that $(k+3)\mod 3 = k\mod 3 = (k-3)\mod 3$
I can only solve it by such reasoning methods. Is there any specific fixed way or algorithm to solve such expressions?  
 [/INST] You can continue simplifying : $(2x+1)\mod 3+(x-1)\mod 2\equiv 0\mod 5$
So $2x+1=3p+r$ and $x-1=2s+u$ and $u+r=5k$ but since $r\in\{0,1,2\}$ and $u\in\{0,1\}$ the only possible multiple of $5$ is $0$.
Thus $u=r=0$.
$\begin{cases}
2x+1\equiv 0\mod 3\iff 2x\equiv -1\equiv 2\mod 3\iff x\equiv 1\mod 3\\
x-1\equiv 0\mod 2\iff x\equiv 1\mod 2
\end{cases}$
So finally $\quad x=6k+1$.
The method is to try if possible to arrive at a system of $x\equiv a_i\mod p_i,\ i=1..n$ then you can apply chinese theorem.

When having a look at your equation : 
$f(x)=(3(2(x\mod 2)+2 - (x\mod 4)))\mod 4 + (x\mod 8) = 9$
we first notice there are three modulo used $2,4$ and $8$, so if you are to find an $x$, the Chinese remainder theorem states that $x=lcm(2,4,8)a+t=8a+t$ with $t\in\{0,1,2,3,4,5,6,7\}$.
The success of the method resides in the fact that only $8$ values for $t$ need to be plugged and tested in the equation.
Note: since $(x\mod 2,4,8)=(t\mod 2,4,8)$ just replace $x$ by $t$ in the equation and try all values.
$\begin{array}{c|ccc|c}
t & t\%2 & t\%4 & t\%8 & f(t) \\
\hline
0 & 0 & 0 & 0 & 2 \\
1 & 1 & 1 & 1 & 2 \\
2 & 0 & 2 & 2 & 2 \\
3 & 1 & 3 & 3 & 6 \\
4 & 0 & 0 & 4 & 6 \\
5 & 1 & 1 & 5 & 6 \\
6 & 0 & 2 & 6 & 6 \\
7 & 1 & 3 & 7 & 10
\end{array}$
And you see that your equation has no solution, but solving it was a very automated process.
</s>