How is -4 mod 4 = 0 mod 4?

tomtomru

New member
Joined
Mar 13, 2022
Messages
7
I've just learnt a new chapter on discrete mathematics but I'm sort of unclear. Can someone kindly explain why -4 mod 4 = 0 mod 4? And also how 17 mod 5 = 2?
 
I've just learnt a new chapter on discrete mathematics but I'm sort of unclear. Can someone kindly explain why -4 mod 4 = 0 mod 4? And also how 17 mod 5 = 2?
Please show us the definition you were given for "mod".

The term is used in two different ways, an operation (remainder, commonly in programming) and as a modifier for an equivalence (which is standard in number theory). In your course, I would expect to see the latter, but what you are writing looks like the former. I need to be sure whether you are doing what you are taught, or are misunderstanding it.

In number theory, we say that [imath]a\equiv b(\mod n)[/imath] when [imath]n|(a-b)[/imath]. That is true in both of your examples: [imath]4|(-4-0)[/imath], and [imath]5|(17-2)[/imath], so that [imath]-4\equiv 0(\mod 4)[/imath] and [imath]17\equiv 2(\mod 5)[/imath].
 
Two integers, a and b. are "equal mod n" if and only if their difference, a- b or b- a, is divisible by n. That is the same as saying that a- b= kn for some integer k.

If a= -4 and b= 0 then a- b= -4- 0= -4 and b- a= 0- (-4)= 4 which are both divisible by 4.

If a= 17 and b= 2 then a- b= 17- 2= 15 and b- a= 2- 17= -15 which are both divisible by 5.
 
This was NOT intended asss a new thread, it was a response to the problem posed in the thread where I posted it.
Please use the reply button while responding to a particular post - so that a proper reference is clear.
 
-4 mod 4 = 0 mod 4? And also how 17 mod 5 = 2?
-4mod 4 = x mod 4
We would like x to equal 0, 1, 2 or 3
In mod 4, 4 = 0. You can always add 0 to a value and it will not change (it may look different)
Now -4 + 4 = 0
So -4 mod 4 = 0 mod 4

17 mod 5 = y mod 5
We would like y to equal 0, 1, 2, 3 or 4
5=0 in mod5
Now 17 - 5 - 5 - 5 = 2,
So 17 mod 5 = 2 mod 5

Alternate method
When you divide 17 by 5, the remainder is 2. hence 17mod 5 = 2 mod 5

When you divide -4 by 4, the remainder is 0. So -4 mod4 = 0mod4

Note: If you have -7 mod 5. the remainder is -2. Just add 5 to the -2 to get 3
 
Please show us the definition you were given for "mod".

The term is used in two different ways, an operation (remainder, commonly in programming) and as a modifier for an equivalence (which is standard in number theory). In your course, I would expect to see the latter, but what you are writing looks like the former. I need to be sure whether you are doing what you are taught, or are misunderstanding it.

In number theory, we say that [imath]a\equiv b(\mod n)[/imath] when [imath]n|(a-b)[/imath]. That is true in both of your examples: [imath]4|(-4-0)[/imath], and [imath]5|(17-2)[/imath], so that [imath]-4\equiv 0(\mod 4)[/imath] and [imath]17\equiv 2(\mod 5)[/imath].
Ah... Okay I get it now. And yes. I believe what I'm learning at the moment is related to the first term you've mentioned. However, it does relate back to number theory correct?
Anyways thank you so much for the explanation.
 
-4 mod 4 = 0 mod 4? And also how 17 mod 5 = 2?
-4mod 4 = x mod 4
We would like x to equal 0, 1, 2 or 3
In mod 4, 4 = 0. You can always add 0 to a value and it will not change (it may look different)
Now -4 + 4 = 0
So -4 mod 4 = 0 mod 4

17 mod 5 = y mod 5
We would like y to equal 0, 1, 2, 3 or 4
5=0 in mod5
Now 17 - 5 - 5 - 5 = 2,
So 17 mod 5 = 2 mod 5

Alternate method
When you divide 17 by 5, the remainder is 2. hence 17mod 5 = 2 mod 5

When you divide -4 by 4, the remainder is 0. So -4 mod4 = 0mod4

Note: If you have -7 mod 5. the remainder is -2. Just add 5 to the -2 to get 3
Oh... okay. So is it correct for me to assume that -4 mod 4 can also equal to 4 mod 4? But the reason why it is 0 mod 4 is because we want the most simplest term?
 
And yes. I believe what I'm learning at the moment is related to the first term you've mentioned. However, it does relate back to number theory correct?
So is it correct for me to assume that -4 mod 4 can also equal to 4 mod 4? But the reason why it is 0 mod 4 is because we want the most simplest term?
Please show us a definition and an example from your course (an image of a book or printed notes is best), so we can be sure of the form you are learning. Also, what is the course?

If it is genuinely the remainder definition, then you can say that -4 mod 4 = 0, and also 4 mod 4 = 0, and therefore -4 mod 4 and 4 mod 4 are equal. It is not necessary to say that only one number can be put on the right-hand side! So it would be wrong to say "it is 0 mod 4".

Wanting only the "simplest term" (least positive residue) is appropriate only in saying, e.g., 7 mod 4 = 3, where no number other than 3 would be appropriate. When "mod" is used on both sides, the right-hand side is not "the answer", just one of many expressions equal to the left-hand side.

All this changes when you go to the proper number theory notation (modular arithmetic). The two concepts are very closely related, but different in detail.
 
Oh... okay. So is it correct for me to assume that -4 mod 4 can also equal to 4 mod 4? But the reason why it is 0 mod 4 is because we want the most simplest term?
Please note that it is unusual for -x mod y = x mod y. -4 mod 4 = 4 mod 4 only because -4 and 4 differ by a multiple of 4. Note that -3mod4 = 1mod4.
 
Top