- #1

- 201

- 2

## Main Question or Discussion Point

Why can't we have modulo negative number? I have never seen this.

- I
- Thread starter matqkks
- Start date

- #1

- 201

- 2

Why can't we have modulo negative number? I have never seen this.

- #2

- 12,377

- 5,157

You would simply have to define what you mean by it.Why can't we have modulo negative number? I have never seen this.

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.

- #3

fresh_42

Mentor

- 12,679

- 9,204

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.Why can't we have modulo negative number? I have never seen this.

- #4

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

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

- #5

fresh_42

Mentor

- 12,679

- 9,204

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.

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

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

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?The same goes for allowing negative numbers to be prime.

- #6

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

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 consistant:

-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

-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:

- #7

fresh_42

Mentor

- 12,679

- 9,204

- #8

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

there is no reason for them to apologize for a "happy coincidence" that turns out to be mathematically correct.

- #9

fresh_42

Mentor

- 12,679

- 9,204

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.there is no reason for them to apologize for a "happy coincidence" that turns out to be mathematically correct.

- #10

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

IMO, in any algebra, -x is the additive inverse of x. x + (-x) = 0. I see no issue with units.

- #11

lavinia

Science Advisor

Gold Member

- 3,170

- 575

You can do arithmetic using negative bases for instance arithmetic base -2.Why can't we have modulo negative number? I have never seen this.

- #12

fresh_42

Mentor

- 12,679

- 9,204

Because you confuse addition with multiplication. We are talking about multiplication here, since the module is ##z \,\,\cdot\,\, \mathbb{Z}\,##.IMO, in any algebra, -x is the additive inverse of x. x + (-x) = 0. I see no issue with units.

No ring, no question.

- #13

- 12,377

- 5,157

- #14

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

- #15

fresh_42

Mentor

- 12,679

- 9,204

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

fresh_42

Mentor

- 12,679

- 9,204

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.

- #17

- #18

FactChecker

Science Advisor

Gold Member

- 5,384

- 1,953

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

- #19

mathwonk

Science Advisor

Homework Helper

- 10,822

- 988

https://en.wikipedia.org/wiki/Quotient_group

- Replies
- 5

- Views
- 418

- Replies
- 10

- Views
- 4K

- Replies
- 11

- Views
- 3K

- Last Post

- Replies
- 1

- Views
- 4K

- Replies
- 2

- Views
- 343

- Last Post

- Replies
- 11

- Views
- 4K

- Last Post

- Replies
- 69

- Views
- 29K

- Replies
- 14

- Views
- 12K

- Replies
- 2

- Views
- 1K

- Last Post

- Replies
- 14

- Views
- 8K