Can we have modulo a negative number?

Click For Summary

Discussion Overview

The discussion revolves around the concept of performing modulo operations with negative numbers. Participants explore the implications, definitions, and potential equivalences between modulo with positive and negative integers, as well as the treatment of negative numbers in mathematical contexts.

Discussion Character

  • Exploratory
  • Debate/contested
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • Some participants question why modulo operations with negative numbers are not commonly seen, suggesting that it may simply be a matter of definition.
  • One participant argues that using negative divisors does not yield new insights and that positive divisors are preferred for convenience.
  • Another participant presents examples from programming languages, specifically Perl, to illustrate how negative moduli can yield consistent results, but questions the significance of these results.
  • Some participants assert that modular arithmetic inherently includes equivalences between negative and positive numbers, noting that operations like -3 mod 3 yield the same results as 3 mod 3.
  • There is a discussion about the treatment of units in definitions, with some arguing that negative numbers should not be excluded from discussions of primes or modular arithmetic.
  • One participant suggests that extending equivalence classes to include negative integers seems natural and uncomplicated, questioning whether this introduces problems in multiplication.
  • Another participant emphasizes that while negative numbers can be included in modular arithmetic, the original question remains about why they are often ignored in literature.
  • Some participants express that the equivalence of n and -n in generating subgroups leads to no difference in modular arithmetic, reinforcing the idea that negative numbers can be included without issue.

Areas of Agreement / Disagreement

Participants express a mix of agreement and disagreement. While some acknowledge that negative moduli can be used and yield consistent results, others question the practical benefits and the reasons for their exclusion in traditional discussions. The discussion remains unresolved regarding the implications and acceptance of negative moduli in mathematical literature.

Contextual Notes

Some limitations in the discussion include the lack of clarity on definitions and the potential implications of including negative numbers in modular arithmetic. There is also an unresolved question about the practical benefits of using negative moduli.

matqkks
Messages
283
Reaction score
6
Why can't we have modulo negative number? I have never seen this.
 
Mathematics news on Phys.org
matqkks said:
Why can't we have modulo negative number? I have never seen this.

You would simply have to define what you mean by it.

In terms of factorisation and remainders, everything can be seen with a positive divisor, so I wouldn't expect any new insights.

The same goes for allowing negative numbers to be prime.
 
matqkks said:
Why can't we have modulo negative number? I have never seen this.
Because a negative number ##-n=(-1)\cdot n## differs from its positive counterpart only by a unit, ##\varepsilon=-1##. So the ideals ##n\mathbb{Z}## and ##\varepsilon n\mathbb{Z}## are the same. This implies that the factor rings ##\mathbb{Z}[x]/n\mathbb{Z} = \mathbb{Z}_n = \mathbb{Z}[x]/\varepsilon n\mathbb{Z}## are equal, too. And as it makes no difference, it is a matter of convenience to choose the positive version. Otherwise the calculations were full of unnecessary signs.
 
  • Like
Likes   Reactions: lavinia and PeroK
I don't see any conceptual difference between modulo of a positive versus negative integer. I am not sure if all computer languages would implement it. Perl does:

Integers 0..9 mod -3:
0 mod -3 = 0
1 mod -3 = -2
2 mod -3 = -1
3 mod -3 = 0
4 mod -3 = -2
5 mod -3 = -1
6 mod -3 = 0
7 mod -3 = -2
8 mod -3 = -1
9 mod -3 = 0
 
  • Like
Likes   Reactions: Janosh89
FactChecker said:
I don't see any conceptual difference between modulo of a positive versus negative integer. I am not sure if all computer languages would implement it. Perl does:

Integers 0..9 mod -3:
0 mod -3 = 0
1 mod -3 = -2
2 mod -3 = -1
3 mod -3 = 0
4 mod -3 = -2
5 mod -3 = -1
6 mod -3 = 0
7 mod -3 = -2
8 mod -3 = -1
9 mod -3 = 0
I had been impressed, if it would have calculated the results in the standard representation, i.e. ##[0],[1],[2]##. This way its more an incidental result.

The essential point is really, that "up to units" is often dropped in the definitions, be it as sloppiness or because it is self-evident. As @PeroK mentioned
PeroK said:
The same goes for allowing negative numbers to be prime.
the situation with primes is the same: "up to units", because ##-3## is as prime as ##3## is. And that ##1## isn't a prime, is only because the definition starts with "A number is prime, if it is no unit and ..." It makes absolute sense to exclude units. E.g. nobody ever asked, whether the fundamental theorem of arithmetic is wrong, since we can always add units as many as we want to: ##6=2\cdot 3= 1\cdot 2\cdot 3= (-1)\cdot (-1)\cdot 2 \cdot 3 = 1\cdot 1\cdot 3\cdot 2\cdot 1 =\ldots ## Units simply don't change the game, so why bother them?
 
Modular arithmetic sets up equivalences between negative numbers (the additive inverse) and positive numbers. -3 mod 3 = 0; -2 mod 3 = 1; -1 mod 3 = 2; etc. Modulo 3 and modulo -3 works out to be consistent:

