0

Googling for 'Uniqueness of modular multiplicative inverse' results in the following link very high on the result list(https://rniwa.com/2011-08-22/proof-uniqueness-of-multiplicative-inverse/).

I believe that the proof provided is wrong so I would like confirmation on that.

Also for a bit of discussion:

If this proof is actually wrong then reading up on such things on the internet is very inefficient. I am a beginner at number theory and that goes doubly for me as I consider such a proof to be correct at first glance and then I waste a lot of time trying to wrap my mind around an incorrect statement. How did the rest of you teach yourself a mathematical subject without such inefficiencies? I am self studying so internet is obviously the first thing I check for any deeper insight.

  • 2
    Have you tried constructing a proof of your own? – Vinyl_cape_jawa Feb 27 '19 at 10:56
  • The proof looks correct assuming we already know of the cancellation law and etc. Perhaps the easiest way to show it is to prove the set of all numbers $;\pmod n;$ who are coprime with $;n;$ is a group with respect to multiplication modulo $;n;$ . – DonAntonio Feb 27 '19 at 10:58
  • I do not understand this proof either. – Bernard Feb 27 '19 at 11:01
  • I think the proof it correct, if $im \equiv jm (mod n)$ then $ i \equiv j (mod n/gcd(m,n)$ – Displayname Feb 27 '19 at 11:02
  • and they showed that gcd(m,n) is 1 – Displayname Feb 27 '19 at 11:03
  • It is not correct. Look at the last line where essentially they say that the inverse value itself is congruent to $1$, which is not true. $i \equiv j$ (mod $n$) is true, but $i \equiv j \equiv 1$ (mod $n$) is not. Or is it? – Michael Munta Feb 27 '19 at 11:20
  • The people commenting above me have a lot of points on their profile etc. so now im doubting myself...is what I said correct? If $im \equiv 1$ (mod $n$) has A (at least 1) solution, then $gcd(i,m)$ divides $1$ and so is equal to $1$ and then use what I said above? That is a valid proof surely? – Displayname Feb 27 '19 at 11:21
  • oh yeah the last line...I missed that bit, that is definitely wrong – Displayname Feb 27 '19 at 11:22

4 Answers4

3

Since the mistake of the proof is discussed in the comments, I want to point out the mistake you made:

I am self studying so internet is obviously the first thing I check for any deeper insight.

WRONG. The internet is the first thing one checks for superficial insight. For deeper insight, the thing to check is textbooks (some of which might be found on the internet), and for the deepest insight, you take a class, discuss matters with fellow students, T.A.'s and professors, and ultimately use your own reasoning, e.g. by doing the exercises a good textbook contains and a good lecturer gives you.

Now of course there are good resources on the internet. But there's also ... not so good resources. Looking at your link, I would immediately have my doubts about it; but that's because I have been through a decade of university math. You're not there. Which is why I can only strongly advise you to not just rely on googling. And not on blogs of non-professional mathematicians. You know what, not on blogs at all (of course Terry Tao's blog is probably trustworthy; but don't start there).

Look, even textbooks contain mistakes. Lecture notes more so. I consider myself a good calculus teacher, but rarely a lecture passes in which I do not notice a silly mistake or unclarity in my lecture notes -- something small and silly when I spot it, but maybe it made one student "waste" 15 minutes on it. Which is why it's good for them that they can ask me, and that I can point it out in the next lesson for everyone; all resources that a self-learner does not have.

If this proof is actually wrong then reading up on such things on the internet is very inefficient. I am a beginner at number theory and that goes doubly for me as I consider such a proof to be correct at first glance and then I waste a lot of time trying to wrap my mind around an incorrect statement.

The first sentence is correct. For the second one, well if you figured out the mistake, the time is not entirely wasted.

How did the rest of you teach yourself a mathematical subject without such inefficiencies?

As said above, I first got a solid groundwork by attending university classes. Afterwards, I did self-learning when necessary by using reliable sources (textbooks if possible, more than one at a time if possible to see things from different angles and spot mistakes in one), and working through a lot of the exercises.

3

The proof is correct, but quite roundabout (with an inconsequential $\rm\color{#c00}{error}$). Let's review it in detail.

Uniqueness of multiplicative inverse
Prove that any multiplicative inverse $i$ of $m$ modulo $n$ is unique modulo $n$.

Proof $ $ Let $i$ and $j$ be two multiplicative inverses of $m$ modulo $n\!:\,$ $\,im\equiv jm\equiv 1\pmod{\!n}.\,$ By the definition of congruence modulo $n$, $im = pn+1$ for some integer $p$, yielding the Bézout’s identify $1 = im-pn$. Since $1$ clearly divides $m$ and $n$, $\,\gcd(m,n)=1$ by the Bézout's lemma. Thus, $i\equiv j \color{#c00}{\equiv1}\pmod{\!n}$ by the cancellation law in modular arithmetic. Q.E.D.

It uses: $\,m\,$ invertible $\!\bmod n$ $\,\Rightarrow\, im-pn=1\,\Rightarrow\, \gcd(m,n)=1$ $\,\Rightarrow\,m$ is cancellable $\!\bmod m$. The middle two inferences are superflous because invertible elements are always cancellable, i.e. $\,im\equiv jm\,\overset{\large \times\, m^{-1}}\Longrightarrow\, i\equiv j.\,$ Bezout isn't needed here since we already have know an inverse $j$ of $m$ so we can replace $\,m^{-1}\,$ by $\,j\,$ in this inference, i.e. scale $\,im\equiv jm\,$ by $\,m^{-1}\equiv j\,$ to get $\,i\equiv j$.

Simpler $\:\! \ i \equiv i (mj)\equiv (im)j \equiv j.\,$ Thus $\,i\equiv j\, $ ($\color{#c00}{\rm{not}}\,\ i\equiv j\color{#c00}{\equiv 1})$ so any two inverses $\,i,j\,$ are congruent, i.e. inverses are unique $\!\bmod n.\,$ Therefore there is a unique $\,i\equiv m^{-1}$ lying in every complete set $S$ of residues $\!\bmod n,\,$ e.g. the common least natural residues $\,S = \{0,1,\ldots n\!-\!1\}$.

Remark $ $ See also this answer and its linked sci.math thread on an additive analog - the uniqueness of solutions of $\,x+a = b.\,$ The case $\,b = 0\,$ yields the uniqueness of additive inverses. As above, many students given roundabout solutions (and have difficulty understanding efficient solutions).


If this proof is actually wrong then reading up on such things on the internet is very inefficient. I am a beginner at number theory and that goes doubly for me as I consider such a proof to be correct at first glance and then I waste a lot of time trying to wrap my mind around an incorrect statement.

The quality of internet information varies widely - even in more esoteric fields such as mathematics.

How did the rest of you teach yourself a mathematical subject without such inefficiencies? I am self studying so internet is obviously the first thing I check for any deeper insight.

Start with respected textbooks or lecture notes at your level (browse the courses offered at respectable universities to see what they use). You can also find many textbook reviews on the internet.

Bill Dubuque
  • 272,048
0

By the way, a correct proof isn't difficult because multiplication is commutative and associative in this structure.

$$im=jm=1 \Rightarrow i(im)=i(jm) \Rightarrow i(im) = (ij)m \Rightarrow i(im) = (ji)m \\\Rightarrow i(im) = j(im) \Rightarrow i1=j1 \Rightarrow i=j.$$

Robert Shore
  • 23,332
  • Commutativity is not required, provided the inverse is two-sided in the definition. Just associativity is needed. Suppose $u,v$ are inverse of $x$, with $1$ denoting the neutral element; then $u=u1=u(xv)=(ux)v=1v=v$. – egreg Feb 27 '19 at 18:50
  • I was trying to figure out whether we need the identity to be two-sided. In other words, are there structures that are closed under a binary operation with a (strictly) one-sided identity that have a (strictly) one-sided inverse? – Robert Shore Feb 27 '19 at 20:51
  • Of course there can be. However, you can't prove uniqueness only based on the existence. – egreg Feb 27 '19 at 21:42
  • It's not obvious to me that such a structure can exist. We know, for instance, that there are no structures closed under a binary operation with a two-sided identity but a strictly one-sided inverse. That's what we just finished proving. I take it you have an example in mind? – Robert Shore Feb 27 '19 at 23:08
0

The proof is correct, but very bad under other respects.

The argument makes a detour via the Bézout’s identity, which is used to prove that if $m$ has an inverse modulo $n$, then $\gcd(m,n)=1$. This is completely irrelevant to what is needed to prove, namely the uniqueness of the inverse.

Uniqueness of the inverse holds in any monoid. Let $M$ be a monoid, that is, a set equipped with an associative binary operation (generally denoted like multiplication), with a neutral element $e$ such that, for every $x\in M$, $$ ex=x=xe $$ An inverse of an element $x\in M$ is $y\in M$ such that $$ xy=e=yx $$

Theorem. Let $M$ be a monoid with neutral element $e$. If $x\in M$ has an inverse, then this inverse is unique.

Proof. Suppose $y,z\in M$ are inverses of $x$. Then $xy=e=yx$, $xz=e=zx$, by definition. Then, using associativity and the property of $e$, $$ y=ye=y(xz)=(yx)z=ez=z $$ QED

The set of residue classes modulo $n$ is clearly a monoid, with neutral element $[1]$ (the residue class of $1$). Then if an inverse of the residue class $[m]$ exists, it is unique by the theorem above. In the language of congruences, this amounts to saying that if $im\equiv 1\pmod{n}$ and $jm\equiv 1\pmod{n}$, then $i\equiv j\pmod{n}$.

A very different, albeit related, topic is to find the invertible residue classes modulo $n$. This is where the Bézout's identity comes in.

Theorem. In the multiplicative monoid of residue classes modulo $n$, a class $[m]$ is invertible if and only if $\gcd(m,n)=1$.

Proof. Suppose $[m]$ is invertible; then there exists $[i]$ such that $[i][m]=[1]$. This amounts to saying that $im\equiv 1\pmod{n}$, so $im=1+kn$, for some integer $k$. Therefore $1=im-kn$. Thus no prime can divide both $m$ and $n$, so $\gcd(m,n)=1$.

Conversely, suppose $\gcd(m,n)=1$. By Bézout's identity, there exist $i$ and $k$ such that $1=im+kn$. Then, by definition, $1\equiv im\pmod{n}$, so $[1]=[i][m]$ and $[m]$ is invertible. QED


The author of the bad proof relies on a “cancellation law in modular arithmetic” without mentioning it. Of course this is completely irrelevant: the proof could have been, more simply,

suppose $im\equiv 1\pmod{n}$ and $jm\equiv 1\pmod{n}$. Then $$ j\equiv j\cdot1\equiv jim\equiv jmi\equiv 1\cdot i\equiv i\pmod{n} $$ (which is just the same as the proof above about uniqueness of the inverse).

egreg
  • 238,574
  • Maybe I should have stated more clearly what I mean by "wrong". The last conclusion is wrong, namely that $i \equiv j \equiv 1$ (mod $n$), which is obviously not true and might just be a typing mistake. Does not change the fact that I was struggling to understand why that could be true. – Michael Munta Feb 28 '19 at 09:44
  • 2
    @MichaelMunta Sorry, I didn't even notice the $\equiv1$, which is patently a typo. But, really, I'd leave that site alone. – egreg Feb 28 '19 at 11:00