Assuming a linear congruence:
$ax\equiv b \pmod m$
It's safe to say that one solution would be:
$x\equiv ba^{-1} \pmod m$
Now, the first condition i memorized for a number $a$ to have an inverse $mod(m)$ was:
$\gcd(a,m) = 1$
Which stems from the fact (and correct me here) that a linear congruence has solution if that gcd divides $b$. Since on an inverse calculation we have:
$ax\equiv 1 \pmod m$
The only number that divides one is one itself, so it makes sense.
Now comes the part that annoys me most:
"If the condition that tells us that there is an inverse $mod (m)$ for $a$ says that $\gcd(a,m)=1$, then how come linear congruences where the $\gcd(a,m) \ne 1$ have solution? Why do we say that a linear congruence where $\gcd(a,m) = d > 1$ has d solutions? If you can't invert $a$, then you can't do this:"
$ax\equiv b \pmod m \implies x\equiv ba^{-1} \pmod m $
Please help on this one. It's kinda tormenting me :(