# Precise definition of congruence class?

So I'm going through Niven's The Theory of Numbers, and it gives the definition that:

$$a \equiv b \pmod m \implies m \mid (a - b)$$

However, a few pages after this definition, it gives a theorem that states "if $\gcd(a, m) = 1$, then there is an $x$ such that $ax \equiv 1 \pmod m$. To prove this theorem, it states that:

If $\gcd(a, m) = 1$, then there exist $x, y$ such that $ax + my = 1.$ That is, $ax \equiv 1 \pmod m$.

Well... from $ax + my = 1$, you can get $my = 1 - ax$, but this shows that $m \mid (1 - ax)$.

However, from the aforementioned definition of an equivalence class, $ax \equiv 1 \pmod m \implies m \mid (ax - 1)$, rather than $m \mid (1 - ax)$.

What is happening here?

• $p|q\iff p|(-q)$ – drhab Sep 27 '14 at 18:13

If $m \mid (ax - 1)$, then $m \mid (1 - ax)$. See, if $m \mid (ax - 1)$, exists $k \in \Bbb Z$ such that $mk = ax - 1$. Then you get $m(-k) = 1 - ax$. Since $-k \in \Bbb Z$, we obtain that $m \mid (1 - ax)$.
To make sure that I say enough words: if $a\mid b$ then $a \mid -b$.