High School Mathematics Extensions/Further Modular Arithmetic/Project/Finding the Square Root

< High School Mathematics Extensions‎ | Further Modular Arithmetic

*Finding the square root*Edit

Legendre SymbolEdit

.. to be expanded There is actually a simple way to determine whether a is square

Let g be a generator of G where G is the multiplicative group mod p. Since all the squares form a group therefore, if a is a square, then

a^{\frac{p - 1}{2}} \equiv 1

and if a is not a square then

a^{\frac{p - 1}{2}} \equiv -1

we shall use these facts in the next section. .. to be expanded

*Finding the square root*Edit

We aim to describe a way to find a square root in mod m. Let's start with the simplest case, where p is prime. In fact, for square root finding, the simplest case also happens to be the hardest.

If p ≡ 3 (mod 4) then it is easy to find a square root. Just note that if a has a square root then

(a^{\frac{p + 1}{4}})^2 \equiv a^{\frac{p + 1}{2}} \equiv a^{\frac{p - 1}{2}}a \equiv a

So let us consider primes equivalent to 1 mod 4. Suppose we can find the square root of a mod p, and let

x_0^2 \equiv a \pmod{p}

With the above information, we can find the square of a mod p2. We let

x = x_0 + x_1p \!

we want x2 ≡ a (mod p2), so

x^2 = x_0^2 + 2x_0x_1p + x_1^2p^2 \!
x^2 = a + kp + 2x_0x_1p \pmod{p^2} \!

for some k as x_0^2 \equiv a \pmod{p} so x_0^2 = a + kp, we see that

x^2 = a + p(k + 2x_0x_1) \pmod{p^2} \!

so if we need to find x_1 such that k + 2x_0x_1 \equiv 0 \pmod{p} , we simply need to make x_1 the subject

x_1 \equiv -k(2x_0)^{-1} \pmod{p} .

..generalisation ..example

..method for finding a sqr root mod p