I have an affine chipher
$ax+b \mod m$
For what values $a,b$ is this an injective encryption function?
From what i understand thats the case when $a$ and $m$ are coprime, so $gcd(a,m)=1$ and the value of $b$ doenst really matter.
I'd like to understand why $gcd(a,m)=1$ is mandatory here. So what happens if there is a common divisior $>1$ and why does it mean the function is no longer injective?
"Not injective" means that there exist $x_1$ and $x_2$ ($x_1 \neq x_2$) such that $ax_1+b=ax_2+b \pmod m.$ The latter can be reconfigured as follows: $a(x_1-x_2)=0 \pmod m$ (here $x_1-x_2 \neq 0$ since $x_1 \neq x_2$). And that is possible if and only if $a$ is a divisor of $0$ in $\mathbb{Z}_m$, i.e. $\text{gcd}(a,m)>1$.