Algorithm to find square root of a quadratic residue mod p

In summary, the conversation discusses the explanation of Tonelli's algorithm in a number theory book for finding the square roots of a quadratic residue modulo a prime number. The algorithm involves finding the order of a certain element, A, in the group of units mod p, which is cyclic of order 2^s. This element is shown to be an even power of D^-1, with D being a quadratic nonresidue mod p. The conversation also includes a clarification on the explanation in the book and a question about the strict inequality in the solution.
  • #1
tjkubo
42
0
I'm going through an explanation in a number theory book about Tonelli's algorithm to find the square roots of a quadratic residue modulo ##p## where ##p## is prime, i.e. I want to solve ##x^2 \equiv a \pmod{p}## with ##(\frac{a}{p}) = 1##. The book goes as follows:

Let ##p - 1 = 2^s t##, where ##t## is odd.

By Euler's criterion, ##A^{2^{s-1}} \equiv 1## where ##A = a^t##, so the order of ##A## divides ##2^{s-1}##.

Let ##d## be a quadratic nonresidue mod ##p## and ##D = d^t##.

By Euler's criterion, ##D^{2^{s-1}} \equiv -1## so the order of ##D## is exactly ##2^s##. Similarly, the order of ##D^{-1}## is ##2^s##.

Since the group ##U(p)## of units mod ##p## is cyclic, ##A## is in ##\langle D^{-1} \rangle##, the cyclic subgroup generated by ##D^{-1}##. Moreover, ##A \equiv D^{-2u}## where ##u## is some integer ##0 \leq u < 2^{s-1}##.

Then, ##a^tD^{2u} \equiv 1##, so ##a^{t+1}D^{2u} \equiv a##. Thus, a solution is ##x \equiv a^{(t+1)/2}D^u##.I got stuck where it says ##A## is an even power of ##D^{-1}##. Can someone explain this?
 
Physics news on Phys.org
  • #2
Note1 : the sentence "since the group U(p) of units modulo p is cyclic" is very confusing in my opinion. The right justification should be: if w is a primitive root modulo p, then [itex]w^t[/itex] is of order [itex]2^s[/itex] and generates all the elements of order dividing [itex]2^s[/itex]. So, the group of all such element is cyclic of order [itex]2^s[/itex]. Since D is of order [itex]2^s[/itex], [itex]D^{-1}[/itex] is a generator of this group.

Note2 : the answer to your question is: let [itex]A = D^{-\alpha}[/itex], with [itex]0\leq \alpha\leq 2^s[/itex]. Since the order of A divides [itex]2^{s-1}[/itex], say [itex]2^i[/itex], and since the order of [itex]D^{-1}[/itex] is [itex]2^{s}[/itex], there holds [itex]-\alpha 2^i = k2^s[/itex], with [itex]i\leq s-1[/itex]. Hence [itex]\alpha[/itex] is multiple of 2, say [itex]\alpha = 2u[/itex], with [itex]0\leq 2u\leq 2^s[/itex]. Hence [itex]u\leq 2^{s-1}.[/itex]
 
Last edited:
  • Like
Likes jim mcnamara
  • #3
Thank you for clarifying.

I wonder why my book made that last inequality a strict one, since that would just lead to ##x = - a^{(t+1)/2}## which is also a solution.
 

FAQ: Algorithm to find square root of a quadratic residue mod p

What is a quadratic residue mod p?

A quadratic residue mod p is a number that, when squared and divided by a prime number p, leaves a remainder that is a perfect square. In other words, it is a number that has a square root mod p.

Why is it important to find the square root of a quadratic residue mod p?

Finding the square root of a quadratic residue mod p is important in many areas of mathematics and cryptography. It is used in encryption algorithms, primality testing, and solving certain types of equations.

What is the algorithm used to find the square root of a quadratic residue mod p?

The algorithm used to find the square root of a quadratic residue mod p is called the Tonelli-Shanks algorithm. It is an efficient algorithm that works for any prime number p and any quadratic residue mod p.

How does the Tonelli-Shanks algorithm work?

The Tonelli-Shanks algorithm works by using properties of quadratic residues and modular arithmetic to narrow down the possible solutions for the square root. It involves finding a "primitive root" and then using a series of steps to find the square root.

Are there any limitations to the Tonelli-Shanks algorithm?

The Tonelli-Shanks algorithm can only be used for prime numbers p where p ≡ 3 (mod 4). This is because the algorithm relies on certain properties of quadratic residues that only hold for these types of primes. For other types of primes, different algorithms must be used to find the square root of a quadratic residue mod p.

Similar threads

Replies
2
Views
2K
Replies
4
Views
3K
Replies
14
Views
1K
Replies
1
Views
1K
Replies
5
Views
6K
Replies
12
Views
2K
Replies
4
Views
3K
Replies
4
Views
4K
Back
Top