-4 mod 3 = 2
-3 mod 3 = 0
-2 mod 3 = 1
-1 mod 3 = 2
0 mod 3 = 0
1 mod 3 = 1
2 mod 3 = 2
3 mod 3 = 0
4 mod 3 = 1

-4 mod -3 = -1
-3 mod -3 = 0
-2 mod -3 = -2
-1 mod -3 = -1
0 mod -3 = 0
1 mod -3 = -2
2 mod -3 = -1
3 mod -3 = 0
4 mod -3 = -2
 
Last edited:
Sure. But this isn't evidence for a smart programming of Perl as you implicitly suggested, but simply a logic outcome of ordinary arithmetic. An automated conversion into standard results would have been smart. The above is more or less an unintended result of a correct division.
 
fresh_42 said:
Sure. But this isn't evidence for a smart programming of Perl as you implicitly suggested, but simply a logic outcome of ordinary arithmetic. An automated conversion into standard results would have been smart. The above is more or less an unintended result of a correct division.
there is no reason for them to apologize for a "happy coincidence" that turns out to be mathematically correct.
 
FactChecker said:
there is no reason for them to apologize for a "happy coincidence" that turns out to be mathematically correct.
Yes, but that's not the point. The point is, that similar to what led to the OP's question, the programmers completely ignored the role of units. In this sense, it is rather off-topic here than a support for the equation ##n\mathbb{Z}=-n\mathbb{Z}##. The example brought you no millimeter closer to the answer of the question. It only shows that you can do calculate with negative numbers, not why they are usually ignored in books.
 
  • #10
IMO, in any algebra, -x is the additive inverse of x. x + (-x) = 0. I see no issue with units.
 
  • #11
matqkks said:
Why can't we have modulo negative number? I have never seen this.
You can do arithmetic using negative bases for instance arithmetic base -2.
 
  • #12
FactChecker said:
IMO, in any algebra, -x is the additive inverse of x. x + (-x) = 0. I see no issue with units.
Because you confuse addition with multiplication. We are talking about multiplication here, since the module is ##z \,\,\cdot\,\, \mathbb{Z}\,##.
No ring, no question.
 
  • #13
Given that it's the 21st century, perhaps mathematicians should be thinking about equal rights for negative numbers! Why should ##-5##, for example, be denied the right to be called a prime number, just because it was born on the wrong side of the number line?
 
  • Like
Likes   Reactions: fresh_42
  • #14
I guess I don't see the problem. It seems natural and uncomplicated to extend the equivalence classes in the non-negative integers defined by mod 3 ({0,3,6,9,...}, {1,4,7,10,...},{2,5,8,11,...}) to include the negative integers ({...,-9,-6,-3,0,3,6,9,...}, {...,-8,-5,-2,1,4,7,10,...},{...,-7,-4,-1,2,5,8,11,...}). Does this cause a problem when multiplication is introduced? Off-hand, I don't see it.
 
  • #15
The female version of many professions is obtained by a suffix "in" in German, e.g. a female carpenter would be a carpenterin. This lead to thousandths of texts which are written with constructions like "... we are looking for a carpenter/in with at least five years of experience ..."

I see me writing: Let ##p/-p## be a prime. ...

However, in rings which have more than these two units, things will become quite disturbing: Let ##p/\varepsilon\cdot p## be a prime, where ##\varepsilon## is a unit, ...
 
  • #16
FactChecker said:
I guess I don't see the problem. It seems natural and uncomplicated to extend the equivalence classes in the non-negative integers defined by mod 3 ({0,3,6,9,...}, {1,4,7,10,...},{2,5,8,11,...}) to include the negative integers ({...,-9,-6,-3,0,3,6,9,...}, {...,-8,-5,-2,1,4,7,10,...},{...,-7,-4,-1,2,5,8,11,...}). Does this cause a problem when multiplication is introduced? Off-hand, I don't see it.
No, it does not. It simply doesn't contribute anything to the answer of the question: Why are negative numbers ignored? It only shows, that the question has a justification, but nothing as to why this is the case.
 
  • Like
Likes   Reactions: FactChecker
  • #17
I had the same problem as the OP when I saw -1(MOD 10) on the OEIS site.
Centred 10-gonal numbers
A062786
no idea why the server cannot now find the site
 
  • #18
fresh_42 said:
No, it does not. It simply doesn't contribute anything to the answer of the question: Why are negative numbers ignored? It only shows, that the question has a justification, but nothing as to why this is the case.
The original OP question was "Why can't we have modulo negative numbers?". The answer is that we can. It is a natural extension of the concept to include negative integers. Then the OP asks why he has never seen it. The answer to that is that there is not much benefit.
 
  • #19
modular constructions are defined modulo a subgroup, namely the subgroup generated by the integer given. Since n and -n generate the same subgroup, there is no difference whatsoever between modular arithmetic mod n and mod -n. To be precise, looking at the equivalence relation defining arithmetic mod n, divisibility by n is equivalent to divisibility by -n.

https://en.wikipedia.org/wiki/Quotient_group
 
  • Like
Likes   Reactions: fresh_42

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 96 ·
4
Replies
96
Views
12K
  • · Replies 3 ·
Replies
3
Views
2K