Solving linear congruence $2x + 11 \equiv 7 \pmod 3$

I'm having some troubles understanding the solution (going from step $2$ to step $3$) of this linear congruence equation. Here's the problem with the solution:

Solve the congruence $2x + 11 \equiv 7 \pmod 3$.

First, we reduce all the coefficients $\pmod 3$:

$$2x + 2 \equiv 1 \pmod 3. \tag{1}$$

Next, we add $1$ to both sides, using the fact that $2 + 1 \equiv 0 \pmod 3$:

$$2x \equiv 2 \pmod 3. \tag{2}$$

Finally, we multiply both sides by $2$, using the fact that $2 · 2 = 4 \equiv 1 \pmod 3$:

$$x \equiv 1 \pmod 3. \tag{3}$$

That is, any number in the set $\{\ldots, −5, −2, 1, 4, \ldots\}$ will solve the original congruence.


Like I said my problem is the step between $(2)$ and $(3)$. If I multiply both sides of $(2)$ by $2$ I get:

$$4x \equiv 4 \pmod 3.$$

Now, I understand that $4$ is congruent to $1 \pmod 3$ so the RHS "simplifies" to $1 \pmod 3$ but I don't understand why the LHS "simplifies" to $x$. Can someone help me with this?


By the Congruence Product Rule $\ 4\equiv 1\,\Rightarrow\, 4x\equiv 1x\ [\equiv\, x]$. Alternatively note that $\,2 \equiv -1\,$ and it is simpler to scale the congruence by by $-1,\,$ which amounts to simply negating it. More generally when the coef of $x$ is coprime to the modulus then we can compute its inverse by the extended Euclidean algorithm, then scale the congruence by the inverse to transform the coef of $x$ to be $1$.

Note that these solution steps for a linear congruence are the same as they are for linear equations on real numbers, i.e. isolate $x$ by adding and multiplying equal (equivalent) numbers to both sides. That these operations remain valid for congruences follows by the Congruence Sum & Product Rules in the linked post (both are unified when one studies rings in abstracr algebra, where congruences $\bmod n\,$ are reified algebraically in the quotient ring $\,\Bbb Z_n = $ integer $\bmod n)$

Remark $ $ Note also that you need to make it clear that the congruences are equivalent (and not simply that the former imply the latter) if you want to deduce that the obtained solution is actually a solution, i.e. you need to use bidirectional arrows $(\!\!\iff\!\!)$ not unidirectional $(\Rightarrow)$ connecting the congruences. The arrows go both ways because you used only invertible operations $\,(n\mapsto n+a\,$ and $\,n\mapsto bn\,$ for invertible $\,b).\,$ The arrows generally do not reverse if you use noninvertible operations (e.g. squaring), which may introduce extraneous solutions (in which case you'd need to verify that solution candidates are actually solutions).

Generally, as above, by the linked Sum and Product rules, replacing the arguments of sums and products (but not exponents) by any congruent integer yields a congruent result. In particular this applies to all coefficients and variables in polynomial expressions. Usually we replace them by their remainders = least positive rep (or least magnitude rep as $\,9\equiv -1\pmod{\!10}\,$ when casting out nines) to simplify matters.


$4x \equiv 1 \mod 3 \implies$

$4x - 1 = 3k; k \in \mathbb Z \implies$

$x + 3x - 1 = 3k \implies$

$x -1 = 3k - 3x = 3(k-x) \implies$

$x - 1 = 3j; j= (k-x) \in \mathbb Z \implies$

$x \equiv 1 \mod 3$.

====

This is always true. If $k \equiv a \mod N$ than $kV \equiv aV \mod N$ because $k \equiv a \mod N \implies k - a = mN$ so $kV - aV = mVN$. Works even if $x$ is a variable. $4 \equiv 1 \mod 3$ so $4x \equiv x \mod 3$. Easy-peasy. (Assuming $x$ is presumed to be solved for a congruency class.)