$4x≡2\mod5$ can you divide both sides by $2$ to get $2x≡1\mod5\,?$

In short , Yes you can$^1$ .

$$4x\equiv 2\mod5 \implies 4x -2 = 5\lambda$$

Notice that L.H.S is divisible by $2$ , which implies that R.H.S must also be divisible by $2$ or $\lambda = 2\alpha$. So our equation becomes :

$$2(2x-1) = 5\cdot2\alpha\implies 2x-1\equiv \mod 5 \implies \color{#4d0}{2x \equiv 1\mod5}$$


$(1.)$ Note that in $ax \equiv b \mod c$ , if G.C.D$(a,b) = k$ , such that $k\mid c$ then :

$$ax\equiv b \mod c \implies \color {#c03}{\frac ak \equiv \frac bk \mod \frac ck}$$

For example , consider $4x \equiv 2 \mod 6$ , this equivalent to

$$4x\equiv 2\mod 6 \implies 2(2x-1) = 6\lambda$$ $$(2x-1) = 3\lambda \implies \color{#d0d}{2x\equiv 1 \mod 3}$$


THEOREM $1$. If

  • $ax \equiv b \pmod n$
  • $d \mid a$ and $d \mid b$
  • $\gcd(d,n)=1$

then $\dfrac adx \equiv \dfrac bd \pmod n$

PROOF.

If $d \mid a$ and $d \mid b$, then there exists integers, $A$ and $B$, such that $a = dA$ and $b =dB$.

If $\gcd(d,n)=1$, then there exists integers, D and E, such that $Dd + nE = 1$. It follows that $Dd \equiv 1 \pmod n$.

So \begin{align} ax \equiv b \pmod n &\implies dAx \equiv dB \pmod n \\ &\implies DdAx \equiv DdB \pmod n \\ &\implies Ax \equiv B \pmod n \\ &\implies \dfrac adx \equiv \dfrac bd \pmod n \end{align}

Using the same sort of reasoning, we can also prove

THEOREM $2$. If

  • $ax \equiv b \pmod n$
  • $d \mid a$, $\ d\mid b$, and $d \mid n$

then $\dfrac adx \equiv \dfrac bd \left( \mathrm{mod} \ \dfrac nd \right)$


Here is a somewhat more conceptual way to think about @stevengregory 's correct answer.

Since $2$ and the modulus $5$ are relatively prime, $2$ has a multiplicative inverse $d \pmod{5}$. ($d$ happens to be $3$, but its value is irrelevant in this argument.) Then multiplying both sides of the congruence $$ 4x \equiv 2 \pmod{5} $$ by $d$ gives $$ d \times 2 \times 2x \equiv d \times 2 \pmod{5} . $$ But $d \times 2 \equiv 1 \pmod{5}$ (that's what "multiplicative inverse" means) and the result you want follows.

In general, it's better to think about multiplication by inverses rather than division when working with congruences.