What is the expected number of random choices to find a quadratic residue mod p?

78 Views Asked by At

Say you have $x$, which is not a quadratic residue mod $p$. What is the expected number of random choices of $d \in F_p$ needed such that $x+d$ is a quadratic residue?

In a work of Maurer (page 277) it is argued that this is 2, without any explanation or citation. Therefore I suspect it is a somehow known fact, but I couldn't find anything about it.

1

There are 1 best solutions below

0
On BEST ANSWER

If you pick d uniformally at random in $F_p$, then $x +d$ is also uniformally random in $F_p$. Then you just need to know how many quadratic residue there are in $F_p$, as pointed in the comments, it is $\frac{p+1}{2}$ which explains that you need on average 2 try to get a quadratic residue.

To show that fact, let's denote r the number of quadratic residues in $F_p$, for a quadratic residue $y$ the polynom $X^2 - y$ has at most 2 roots (and it has 1 if and only if y=0), which means that the number of elements of $F_p$ is equal to 2r-1 and you deduce $r =\frac{p+1}{2}$