Basic Question: 1 mod 4
modulo - Why does 2 mod 4 = 2? - Stack Overflow
elementary number theory - The square of an integer is congruent to 0 or 1 mod 4 - Mathematics Stack Exchange
[Modular arithmetic] -1 mod 5 = 4. Why?
How much is 17 mod 3?
17 mod 3 equals 2 since dividing 17 by 3 gives a quotient of 5 and a remainder of 2. The remainder is the result of the modulus operation. In simpler terms, 17 mod 3 = 2.
How to calculate modulo division?
To calculate modulo division: subtract the divisor from the dividend until the resultant is less than the divisor.
What are the components of modulo division?
The components of modulo division are dividend, divisor, quotient, and remainder. The remainder is the answer or end result of the operation.
Videos
Basic question here.
For numbers that are congruent to 1 mod 4, it's pretty easy to show that these always end up at a smaller number in just three steps since the initial 3x+1 calculation always results in a multiple of 4. Does this mean that all numbers congruent to 1 mod 4 will end up in the 4-2-1 loop?
Example: 33 - 100 - 50 - 25
Mod just means you take the remainder after performing the division. Since 4 goes into 2 zero times, you end up with a remainder of 2.
Modulo is the remainder, not division.
2 / 4 = 0R2
2 % 4 = 2
The sign % is often used for the modulo operator, in lieu of the word mod.
For x % 4, you get the following table (for 1-10)
x x%4
------
1 1
2 2
3 3
4 0
5 1
6 2
7 3
8 0
9 1
10 2
Suppose the integer $z$ is even. Write it as $z = 2n$, where $n\in\mathbb{Z}$. Then $z^2 = 4n^2$; $z$ is divisible by 4. Suppose the integer $z$ is odd. Write it as $z = 2n + 1$ where $n\in\mathbb{Z}$; then $z^2 = 4n^2 + 4n + 1 = 4n(n+1) + 1.$
We have just shown that for any integer $z$, the square of $z$, when divided by 4 gives remainder 1 or 0.
For the first one the idea of what you have done is right (although did you mean to say that since $0 \leq r < 4$, $0 \leq r^2 < 16$?). An alternative viewpoint is to look at it like this. Define an equivalence relation $\sim$ on the integers by $x\sim y$ iff $x - y $ is a multiple of $4$. Then you can check that this is an equivalence relation, so that you know every integer in the universe is of the form $4k$, $4k+1$, $4k+2$, or $4k+3$. This is basically the division algorithm.
If you square each one of these, the first one is $16k^2 \equiv 0 $ mod $4$, the second is congruent to 1 mod 4, the third is congruent to zero mod 4 because $2^2 = 4$ and the last is congruent to 1 mod 4 because $(4k+3)^2 = 4(\text{stuff}) + 1$.
The second problem is a casebash too (just this time you're working mod 8 as you have done).
Alternatively, there is another way to look at this in terms of group theory. I'm mentioning this because you are studying groups and one way or another you will come to this. Consider the integers $\mathbb{Z}$ as a group. For question (a), let $\pi$ be the canonical projection from $\mathbb{Z}$ to $\mathbb{Z}/(4)$, where $(4)$ is the cyclic normal subgroup of $\mathbb{Z}$ consisting of all the multiples of $4$. $\pi$ is a map that sends each integer to its equivalence class, where the equivalence relation here is
$$x \sim y \hspace{3mm} \text{iff} \hspace{3mm} x - y \in (4).$$
Let us write $[a]$ for the equivalence class of an integer in the quotient $\mathbb{Z}/(4)$. Now multiplication in the quotient is well-defined because $(4)$ is a normal subgroup, so that $[a \times a] = [a] \times [a]$. There is no ambiguity in using $\times$ for both as it is just ordinary multiplication of integers.
What this means is when looking at the possible remainders of the square of an integer mod 4, you can just concentrate on calculating
$$ \begin{eqnarray} 0^2 &\equiv& 0 \hspace{2mm} \text{mod} \hspace{2mm} 4\\ 1^2 &\equiv& 1 \hspace{2mm} \text{mod} \hspace{2mm} 4 \\ 2^2 &\equiv& 0 \hspace{2mm} \text{mod} \hspace{2mm} 4\\ 3^2 &\equiv& 1 \hspace{2mm} \text{mod} \hspace{2mm} 4. \end{eqnarray}$$ This is because given any integer $[a]$, $[a] = [0],[1],[2]$ or $[3]$. Similarly for (b) your problem reduces to calculating the squares of $0,1,2 \ldots 7$ mod $8$.
Hope this helps!
So modulo is the remainder of integer division. It all makes sense for positive integers. But how should I think when it comes to negative numbers?
-1 mod 5 = 4.
I can reason my way to this by saying that from -1 there are 4 steps to the nearest multiple of 5, i.e -5. But why is the answer 4 and not -4? I should go to the negative side on the number line to get to the nearest multiple of 5. Please help me sort this out.