[Math] When the denominator is larger than the numerator, why does the modulo equal the numerator

algebra-precalculuscalculator

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?

Best Answer

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$.