Solve the system of linear congruence. Problem:  Solve $$x\equiv8\pmod {12}$$ $$x\equiv6\pmod {9}$$ Now I have read about the Chinese Remainder Theorem, which is particularily helpful in solving systems of linear congruence, but in this notice that the moduli are not relatively prime (pairwise). So, I cannot apply the theorem. In fact this leads me to a general question: If we are given as system: $$a_1x\equiv b_1\pmod {n_1}$$ 
$$a_2x\equiv b_2\pmod {n_2}$$ 
$$a_3x\equiv b_3\pmod {n_3}$$ 
$$a_4x\equiv b_4\pmod {n_4}$$ 
$$...$$ 
$$a_rx\equiv b_r\pmod {n_r}$$ 
where the moduli are not pairwise relatively prime. How do we go about solving this system and what are the conditions that determine the solvability of the system. 

Hint $\ {\rm mod}\  3=\gcd(9,12)\ $ we have  $\,x\equiv 8\equiv  2\,$ by the first, contra $\,x\equiv 6\equiv 0\,$ by the second.
Similarly if $\, x\equiv a\pmod m,\ x\equiv b\pmod n\,$ then $\, a\equiv x\equiv b\pmod d\,$ for $\,d =\gcd(m,n),\ $ hence $\,d\mid a-b\,$ is a necessary condition for the existence of a solution.
This compatibility condition is also a sufficient condition for the existence of solution, and it extends pairwise to any number of congruences - see this answer for a constructive proof (which depends on the key fact that gcd distributes over lcm).
