It is said that for the affine cipher to be injective the affine function $e(X)=ax+b(mod26)$ , just taking 26 for this case, the $GCD(a,26)=1$. Now, I understand why is this the case, but, what I don't understand is the way that it is proven in my book. This is how the proof is done:
First, suppose that GCD(a,26)=1, then for some $x_1$ and $x_2$: $$ ax_1\equiv ax_2(mod26)$$ $$ \implies a(x_1-x_2) \equiv 0(mod26) $$ $$ \implies 26|a(x_1-x_2)$$ $$\implies 26|x_1-x_2 $$ $$x_1 \equiv x_2(mod26) $$
The thing I don't understand is $ax_1 \equiv ax_2(mod26)$, because, this statement implies that: $$ax_1 \equiv ax_2(mod26)$$ $$ax_1=26q+ax_2$$ and I don't understand why should the remainder be a multiple of $a$,
- what if the remainder is not a multiple of a? Can't the GCD(a,26)=1 without the remainder being a multiple of a?
- I'm even confused in the above steps because, from step number 4, we can see that GCD(a,26)=26.