TITLE: Solve Modular Equation $5x \equiv 6 \bmod 4$
QUESTION [6 upvotes]: Here is an modular equation
$$5x \equiv 6 \bmod 4$$
And I can solve it, $x = 2$.
But what if each side of the above equation times 8, which looks like this
$$40x \equiv 48 \bmod 4$$
Apparently now, $x = 0$. Why is that? Am I not solving the modular equation in a right way, or should I divide both side with their greatest-common-divisor before solving it?
P.S.
To clarify, I was solving a system of modular equations, using Gaussian Elimination, and after applying the elimination on the coefficient matrix, the last row of the echelon-form matrix is :
$$0, \dots, 40 | 48$$
but I think each row in the echelon-form should have been divided by its greatest common divisor, that turns it into :
$$0, \dots, 5 | 6$$
But apparently they result into different solution, one is $x = 0,1,2,3....$, the other $x = 2$.  And why? Am I applying Gaussian-Elimination wrong?

REPLY [3 votes]: Note that in multiplying each side of the original congruence by $8$, you multiplied the congruence by a multiple of the modulus, $4$, hence, since $4\mid 8$, both sides are thereby divisible by $4$, i.e., each side of the congruence is then a multiple of the modulus, and so congruent, by definition, to $0$. So the second congruence equation has an entirely different solution set.
If you had multiplied both sides of the original congruence by, say $3$, you would have maintained the solution set of $x$, $\text{mod}\;4$