0
$\begingroup$

I am learning modular arithmetic and trying to figure out, how to find remainder where denominator is greater than numerator?

For example:

i) $2 \bmod 5 =$ ?

I tried to solve this but I got 0 as remainder whereas in calculators it is $2$ . I was solving it with regular math operators like adding 0 and value after points.

ii) $-2 \bmod 5$ = ?

Also I wanted to know, how to handle negative number in modular arithmetic?

$\endgroup$
  • $\begingroup$ $2\pmod{\!5}\ $ is meaningless. It should be $\,2\bmod 5\,$ if it denotes the remainder when $2$ is divided by $5$. It is essential to understand the difference between $\!\bmod\!$ as a binary operation (remainder) vs. ternary congruence relation, e.g. see this answer, and this one by Arturo Magidin. $\endgroup$ – Bill Dubuque Sep 25 '17 at 13:28
  • $\begingroup$ @BillDubuque I wrote 2 mod 5 but it was changed to 2 (mod 5) by N. F.Taussig. Please check edit history. $\endgroup$ – Alena Sep 28 '17 at 5:00
0
$\begingroup$

Remember, by definition, the remainder when dividing $m/n$ is such a number $r$ such that

  1. $0\leq r<n$
  2. There exists some $k$ such that $k\cdot n + r = m$

by that definition, the remainder when dividing $2$ by $5$ is $2$, because $$0\cdot 5 + 2 = 2$$


As far as modular arithmetic is concerned, remember that $$x\equiv y\mod n$$ if and only if $n|x-y$. As a consequence, it is always true that $$x+k\cdot n\equiv x\mod n$$ for any integer $k$. In your case, that means that $$-3\equiv -3+1\cdot 5\mod 5$$

$\endgroup$
  • $\begingroup$ thanks for helpful answer, how 0.5 comes? when we divide after adding .0 it becomes 20 and 20-20 is equal to 0. Looks like one of my step is wrong and wanted to correct it $\endgroup$ – Alena Sep 25 '17 at 12:52
  • $\begingroup$ @Alena $0.5$ is a rational number and has nothing to do with this question. But by definition, $0.5$ is equal to $\frac 5{10}$. $\endgroup$ – 5xum Sep 25 '17 at 12:54
  • $\begingroup$ @5xum In some countries, the product of $a$ and $b$ is written $a.b$. $\endgroup$ – N. F. Taussig Sep 25 '17 at 12:59
  • $\begingroup$ @Alena If by $0.5$ you mean $0\cdot 5$, then the $0$ comes from the fact that $0$ is the number $k$ for which $k\cdot 5 + 2 = 2$. You can calculate the number by integer division - $2$, divided by $5$, is equal to $0$. $\endgroup$ – 5xum Sep 25 '17 at 13:00
  • $\begingroup$ Please don't abuse notation in a way that heightens the confusion between $\!\bmod\!$ the relation vs. operation. Correct is $\,x\equiv y\pmod{\!n}.\,$ What you wrote is easily confused with $\, x = y\bmod n,\,$ i.e. $\,x = (y\bmod n)\,$ by beginners. $\endgroup$ – Bill Dubuque Sep 25 '17 at 13:18
1
$\begingroup$

Here is a realisation that helped me out back when I was learning modular arithmetic: Don't think of the symbol $\!\!\!\pmod k$ as an operation, but rather as part of the relation $\equiv$. For instance, $$ 7\equiv 2\pmod 5 $$ doesn't mean that if you take $7$ and apply the "modulo five" operation to it, you get $2$ (or the other way around). It rather means that $7$ and $2$ are in some sense "five-similar", i.e. they are both equally far away from any multiples of $5$. Think $7=_5 2$, if that makes any sense to you.

That way, you can also use, for instance $$ 1974 \equiv -1\pmod 5 $$ which might be helpful since $-1$ is often much easier to handle than $4$ in a lot of arithmetic, like if you were told to calculate $1974^{37}$ modulo $5$.

PS. The phrase "five-similar" is just something I came up with right now, and is not in any way conventional terminology. Unless you explain it, there is real risk that no one will understand it.

$\endgroup$
1
$\begingroup$

We say that $a \equiv b \pmod{n}$ if $a$ and $b$ have the same remainder when divided by $n$. Equivalently, $a \equiv b \pmod{n}$ if $n \mid a - b$.

By the Division Algorithm, given $m, d \in \mathbb{Z}$, with $d \neq 0$, there exist $q, r \in \mathbb{Z}$ such that $m = qd + r$ and $0 \leq r < |d|$. The number $q$ is called the quotient; the number $r$ is called the remainder.

Since $2 = 0 \cdot 5 + 2$, $2$ has quotient $0$ and remainder $2$ when divided by $5$. Hence, $2 \equiv 2 \pmod{5}$.

Since $-2 = -1 \cdot 5 + 3$, $-2$ has quotient $-1$ and remainder $3$ when divided by $5$. Hence, $-2 \equiv 3 \pmod{5}$.

$\endgroup$
  • $\begingroup$ could you please explain? that doesn't make any sense to me. $\endgroup$ – Alena Sep 25 '17 at 11:47
  • $\begingroup$ I elaborated. Let me know if it still does not make sense to you. $\endgroup$ – N. F. Taussig Sep 25 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.