I am trying to solve a cryptography-related question, which asks the conditions for an affine cypher's key to be involuntary. This implies $E_k=D_k$, where $E_k$ and $D_k$ are encryption and decryption functions for the involuntary key k over some $ℤ_n$.
This implies that $E_k(E_k(x))=x$, solving which should give us the required conditions. Now, this is where I am confused. The solutions I found online (Q3.b here) solve this as
$E_k(E_k(x))=(a(ax+b)+b) \mod n=x$
Should it not be $(a((ax+b)\mod n)+b)\mod n$.
Why can we ignore the modulo operator on the first time encryption?
As explained here, in any expression composed of addition and multiplication operations, we obtain an expression $\rm\color{#c00}{congruent}\pmod{\! n}\,$ by inserting or deleting $\color{#0a0}{\bmod} n$ reductions on the results and arguments of these operations. In particular we can delete (erase) all the $\rm\color{#0a0}{mod}$ operations in $\,e(e(x))\,$ to obtain
$$\begin{align} e(e(x)) &= (a(ax\!+\!b\color{#0a0}{\bmod} n)\!+\!b)\color{#0a0}{\bmod} n\\[.3em] &\color{#c00}\equiv\, a(ax\!+\!b)+b \pmod{\!n}\end{align}\qquad$$