0

I searched for that and found opposite opinions some say that yes the negative are acceptable and others say that only the positive are the acceptable. for example: 27^-1 (mod 392) which of the following sets is true {...,-813 ,-421,-29,363,755,1147,...} {363,755,1147,...}

J. W. Tanner
  • 60,406
Hossam
  • 1
  • The people who say the negative aren't acceptable would probably also say that $755,1147,\dots$ are unacceptable as well. The end result is... whatever you want. That depends on how you are defining things and what is convenient for you. It is perfectly true that $27\cdot (-421)\equiv 1\pmod{392}$ which should qualify it as being a modular inverse along with every other number from your first set. It is also perfectly true that the only number $x$ in the range ${0,1,2,3,\dots,391}$ satisfying $27x\equiv 1\pmod{392}$ is $x=363$. – JMoravitz Oct 25 '23 at 17:46
  • There are plenty of times where I would prefer working with negatives... for instance in noting that $(-1)^2 = 1$ is much faster than noting that $123478974\cdot 123478974\equiv 1\pmod{123478975}$ – JMoravitz Oct 25 '23 at 17:48
  • The modular inverse has representatives that are negative, very large and positive, etc. If you insist on choosing one in $0, ..., n - 1$, like the C-style operator $a % n$, then you run into issues where $(-a) % n\not = -(a % n)$ and $(a + b) % n \not = (a % n) + (b % n)$, etc. It's like insisting that an expression like $1/\sqrt{2}$ should be rewritten as $\sqrt{2}/2$; they're certainly equal, but what exactly does the latter get you for your arithmetic work? – anomaly Oct 25 '23 at 17:57
  • JMoravitz I got the point that you wanted to deliver, thanks – Hossam Oct 25 '23 at 18:12
  • 1
    For arithmetic $\bmod n$ we can use any complete system of residues as normal forms, i.e. any set of integers such that every integer is congruent to exactly one of them, e.g. any set of $,n,$ consecutive integers. If you seek the (normalized) modular inverse then you need to choose the element of the complete system that is congruent to it, e.g. $3^{-1}\equiv -2,$ in the balanced system ${0,\pm1,\pm2,\pm3}\bmod 7.,$ See the linked dupe for more. – Bill Dubuque Oct 25 '23 at 18:21
  • @BillDubuque: isn’t the purported duplicate about negative moduli, unlike this question? – J. W. Tanner Oct 25 '23 at 19:01
  • @J.W.Tanner Both negative moduli and remainders are discussed in the linked dupe. – Bill Dubuque Oct 25 '23 at 19:10

0 Answers0