# The right way to write modulus equation?

I came from computer forum, and I came across many different expression of modulus equation, which of the following is authentic ?

5 ≣ 1 (mod 2)

5 = 1(mod 2)

5 = 1 mod 2

5 mod 2 = 1

5 mod 2 ≣ 1

-
I'd say the first three are ok (only, in the first one the symbol is $\equiv$). I dislike the last two, because they obscure the equivalence relation. –  Andrea Orta Sep 15 '12 at 9:20

$5 \equiv 1 \pmod{2}$

This is typical notation for this equivalence relation on $\mathbb{Z}$.

$5 = 1 \pmod{2}$

This is fairly common notation for the equivalence relation. Almost nothing is gained by using notation to distinguish between = and $\equiv$, so many don't bother.

One may also mean by the $\pmod{2}$ decoration that they are working in the ring of integers modulo 2, in which case 5 and 1 are not denoting integers, but equivalence classes modulo 2, in which case the two sides are literally equal.

$5 = 1 \mod 2$

This is the same thing as the previous one, just typeset differently. Do take care to note the added spacing; this ensures that this notation isn't confused with the following notation.

I would guess this style is fairly uncommon.

$5 \bmod 2 = 1$

This is the operator form of $\bmod$. It isn't being used to express an equivalence relation, but instead the author is using the related arithmetic operation $x \bmod y$ that returns the reduced representative of $x$ modulo $y$.

This is fairly common to use when you need to move back and forth between integer and modular arithmetic. In particular, programming languages usually have such an operator.

It's usually defined in concert with an integer division operator (e.g. $17 \mathbin{\text{div}} 3 = 5$), and satisfies

$$x = y (x \mathbin{\text{div}} y) + (x \bmod y)$$

for every $x$ and every non-zero $y$.

$5 \bmod 2 \equiv 1$

This is terrible; don't use it.

-
The most common is $5 \equiv 1 \pmod{2}$. In other circumstances, you want to use $\mathrm{mod}$ as a function, and then you can write $5 \operatorname{mod} 2$ (which is equal to $1$).