<s>[INST] Prove congruence rule Say you have integers $a$ and $b$
If $a \equiv b \pmod 5$, we know that $a \pmod 5 = b \pmod 5$.
Let $a \pmod 5 = c$ and $x,y$ be some whole numbers satisfying
$$a = 5x + c \quad \text{and} \quad b = 5y + c$$
Then, $a-b = 5x + c -(5y + c) = 5(x-y)$, so $5$ is a factor in $a-b$.
Now my question is, if we start with only knowing that $5$ is a factor in $a-b$, how can we show that $a \pmod 5 = b \pmod 5$?
 [/INST] You correctly showed that $a\bmod 5=b\bmod 5\implies 5\mid a-b$ and now want to prove $5\mid a-b\implies a\bmod 5=b\bmod 5$.
Let $a=5x+(a\bmod 5)$, $b=5y+(b\bmod 5)$. If $5\mid a-b$, then $$5\mid 5(x-y)+(a\bmod 5-b\bmod 5)\iff 5\mid a\bmod 5-b\bmod 5$$
But $a\bmod 5,b\bmod 5\in\{0,1,2,3,4\}$, so $a\bmod 5=b\bmod 5$.
</s>