My question: For a,b,n,m $\in N$, with n, m $>1$. Show that: \begin{align} X \equiv a \pmod n\\ X \equiv b \pmod m \end{align} if and only if, $a \equiv b \mod (n,m)$ and if $(m,n) = 1$, then is only solution modulo $mn$.
My solution:
\begin{align} x = nk + a\\ x= mk_1+b\\ 0 = nk + a - mk_1 - b\\ b-a = nk - mk_1 \end{align}
for diophantine equation exist solution if $(n,m)| b-a \to b\equiv a \mod (n,m)$.
My problem is how I can prove the back, I wrote only this:
\begin{align} a\equiv b \mod (m,n)\\ \to (m,n) | a -b \\ \to a -b = (m,n)k \end{align}