Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I told my students that the mod operator basically gives the remainder of division, so upon seeing:

0 mod 10

Some students (apparently) reasoned that, "10 goes into 0 zero times and there are 10 leftover."

What would be the best way to explain this to (non-math and non-CS major) students?

I would rather counter the "10 goes into 0 zero times with 10 leftover" reasoning than change my definition, if possible. I checked the documentation for the language, and it gave the same "remainder" definition that I gave.

Update: I am teaching a beginning programming class in Visual Basic (for non-CS majors). In most any programming language (as far as I know), the expression 0 mod 10 will evaluate to 0.

share|cite|improve this question
The notion you have considered is fine, Modulus operator just gives you the remainder. So $0$ is the only number that fits the division giving out another $0$ after multiplication and gives $0$ finally. I think 'chessmath' even posted the same thing. – Iyengar Feb 20 '12 at 17:48
"10 goes into 0 zero times with 10 leftover" means $\:0 - 10\cdot 0 = 10$. This is the error you need to address. – Math Gems Feb 20 '12 at 18:09
I usually think of this relation, (x + y)mod(y) = (x)mod(y) so using your example, (0 + 10)mod(10) = 0 – CleoR Nov 5 '15 at 13:28

10 Answers 10

up vote 10 down vote accepted

$10$ goes in to $0$ zero times and there are $0$ left over.

Go back to long division the way you learned it in third or fourth grade: $$ \begin{array}{ccccccc} & & 0 \\ \\ 10 & ) & 0 \\ & & 0 \\ \hline & & 0 \end{array} $$ The remainder is $0$.

share|cite|improve this answer
This will probably work best for my situation. Most of the students may be confused if I bring in the division theorem, although that would likely be best for math students. This idea goes back to what they know. – jtpereyda Feb 20 '12 at 18:45

If you want intuitive explanation say to them that leftover must not be greater that a size of cup(divisor) with which you take water from container(divident) because if there was more water in container than size of the cup you could always take one full cup more.

I also think that showing them division algorithm equation would be also good: $$a = bq + r$$ than substitute variables $$0 = 10 q + r$$ and show them that only valid substitution for $q$ and $s$ is $0$ and $0$ because $0$ and $10$ would produce false equation $0 = 10$.

share|cite|improve this answer
+1, Very good and to the point. – NoChance Feb 20 '12 at 17:51

Well there is no problem $0$ is equal $0\times10+0$ what means that the rest of the Euclidean division is zero. You can do that for every positive integer.

share|cite|improve this answer

I also have a hard time putting together the question statement. But if someone were to ask me to explain $0 \mod 10 \equiv 0$ to them, I might say one of the following three things.

Everything is congruent to itself. That is, if I were to say $x \mod 10 \equiv x$, this is true for all $x$. But perhaps that's uninspired.

$10$ divides $0-0$. This is the standard (at least, the one I consider standard) definition of mod, and so $0 \equiv 0$.

By the division algorithm, we see that $0 = 0 \cdot 10 + 0$, so that (reading the two outside numbers) $0 \equiv 0$.

share|cite|improve this answer

If you're teaching future programmers, you will need to bring up the division theorem at some point. While Hardy's answer is surely best for the specific question you asked, your students will also need some guidance when negative numbers are involved.

For example, what do you expect from -22 Mod 3 or 7 Mod -2? The results will seem arcane at first, but are the clear consequences of the relationship to integer division, which I believe always rounds towards 0 in Visual Basic.

Other languages may handle the rounding differently, but the equation a = b * (a div b) + (a mod b) seems to be universal.

share|cite|improve this answer

This helped me, I'm a programming student.

  • 0%2 = 0 (0/2 = 0 remainder 0)
  • 1%2 = 1 (1/2 = 0 remainder 1)
  • 2%2 = 0 (2/2 = 1 remainder 0)
  • 4%2 = 0 (4/2 = 2 remainder 0)
  • 5%2 = 1 (5/2 = 2 remainder 1)
share|cite|improve this answer

The remainder at the division with $k>0$ must be equal to some number between $0$ and $k-1$. The division remainder theorem should handle the rest.

share|cite|improve this answer

think about n mod m = what? if n=m then the remainder of n\m is ans incase of multiplication. . example 1mod 4= 1. 6 mod 4= 2

share|cite|improve this answer

Think of it this way.

x mod n where n > 0 and x > 0.

For example x = 49 and n = 10. As we no there are 9 remaining.

However, how does x have anything remaining if there was nothing there to start with.
I.E x = 0.

0 mod n == 0 as there was nothing to divide into to begin with so it can't have a remainder.

share|cite|improve this answer

Well it is actually more easy to explain than most try to do. Example:

4mod2 = the 2 is inside the 4 two times and rest is 0 So if you do "if(4%2 == 0)" this would be true. in a case of "if(i%2 == 0)" this would also be true for i=0. Why is that so? Because the rest of the modulo does not depend on the denominator. if you have 0 as a numerator , the rest will never be more than the numerater itself. It doesnt matter how big your denominator grows. eg x%y => the value will never be more than x. It is simply not possible. Everytime y is bigger than x, the rest will become 0 automaticaly. 0%0+n = 0 1%1+n = 0 2%2+n = 0 x%x+n = 0

Tell me, if you have zero pizzas and you want to give 10 students pizzas, how many pizzas will be left? Excatly, zero ones. Your students reasoned 10 students wants to eat 0 zero pizzas and there are 10 pizzas left. So actually you have to show them, there are 10 students left with empty stomachs but still zero pizzas on the table. (students are always hungry, this will work)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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