We are working in the set of integers.
For $x,y,p,a$: $$x \equiv y \pmod p \implies xa \equiv ya \pmod p$$
When can we also assume the following? $$ xa \equiv ya \pmod p \implies x \equiv y \pmod p $$
Another way to ask the question is to prove that for $a,b$ numbers $a,2a,3a,...,ba$ are all different $\pmod b$. I am kind of confused since $x^2$ can return same remainder $\pmod a$ for different $x \pmod a$
Let $gcd(a,p)=1$, then: $$\begin{align} xa\equiv ya \pmod p &\implies (x-y)a \equiv 0 \pmod p\\ & \implies x\equiv y \pmod p\end{align}$$