General method to solve a modular system I noticed that if we got a system of modular equations that all equals to $0$ we can always solve the system; for example in a system like this:
$$\begin{cases}n \mod m =0 \\n \mod m' =0  \\n \mod m'' = 0 \end{cases} \tag 1$$
$$n=\text{LCM}\ (m,m',m'')$$
But this is just a particular case where all the equations equal $0$. I noticed that in this post: 
$$\begin{cases} n \mod m = 0 \\ n  \mod m' = q \\ n \mod m'' = 0 \end{cases}$$
$$\text{if $m$, $(m' + q)$ and $m''$ don't have common divisors then} \ n=m \cdot (m' + q) \cdot m''$$
So is there a general formula or a method to solve equations that are different from $(1)$?
 A: Your suggested solution, 
$\begin{align}n=m\cdot (m'+q) \cdot m''&= m\cdot m' \cdot m''+ m\cdot q \cdot m''\\&\equiv m\cdot q \cdot m'' \bmod m'\end{align}$
Looking at the second condition, if $m\cdot m'' \equiv 1 \bmod m'$, your solution will work for any $q$. Otherwise you need that $m\cdot m''\cdot q \equiv q \bmod m'$, which is possible for some additional cases. And it may not always give you the smallest solution.
So what we really need to do is find $r$ such that $ m\cdot r \cdot m'' \equiv q \bmod m'$. This means that we need the multiplicative inverse mod $m'$ of $m\cdot m''$, and then $r \equiv ((m\cdot m'')^{-1}\cdot q \bmod m'$ and $n=m\cdot(m'+r)\cdot m''$. Note however that the multiplicative inverse may not exist.
A: $$n\equiv\left(+\begin{cases} m'm''\cdot 0\cdot ((m'm'')^{-1}\mod {m})\\ m\cdot m''\cdot q\cdot ((m\cdot m'')^{-1}\mod {m'})\\m\cdot m'\cdot 0\cdot ((m\cdot m')^{-1}\mod {m''})\end{cases}\right)\pmod {m\cdot m'\cdot m''}$$
$$\iff n\equiv m\cdot m''\cdot q\cdot ((m\cdot m'')^{-1}\mod {m'})\pmod {m\cdot m'\cdot m''}$$
Of course, this assumes that $m,m',m''$ are pairwise coprime, but this is not a problem if we use the following fact:
$$n\equiv q\pmod {p_1^{\alpha_1}\cdots p_k^{\alpha_k}}\iff\begin{cases}n\equiv q\pmod {p_1^{\alpha_1}}\\\cdots\\n\equiv q\pmod {p_k^{\alpha_k}}\end{cases}$$
