Proof: If P is prime and (a,p) = 1, then a^ (p-1) ≡1 (mod p)
A: Prepare knowledge:
lemma 1. Residual system theorem 2 if A,b,c is any 3 integers, M is a positive integer, and (m,c) = 1, then when AC≡BC (MODM), there is a≡b (MODM)
Proof: AC≡BC (mod m) can be ac–bc≡0 (mod m) available (A-B) c≡0 (mod m) because (m,c) =1 is M,c coprime, C can go around, a–b≡0 (mod m) can get A≡b (mod m )
lemma 2. Residual system theorem 5 if M is an integer and m>1,a[1],a[2],a[3],a[4],... a[m] is m integer, if any 2 integers in this m number are different to M, then this m integer will constitute a complete residual system for M.
Proof: Construct the complete residual system of M (0,1,2,... m-1), and all integers necessarily have 1 pairs of modulo m congruence in these integers. Take R[1]=0,r[2]=1,r[3]=2,r[4]=3,... r=i-1,1<i<=m. Order (1): a[1]≡r[1] (mod m), a[2]≡r[2] (mod m), A≡r (mod m) (order can be different),
because only in this case, the set {A1,A2,A3,A4,... am} can be guaranteed to have a difference of any 2 number, otherwise there must be 2 number congruence. By the formula (1) naturally get set {A1,A2,A3,A4,... am} to form a complete residual system of M.
lemma 3. Residual system theorem 7 set M is an integer, and M>1,b is an integer and (m,b) = 1. If A1,A2,A3,A4,... am is a complete residual system of modulo m, then ba[1],ba[2],ba[3],ba[4],... ba[m] Also forms a complete residual system of modulo m.
Proof: If there are 2 integers ba and ba[j] congruence namely Ba≡ba[j] (mod m), according to Lemma 2 there is a≡a[j] (mod m). According to the definition of the complete residual system and lemma 4 (the total remaining system of any 2 of the difference between the different, easy to prove) this is not possible, so there is no 2 integer BA and Ba[j] congruence.
by lemma 5 ba[1],ba[2],ba[3],ba[4],... Ba[m] constitutes a complete residual system of modulus M.
lemma 4. Congruence theorem 6 If a,b,c,d is four integers and a≡b (mod m), C≡d (mod m), then there is ac≡bd (mod m)
Proof: AC≡BC (mod m), BC≡BD (mod m), can be AC≡BC (mod m) by modulo operation
The complete residual system of the tectonic prime p p={1,2,3,4 ... (P-1)}, because (a,p) = 1, by lemma 3 available a={a,2a,3a,4a, ... (P-1) A} is also a complete residual system of p. Make w=1*2*3*4...* (p-1), apparently w≡w (mod p). Make y=a*2a*3a*4a* ... (P-1) A, because {a,2a,3a,4a, ... (P-1) A} is the complete remainder of P, which is a*2a*3a* by lemma 2 and lemma 4 ... (p-1) a≡1*2*3* ... (p-1) (mod p) is w*a^ (p-1) ≡w (mod p). Ishi (w,p) = 1, by lemma 1 a^ (p-1) ≡1 (mod p)
Euler's theorem (also called Fermat-Euler theorem): A and N are known to be positive integers, and a and p are A^phi (n) ≡1 (mod n).
Prove:
Set z = {X1, X2, X3, ....., Xphi (N)}, where XI (i = 1, 2,. Phi (N)) represents the number of I not greater than N and N coprime.
Consider the collection S = {a*x1 (mod n), a*x2 (mod n), ..., A*xphi (n) (mod n)}, then set z = S;
1) because A and n coprime, Xi and N are also coprime, so A*xi also with N coprime. So for any one xi,a*xi (mod n) must be the element in Z;
2) for any XI, XJ, if XI! = XJ, then A*xi (mod n)! = A*XJ (mod n);
so s = Z;
Then (A*x1*a*x2*...*a*xphi (n)) (mod n)----------------------------------------------------(1)
= (a*x1 (mod n) * A*X2 (mod n) * ... *a*xphi (n) (mod n)) (mod n)
= (x1* x2* x3* .... * Xphi (n)) (mod n)------------------------------------------------------(2)
Formula (1) Finishing [A^phi (x) * (x1* x2* x3* .... * Xphi (n))] (mod n)
With the (2) formula to eliminate (x1* x2* x3* .... * Xphi (n)), which is A^phi ( N) ≡1 (mod n);
Application: Seeking inverse element
Inverse: (b/a) (mod n) = (b * x) (mod n). x represents the inverse of a. and a*x≡1 (mod n) Note: The inverse is only present when A and n coprime
Because A^phi (n) ≡1 (mod n), X can be represented as a^ (PHI (N)-1). If n is prime, phi (n) =n-1
/* Extended Euclidean application: modulo p multiplication inverse for integers a, p, if there is an integer b, to meet the AB mod p = 1, then B is a modulo p multiplication inverse. Theorem: A necessary and sufficient condition for the multiplication of a modulo p is gcd (a,p) = 1
Note that the inverse can also be understood, to find a minimum positive integer x (inverse), so that a Times x to M of the remainder equal to 1 m of the remainder, so m=1, the inverse is 1
prove: first proof adequacy if gcd (a,p) = 1, according to Euler theorem, aφ (p) ≡1 mod p, so obviously aφ (p)-1 mod p is a modulo p multiplication inverse.
re proving the necessity hypothesis exists that the multiplicative inverse of a modulo p is b ab≡1 mod p then ab = KP +1, so 1 = AB-KP because gcd (a,p) = d so D | 1 so D can only for 1 extended Euclidean The algorithm is consistent with the calculation of greatest common divisor and the common Euclidean algorithm. It is difficult to understand how to calculate the multiplication inverse element. Here is the proof:
First, repeat one of the assertions in the My book Divide:
If GCD (A, A, b) =d, then there is M,n, which makes d = ma + nb, which is called the relationship of the A, a group of combinations of integers d,m,n known as composite coefficients. When D=1, there is ma + NB = 1, you can see that M is a modulo b multiplication inverse, n is the multiplication of B-mode a inverse element. (The m,n shown above may be negative, and finally, it will be converted to a positive number). The complete procedure is as follows: */
In general, Ax+by=1; X is the inverse of a mod B, and y is the inverse of B mod A.
Post a paper that is proven in a variety of ways.
Mainly look at this address written: http://www.docin.com/p-489651861.html
Proof of Fermat theorem: