Prove that if $n,m\in\mathbb Z^{+}$, then $\forall x,y \in \{0,1,2,…,m-1\} \land x\not=y$, $n(x-y)\not\equiv0\pmod m$ if and only if $\gcd(n,m)=1$.
This problem is originally from Dummit and Foote’s abstract algebra 3rd edition sec $1.3$ problem $11$. I tried to solve it and reduce the problem to the above. This is my attempt :
For the sake of contradiction let $$n(x-y)\equiv0\pmod m$$ Let $\\$ $n(x-y)=mk; k\in \mathbb Z^{+}$ $\\$ Since $x,y \lt m,x-y\text{ must be less than }m$.
Let $m=\prod_{i=1}^{\mathscr k}p_i^{j_i}$ and $k=\prod_{w=1}^{\mathscr l}q_{w}^{s_{w}}$ where $p_i,q_w$ are primes (not necessary distinct) and $j_i,s_w$ are positive integers.
We know that $n\in \mathbb Z^{+}$ from definition so $(x-y)|mk$
Since $x-y\lt m$ the proof can be divided into $3$ cases
First case
$(x-y)|k$ so it is equal to $\prod_{w=1}^{\mathscr s\le \mathscr l}q_w^{r_w}$ where $0\le r_w\le s_w$ and not all $r_w$ is $0$. So $n=m\cdot \prod_{w=\mathscr s+1}^{\mathscr l}q_w^{s_w-r_w}$, in this case the gcd of $n$ and $m$ is $\not=1$ Contradiction
Second case
$(x-y)|mk$ so it is equal to $\prod_{i=1}^{\mathscr z\le \mathscr k}\prod_{w=1}^{\mathscr c \le \mathscr l}p_{i}^{t_{i}}q_w^{v_w}$ where $0\le t_i \le j_i$(not all zero) and $0\le v_w \le s_w$(not all zero). Thus, $n=\prod_{i=\mathscr z+1}^{\mathscr k}\prod_{w=\mathscr c+1}^{\mathscr l}p_i^{j_i-t_i}q_w^{s_w-v_w}$. Since $n$ contains $\prod p_i$ the gcd of n and m $\not=1$
Third case
$(x-y)|m$. This case is similar to the first case so the proof is omitted.
For the converse to be true, we must prove that if $\gcd(n,m)\not=1$ then $n(x-y)\equiv0 \pmod m$
Let $gcd(n,m)=k\not=1$ then $n=kc$ and $m=kd$ where $\gcd
(c,d)=1$
Since $x,y$ is in the residue class of $m$, one of the below is true.
$x-y\equiv0\pmod m$
$x-y\equiv1\pmod m$
$x-y\equiv2\pmod m$
$\vdots$
$x-y\equiv m-1\pmod m$
I am stuck here, I can’t prove that $n(x-y)\equiv0\pmod m$ for all these relations and I’m not even sure that I have taken the right approach. Also for the first part because $p_i$ and $q_w$ aren’t necessary distinct I think my prove doesn’t work. Could anyone please shed some light on this? A hint would be greatly appreciated.