As an example, why does 1 modulo 2 equal 1?

According to Google's built-in calculator:

1 % 2 = 1

5 % 40 = 5

12 % 2000 = 12

Why is the remainder not "0", "error", or something?

In other words, I don't follow the mathematical reasoning:

Why is the remainder of 5 % 40 set as 5 itself, when, in fact, there is no positive integer (whole-number) remainder, e.g. 5/40 = 0.125?

  • 2
    $\begingroup$ Do you know the definition of remainder? If you take 27 modulo 5, then the remainder is 2, and not 5 (which is 27/5 rounded down). $\endgroup$ – N.U. Jun 17 '13 at 12:48
  • $\begingroup$ @N.U., yes, I do. Not sure where you got 27 % 5 from, I'm asking about cases where the denominator is larger than the numerator $\endgroup$ – Baumr Jun 17 '13 at 14:21
  • 1
    $\begingroup$ Well, that does not really matter. It is exactly the same rule whether or not the integer part is 0 or 5. $2 \, \% \, 5$ is also equal to 2. You do modulo calculations every day, since a day is 24 hours, but one always says what the clock is modulo 12 (6:00 and 18:00 are 6 AM and 6 PM respectively). $\endgroup$ – N.U. Jun 17 '13 at 14:49
  • $\begingroup$ @N.U., so why does the modulo remainder equal the numerator itself in these cases? $\endgroup$ – Baumr Jun 17 '13 at 20:34
  • $\begingroup$ It is straight from the definition, and not different from the other cases. For the case 5 modulo 40, we have that $5 = 0 \cdot 40 + 5$, so the remainder is 5. Maybe it would help if you could write down your definition of remainder, since it looks like you don't have the correct definition. But if you take a look at the answers, everything is thoroughly explained. $\endgroup$ – N.U. Jun 17 '13 at 21:02

The remainder when $1$ is divided by $2$ is $1$, since $1=(0)(2)+1$ and $0\le 1\lt 2$.

In general, if $0\le a\lt m$ then $a\operatorname{\%}m=a$.

In general, when you divide an integer $a$ by a positive integer $m$, there is a quotient $q$ and a remainder $r$. So $$a=qm+r,$$ where $0\le r\lt m$.

For instance, if $a=30$ and $m=12$, then $q=2$ and $r=6$. If $a=5$ and $m=12$, then $q=0$ and $r=5$.

In the case where $a=1$ and $m=2$, the quotient is $0$ and the remainder is $1$.

Remark: It is useful to have concrete images to go along with more abstract descriptions. Suppose that we have a box that contains $a$ cookies, and we have $m$ kids in the room. We give a cookie to everyone (if we can). Then we do it again, and again, doing a full round each time. The number of cookies left in the box is the remainder when $a$ is divided by $m$, it is what's left over.

For example, if $a=40$ and $m=12$, we do $3$ full rounds, each kid gets $3$ cookies. This $3$ is called the quotient. We will have $4$ cookies left over, the remainder is $4$, in symbols $40\operatorname{\%} 12=4$. If we start with $72$ cookies, the remainder is $0$.

But if we start with $5$ cookies, then we can't even get started, we cannot distribute cookies without causing a riot. So the quotient is $0$, nobody gets a cookie. And all the cookies are left over, the remainder is $5$, that is, $5\operatorname{\%}12=5$.

  • $\begingroup$ But why, based on the underlying quantitative mathematical concepts, is that the case? $\endgroup$ – Baumr Jun 17 '13 at 20:35
  • $\begingroup$ Using a calculator, here is how you find the remainder when the positive number $a$ is divided by $m$. (1) Use the calculator to divide as usual. So for $a=47$ and $m=25$ I get $1.88$. (2) Throw away (subtract) the part in front of the decimal point. so I get $0.88$. (3) Multiply by $m$. I get $22$. But it is better to think of remainder as follows. Subtract $m$ from $a$ until you can't subtract any more without getting a negative answer. what's left is the remainder. If we start with $a=5$ and $m=12$, we can't subtract at all, so what's left (the remainder, $5\%12$) is just $5$. $\endgroup$ – André Nicolas Jun 17 '13 at 20:49
  • 1
    $\begingroup$ Think of it in terms of cookies. You have $40$ cookies, $12$ people. You give a cookie to everybody until you cant't do a full round anymore. What's left in the box is the remainder. There will be $4$ cookies left, so $40\%12=4$. If you start with $12$ people, $5$ cookies, you can't give a cookie to everybody, so the remainder is $5$. $\endgroup$ – André Nicolas Jun 17 '13 at 20:51
  • $\begingroup$ What if the cookie is set to expire in 3 days, can you then give that same cookie to the next person? (So is there where Einstein's theories of space-time come into play?) $\endgroup$ – Baumr Jun 17 '13 at 21:02
  • $\begingroup$ So, does that mean that the answer is: the remainder is the numerator because it is simply not being divided? $\endgroup$ – Baumr Jun 17 '13 at 21:03

I think maybe you've not fully understood the modulo operator. Maybe this picture will help:

enter image description here

  • $\begingroup$ For the avoidance of doubt: I understand what the modulo is; especially in cases like the example you gave, 9 % 2 = 1, where there is a remainder (even if it's zero). My question refers to cases where division does not result in a zero or whole-number remainder. $\endgroup$ – Baumr Jun 17 '13 at 14:32

Because; ${}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}$

enter image description here

See the space where I gave it a green $0$. For a while consider there is nothing written. What number $\color{green}{n}$ could we put there such that after multiplying by $\color{red}{2}$, say $\color{red}{2}\color{green}{n}$, a substraction $1-\color{red}{2}\color{green}{n}$ makes sense? Search it.... The common number for $\color{green}{n}$ could be $\color{green}{0}$. Now I think, you can make this way generalized for other case.

  • $\begingroup$ Could you please explain what the table means? I have never seen anything like it before. $\endgroup$ – Tom Oldfield Jun 17 '13 at 12:59
  • $\begingroup$ @TomOldfield: It is not a special or a new thing. I am just pointing what others cited theoretically by colors. $\endgroup$ – mrs Jun 17 '13 at 13:03

$$1\equiv b \mod 2 \to b-1=2k :k\in\mathbb Z , 0\le b\le2 $$ only $b=1$ satisfy in $b-1=2k :k\in\mathbb Z , 0\le b\le2 $


the remainder is how much you add to the product in order to get back to the numerator (assuming these values are ints)

so, for 5 % 40........

numerator = 5

5 / 40 = 0

product = 0

product + remainder = numerator

0 + remainder = 5

remainder = 5

  • 1
    $\begingroup$ Welcome to math.SE! Please consider taking the time to read the faq to familiarise yourself with some of our common practices. In addition, this page should give you a start at learning how to typeset mathematics here so that your posts say what you want them to, and also look good. $\endgroup$ – Joao Oct 13 '14 at 6:19

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.