Is Modular Arithmetic Notation Good?

510 Views Asked by At

When we write $$a = b\, (\mathrm{mod}\, n)$$ we mean $a$ and $b$ belong to the same equivalence class. This is a symmetric property, so writing $$a \equiv_n b$$ is intuitive. On the other hand, we also treat $(\mathrm{mod}\, n)$ like an operator: that is, given some $b$, we write $b\, (\mathrm{mod}\, n)$ to denote the remainder of $b$ upon division by $n$. In this setting, it is not necessarily true that $a = b\, (\mathrm{mod}\, n)$, even if $a$ and $b$ belong to the same equivalence class. Disagreements in notation are never good, so my friend writes $\lfloor b\rfloor_n$ to mean the remainder after division by $n$.

There is now a very clear distinction between congruence mod $n$ and the modulo operator. However, this makes me think, what if there is a deep reason why the common notation is good? To me the current conventions seem bad, but there must be reason it is popular. Why do people use the current notation?

2

There are 2 best solutions below

1
On BEST ANSWER

Nobody uses $a\mod b$ as an operator. That's an exaggeration, but basically that notation is not as popular as you seem to think. It is non-standard and discouraged. Programmers sometimes use it because they're used to the % operator in many programming languages, but I don't think I've ever seen someone write $a\mod b$ on math.SE without a mathematician telling them that's not really how the notation works.

Sometimes it's useful to have a notation for "the unique $x\in \{0, ... b-1\}$ such that $a\equiv x\mod b$", and in that case writing $a\mod b$ might not be an unreasonable way of doing it as long as explain the notation beforehand. $\lfloor a \rfloor_b$ seems reasonable as well. There is no standard notation for this operation.

1
On

I've also wondered what the simplest notation would be. Some alternative notation uses $mod(a,n)$. So then we can write the same identity multiple ways: \begin{align} ab \: (mod \: n) &= (a \: (mod \: n))(b \: (mod \: n)) \: (mod \: n) \\ mod(ab,n) &= mod(mod(a,n)mod(b,n),n)\\ ab &\equiv_n mod(a,n)mod(b,n) \end{align} Using $mod(a,n)$ requires one to remember which comes first (the $a$ or the $n$). Alternative notation might use $mod_n(a)$ as a replacement for $mod(a,n)$. So we would have a fourth way to express the same identity: $$ ab \equiv_n mod_n(a)mod_n(b)$$ This consistently keeps $n$ as a subscript.


Anyone who wants to use notation $\equiv_n$ or $mod_n(a)$ can simply define them in one line at the start of their work.