2

According to Modulo of a negative number

"In arithmetic modulo , we seek to express any $$ as $+$, where $$ must be a non-negative integer."

This makes sense to me as we are trying to group numbers into classes from $0$ to $n$.

E.g. If $n = 4$, then one of the following holds: $$a \equiv b \pmod 4 \iff \begin{cases} a, b \in [0] = \{4k + 0\mid k\in \mathbb Z\} = \{\cdots, -8, -4, 0, 4, 8, 12,\cdots\} \\ \\ a, b \in [1] = \{4k + 1\mid k \in \mathbb Z\} = \{\cdots, -7, -3, 1, 5, 9, 13,\cdots\} \\ \\ a ,b \in [2] = \{4k + 2\mid k \in \mathbb Z\} = \{\cdots, -6, -2, 2, 6, 10, 14,\cdots\} \\ \\ a, b \in [3] = \{4k + 3\mid k \in \mathbb Z\} = \{\cdots, -5, -1, 3, 7, 11, 15, \cdots\} \end{cases} $$

But according to Shall remainder always be positive?

For example: $$-48\bmod{5} = 2$$ and $$-48 \bmod{5} = -3$$ are both true because

"2 and −3 are just two names for the same element" (Means they are the same name for same class I assume)

Hence $r$ can be a non-negative integer which disproves the original statement? I am confused.

Bill Dubuque
  • 272,048
mathguy
  • 927
  • You are confusing some things. $-48\pmod 5 = 2$ as $2$ is in the range $[0,5)$. But, $$-48\equiv -3\equiv 2\pmod 5$$The point is, if one forms the group $\mathbb Z/5\mathbb Z$, the group of integers modulo $5$, $-48,;-3,$ and $2$ all describe the same number in this group. Often, to distinguish a number in $\mathbb Z$ from one in $\mathbb Z/n\mathbb Z$, we write $k\in\mathbb Z$, $\overline{k}\in\mathbb Z/n\mathbb Z$. – Rushabh Mehta Mar 01 '19 at 03:32
  • @Don Wrong notation, it should be $\ {-}48\bmod 5 = 2\ $ (use \bmod in TeX) – Bill Dubuque Mar 01 '19 at 03:50
  • 2
    You should ignore the 2nd linked answer and instead read the other answers there (the highest voted answer is often not the best). – Bill Dubuque Mar 01 '19 at 03:53
  • @BillDubuque I think Mark Bennet's answer provides more clarity for me – mathguy Mar 01 '19 at 04:39
  • Do you understand the difference between $\bmod$ the binary operation vs. equivalence relation? – Bill Dubuque Mar 01 '19 at 04:43
  • @BillDubuque Is it correct to say that $-48 mod 5$ when used as a binary operation can represent any number in the set $[2]$ and when mod is used to show equivalence relation we find a nonnegative integer $r$ from [0,5) which indicates which set $a$ is in? – mathguy Mar 01 '19 at 04:47
  • 1
    @mathguy No, operations are (single-valued) functions. The most common definition used for the operation is $, a\bmod n,$ is the least natural $,r\equiv a\pmod n,,$ which is the remainder $r$ left by $ a\div n.\ $ Then we have $\ a\equiv b\pmod{n}\iff a\bmod n = b\bmod n.\ $ – Bill Dubuque Mar 01 '19 at 15:51
  • @BillDubuque That was a typo lol, my bad. I don't think the rest of the comment is incorrect. – Rushabh Mehta Mar 01 '19 at 16:08
  • 1
    To be honest I do not know why the first citation says we seek where $r$ must be non-negative. I do not think we do any such thing and we can certainly have negative expressions of residues. The remainder is by convention non negative but is is also strictly less than the modulus. But the remainder isn't the residue class. It is a specific element with in the class. – fleablood Aug 07 '19 at 01:11

3 Answers3

3

In mathematics, one usually writes “$a\equiv b\pmod m$”, and that means precisely that $b-a$ is a multiple (an integral multiple, more specifically) of $m$. With this definition and this notation, $m$ can be any integer, positive, negative, or zero.

Lubin
  • 62,818
1

The division with remainder is usualy defined from left to right.

As has been said by other posters.

If $n\ mod\ m\neq 0$ with $m>0$ one asks for the largest integer multiple $mq$ which is less than n and the remainder is the difference $r=n-mq$

Hence r is always $>0$

A way to get negative remainders would be to consider division from right to left instead.

For a given modulo $m>0$ we have remainders $\{-m+1,\dots,-1,0\}$ instead of $\{0,1,\dots,m-1\}$ and $mq$ is the least integer multiple of m larger than n .

Both definitions are equivalent,

$n=r\ mod\ m$ for some $r\in \{0,\dots,m-1\}$ according to left right division iff $n=m-r\ mod\ m$ which is $n=-m+r\ mod\ m$ according right left division.

In the second system one would get the result of OP's example $-48=-3\ mod\ 5$ and respectivly $48=-2\ mod\ 5$.

If one wants negative remainders for $n<0$ and positive remainders $n>0$ one can

introduce a shift function which assigns remainder $-m+r=-(m-r)$ to n whenever n is negative

and r otherwise,where r is defined for n and m in the canonical way

Where i have seen negative remainders being used is when considering quadratic congruences like $x^2=-1\ mod\ m$ which is the same with asking for $x^2=m-1\ mod\ m$

Wassilis
  • 177
0

Operations are (single-valued) functions. The most common definition used for the operation is $ mod $ is the least natural $≡(mod)$, which is the remainder $$ left by $÷$. Then we have $≡(mod)⟺mod=mod$.

mathguy
  • 927