How can a = x (mod m) have multiple meanings in modular arithmetic?

It seems to me that a = x (mod m) can mean either that a is the remainder of x divided by m or that the remainders of a and x are the same when divided by m (eg. with respect to mod m). For example: 2 = 6 (mod 4) would be the first meaning I discussed, but 6 = 2 (mod 4) would be the second. It seems that I must be confusing some aspect of modular arithmetic here. Thanks for the assistance.


No; $a\equiv b \pmod{m}$ means that $a$ and $b$ are congruent modulo $m$: by definition, the meaning is that $m$ divides $a-b$. As it happens, this is equivalent to saying that $a$ and $b$ have the same remainder when divided by $m$.

However, there is also a related notation, in which "mod" acts as a binary operator: in computer science especially, one often finds expressions like "$a \bmod m$"; in this case, this is interpreted as an operation on $a$ and $m$ that results in the remainder when $a$ is divided by $m$ (usually the one among $0$, $1,\ldots,m-1$, but in some instances instead the ones with smallest absolute value, allowing negative remainder).

But these two are related-but-different. In $a\equiv b\pmod{m}$, what we have is a binary relation between $a$ and $b$, called "congruence modulo $m$", and written $\equiv\pmod{m}$. In $a\bmod m$, what we have is a binary operation (noncommutative) on $a$ and $m$.


I think you are mixing notation here; perhaps using some superfluous parentheses may help:

$a=(x\pmod m)$ has the first meaning you said: $a$ is the remainder of dividing $x$ into $m$; while $(a=x)\pmod m$ would have the second meaning: $a$ and $x$ have the same remainder when divided by $m$.

To avoid confusion, it is customary to write the second expression as $a\equiv x\pmod m$. This way, if you see $=$ you know you are using the first meaning, if you see $\equiv$, it is the second.

(Of course, every now and then, books mix the two notations, hopefully in contexts where which one is intended is clear.)