When the denominator is larger than the numerator, why does the modulo equal the numerator?

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


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

enter image description here


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.


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 % 2 = 1

What remains after all the times 2 goes into 1 (which is no times), is 1.

5 % 40 = 5

What remains after all the times 40 goes into 5 (which is no times), is 5.

12 % 2000 = 12

What remains after all the times 2000 goes into 12 (which is no times), is 12.