4

In the following statement, it seems "mod" serves two separate functions.

$(ab)\textrm{ mod } n \equiv \big((a\textrm{ mod } n)\cdot(b\textrm{ mod } n)\big)\textrm{ mod } n$

  • There is the use as a qualification of a statement about equivalence, as in the final "mod n": "these two expressions (LHS and RHS of $\equiv$) are equivalent mod n."
  • There is the use as an operator applied to a single expression, as in all the other occurences.

Is there any ambiguity here? Any potential mathematical hazards that can arise from not being clear about the distinction?

EDIT - thinking on, I can see that the final "mod n" could be interpreted in either sense...)

Bill Dubuque
  • 272,048
  • 1
    There's a difference between the way mathematicians and programmers use "mod". The former refers to an equivalence class, the latter to a remainder (the least positive member of the equivalence class). Both usages are fine, but the difference between them can cause some confusion. – lulu Oct 23 '21 at 15:49
  • So what about the mixture in the statement in the question - is it correct by the standards of either camp? – Robin Andrews Oct 23 '21 at 15:52
  • 3
    The statement I would prefer is that if $a\equiv A \pmod n$ and $b\equiv B\pmod n$ then $ab\equiv AB \pmod n$. good enough? – lulu Oct 23 '21 at 15:54
  • 1
    Nevertheless, your statement is also correct. (Follows by Lulu's comment.) – Berci Oct 23 '21 at 16:04
  • Wow, that was impressive for you to accurately locate and articulate that difference! – Trebor Oct 23 '21 at 16:14
  • Depending on your interpretation, some of the followings may be wrong:

    $$\begin{align} 7 &\equiv 1 \pmod 3\ 7 &\equiv 1 \mod 3\ 7 &\equiv 1 \bmod 3\ 7 &= 1 \bmod 3\ 7 &= 7 \bmod 3\ 1 &= 7 \bmod 3\ 7 \bmod 3 &= 1\ \end{align}$$

    – peterwhy Oct 23 '21 at 16:22
  • Depending on the context, perhaps the author has some other meaning in mind for "$\equiv$". For example, it might signify that this formula is an identity true for all integers $a$ and all integers $b$ rather than something that expresses a relationship between particular values of $a$ and $b.$ To know what was meant I think you have to read a good part of the earlier text to see how these symbols are used there. If you have no access to text associated with this formula then you can only guess. – David K Oct 23 '21 at 17:55
  • @lulu mod is also widely used by mathematicians. The difference has nothing to do with profession. – Bill Dubuque Oct 24 '21 at 01:04
  • There is no ambiguity. Rather there is an error. Either the congruence sign should be an equality, or else you need a final $\pmod n$ if you intend it to be a congruence. See the "Beware" in the linked dupe. – Bill Dubuque Oct 24 '21 at 01:09

1 Answers1

3

It is customary to write the equivalence relation as $a \equiv b \pmod m$, with parenthesis around $\bmod m$ and a bigger space between $a \equiv b$ and $\bmod m$.

Even $\TeX$ (and $\LaTeX$ and MathJax) do that with the appropiate commands:

The equivalence relation a \equiv b \pmod n renders as $a \equiv b \pmod n$

The binary operation a = b \bmod n renders as $a = b \bmod n$

That usually suffices to avoid ambiguity since it wouldn't make sense to put parenthesis like that in the $\bmod$ operation.

The expression you have probably should be written like

$$(a b) \bmod n \equiv ((a \bmod n)\cdot(b \bmod n)) \pmod n$$

if the intention is that the three first $\bmod$'s denote the operation and the last one denotes the equivalence relation or

$$(a b) \bmod n = ((a \bmod n)\cdot(b \bmod n)) \bmod n$$

if the intention is that the four $\bmod$'s denote the operation (notice that in this case, one should use $=$ instead of $\equiv$).

jjagmath
  • 18,214