Quadratic residues
A quadratic residue is a number that is the result of squaring another number. In other words, a number x is a quadratic residue (modulo p) if there exists another number a such that
The set of all quadratic residues modulo **p ** is called the set of quadratic residues of p.
Here is an example :
An integer a=21 has the following square mod 31 : a² ≡ 7 mod 31 .
As a = 21, a² = 7 , the square root of 7 is 21
Note : For the elements of Fp, not every element has a square root. In fact, what we find is that for roughly one half of the elements of Fp, there is no square root.
Theses elements are called quadratic non-residue
Interesting properties
Legendre Symbol
There is a method to determine if an integer is a quadratic residue or not with a single calculation thanks to Legendre.
This equation obeys :
Which means given any integer a, calculating pow(a,(p-1)//2,p) is enough to determine if a is a quadratic residue.
Last updated