I am very confused by the following equation:
$$ \mathbb {-1\%4=3}$$
I understand that the modulo or modulus operator gives the remainder of a division. This is not new or a mystery to me. What I am confused about is how the remainder is the integer 3. This does not make logical sense to me.
For instance, if I do -1 / 4 I get -0.25 shown in the following equation: $\mathbb {-1 / 4 = -0.25} $ Where is the 3 in the remainder?
Or check this out, if I calculate the modulus of another couple of numbers the answer is much simpler for me to understand. Check this out: $$\mathbb {5 \% 3 = 2} $$
This is obvious that the remainder is 2 because $\mathbb {5 / 3 = 1 R2}$ The R2 means remainder of 2. So, in other words 5 / 3 = 1 with a remainder of 2. This makes sense why the modulo is of 5 % 3 is 2 based on the result of the division.
I am confused though why $\mathbb {-1 / 4 = -0.25}$ but $ \mathbb{-1 \% 4 = 3}$. Can you help me understand this?
Thank-you for reading this.
There is a subtle difference between the usage of $=$ (equality) and $\equiv$ (equivalence).
We say $$a\equiv b\pmod c\implies a=b+cx, x\in\Bbb Z.$$
All integers will fall into one of four categories: $0, 1, 2$, or $3\pmod 4$, depending on which one of these numbers you have to add to some multiple of $4$ you have to get your integer. In your case, in order to get $-1$, you have to add $3$ to $-4$, and therefore, we have $-1\equiv 3\pmod 4$.