Talk:High School Mathematics Extensions/Primes/Modular Arithmetic

Proof of (non-)existence of inverse
I've managed to make a proof for the general case, thinking about adding it to make the inverse section more complete, but from this version it seems that the proof can be simplified further. Also, this proof employ the lemma in proving fermat's little theorem, but that lemma is proved by the existence of inverse theorem, which create a circular logic(although this lemma can actually be proven without relying on this theorem, but then I'm not sure should I edit that lemma section also to remove inconsistency if we were to add this proof in).

Anyway, here is the proof.(Note: in all case, x does not equal to 0)

Lemma: $$(\gcd(x,n)=1) \Rightarrow (ax=bx \pmod{n} \iff a=b \pmod{n})$$

Proof:$$a=b \pmod{n} \Rightarrow ax=bx \pmod{n}$$ is obvious.

Now we'll prove that $$ax=bx \pmod{n} \Rightarrow a=b \pmod{n}$$

$$ax=bx \pmod{n} \iff ax-bx=0 \pmod{n} \iff (a-b)x=0 \pmod{n} \iff a-b=0 \pmod{n} (\gcd(x,n)=1) \iff a=b \pmod{n}$$

Theorem: $$( \exists x^{-1} )( xx^{-1} = 1 \pmod{n} ) \iff (\gcd(x,n)=1)$$

Proof: We'll prove this by breaking it into two part.

Part a: $$(\gcd(x,n)=1) \Rightarrow ( \exists x^{-1} )( xx^{-1} = 1 \pmod{n} )$$

From the lemma, we know that x,2x,3x...(n-1)x are all distinct mod n, hence there must be at least one of them that is equal to 1.

Part b: $$(\gcd(x,n) \ne 1) \Rightarrow (\forall y)(xy \ne 1 \pmod{n})$$

Suppose the opposite is true, that is, there is such a 'y'. Now let their gcd be g, and x=ga, n=gb.

$$xy=1 \pmod{n} \iff xy=1+kn \iff xy-kn=1 \iff gay-gkb=1 \iff g(ay-kb)=1 \iff ay-kb=\frac{1}{g}$$ for some integer k.

But as a,y,k,b are all integer, this is absurd.

Q.E.D

--Lemontea 06:48, 7 January 2006 (UTC)