Module 8 : Primality Testing

Lecture 1 : Primality Testing

 

Introduction to Jacobi Symbol: 

           Suppose we want to determine whether or not x2≡ a (mod p) has a solution, where p is prime, If p is small, we could square all of the numbers mod p and see if a is on the list. When p is large, this is impractical. If p≡3 mod 4 we can find out the by using a technique in which we compute s≡ a(p+1)/4 (mod p). If a has a square root, then s is one of them, so we simply have to square s and see if we get a. If not, then a has no square root mod p. The following proposition gives a method for deciding whether a is a square mod p that works for arbitrary odd p.


Proposition: let p be a odd prime and let a be an integer with a 0 (mod p). Then a(p-1)/2≡ ± 1 (mod p). The congruence x2≡ a (mod p) has a solution if and only if a(p-1)/2≡1 (mod p).

Proof:  Let y ≡ a(p-1)/2 (mod p). Then y2≡ ap-1 ≡ 1 (mod p), by Fermat’s theorem.  Therefore, y ≡±1 (mod p).

    If a≡x2, then a(p-1)/2 ≡ xp-1 ≡ 1 (mod p). The hard part is showing the converse. Let g be a primitive root mod p. Then a ≡ gj for some j. If a(p-1)/2 ≡1 (mod p), then

            g j(p-1)/2 ≡ a(p-1)/2 ≡ 1 (mod p).

Which implies j.(p-1)/2 ≡0 ( mod p-1). This implies that j must be even: j=2k. Therefore, a ≡ gj  ≡ g(k)2  (mod p), so a is a square mod p.

Although the above proposition is easy to implement by a computer , it is rather difficult to use by hand. In the following we introduce the Legendre and Jacobi symbols, which gave us an easy way to determine whether or not a number is a square mod p. they are also very useful in Primality testing.

Let p be an odd prime and let a (not) ≡0 (mod p). Define the Legendre symbol

) = { 1 if x2≡ a (mod p) has a solution.
- 1 if x2≡ a (mod p) has a solution.

Some important properties of the Legendre symbol are given in the following.