distribution of $\sqrt{-1} \mod p$

While reading up on quadratic reciprocity, I learned that if $p = 4k+1$ then $-1$ has a square root in $\mathbb{Z} / p \mathbb{Z}$.

Let $r_p$ be an integer with $0\leq r_p < p$ and $r_p^2 \equiv -1 \mod p$. How then is $\frac{r_p}{p} \in \mathbb{Q}$ distributed in $[0,1]$? Naively I would guess this is uniform distribution. How can we prove that?

Edit I noticed in the comments, it might be simpler to ask about the equidistribution of $$\{ \tfrac{1}{\sqrt{p}}(a,b): a^2 + b^2 = p\} \subset S^1$$

still in the case $p = 4k+1$.

• Regarding your edit: Look at mathoverflow.net/questions/133410/hecke-equidistribution?lq=1 and at the reference provided there. Apr 14 '15 at 19:09
• Can somebody explain to me how this is a well-defined question? If $\sqrt{-1}$ denotes an element of $\mathbb{Z}_p$, then $\frac{\sqrt{-1}}{p}\in\mathbb{Q}_p \setminus\mathbb{Q}$. $\mathbb{Q}_p$ is not ordered so that it makes no sense to speak of the interval $[0,1]$. Apr 14 '15 at 20:58
• @JohannesHahn, don't think $p$-adically. Just use the mod $p$ reduction lying between $0$ and $p-1$ in the usual sense, and divide that by $p$. Of course there is a sign ambiguity on $\sqrt{-1}$, but just fix a definite interval $[a,b]$ inside $[0,1]$ and ask how often some square root of $-1 \bmod p$ has a normalized ratio in there, i.e., count for large $x$ how many $p \leq x$ with $p \equiv 1 \bmod 4$ have an $r_p$ from $0$ to $p-1$ such that $r_p^2 \equiv -1 \bmod p$ and $a \leq r_p/p \leq b$. Then let $x \rightarrow \infty$ and look at asymptotics. Isn't that a sensible formulation? Apr 14 '15 at 21:33
• @KConrad: Yes, the integer-version is sensible. (The edited version of the question still isn't. Replacing $\mathbb{Z}_p$ by $\mathbb{Z}/p$ just made it even less intelligible ) Apr 14 '15 at 21:47
• @KConrad I hope my phrasing is correct; I think you have the right idea. Maybe instead of $\mathbb{Z}/p\mathbb{Z}$ can talk about $\frac{1}{p}\mathbb{Z}/\mathbb{Z}$. This way we can talk about a limit as $p \to \infty$ ? Apr 15 '15 at 0:08

The equidistribution of the roots of quadratic congruences $\pmod p$ (such as $x^2+1$ in the question) was established in a famous paper of Duke, Friedlander and Iwaniec. The proof uses sieve ideas as well as ideas from the theory of modular forms.

• In that paper, though, isn't the discriminant of the quadratic trinomial assumed to be positive? As for the particular case here, it seems to me that we can instead appeal to Hecke's theorem on the uniform distribution of the angle $\theta$ in $(a,b) = (\sqrt{p} \cos{\theta}, \sqrt{p} \sin{\theta})$, for $p = a^2 + b^2$. Apr 14 '15 at 18:39
• I think they want the determinant to be positive; ie the quadratic polynomial has complex roots as in $x^2+1$. Also I don't see how uniform distribution of the angle helps, since we need the distribution of $ab^{-1} \pmod p$. Apr 14 '15 at 18:44
• The negative discriminant case was proved a bit later by A. Toth using somewhat similar methods (units causing some trouble as usual). And I don't think Hecke's Theorem is enough (sqrt(-1) is a/b, but computed modulo p, not archimedeanly). Apr 14 '15 at 18:49
• I see. It is $D=ac−b^2$, not the discriminant (which is the negative of that). Apologies for overlooking this. And indeed, Hecke is irrelevant and my interpretation of the initial question was incorrect. Apr 14 '15 at 19:14

There is a related result of Friedlander-Iwaniec embedded in the proof of lemma 3.2, which is not equidistribution, but gives an extremely simple heuristic reason why these fractions are well-distributed. Namely, if we fix $X$, restrict to an interval of integers $8X/9 < d \le X$, and consider the set

$S=\{\nu/d : \nu ^2 +1 \equiv 0 \pmod d, d\in(8X/9,X]\}$,

then these points repel each other $\pmod 1$: while we would expect their differences to be on the order of $1/X^2$, it turns out that every pair is at least $1/4X$ apart.

The idea is that if $\nu^2 +1 \equiv 0\pmod d$ then $\nu=rs^{-1}\pmod d$ where $r,s$ satisfy $r^2+s^2 = d$ exactly. But then $\nu/d\pmod{1}$ is very close to $-\bar{r}/s$, where $\bar{r}$ is the inverse $\pmod s$ of $r$. Now these fractions $-\bar{r}/s$ all have much smaller denominators $<\sqrt{X}$, and so must be on the order of $1/X$ apart.

• Hooley proved the equidistribution of roots $\mod d$ for composite $d$. That is a much easier problem than the one resolved by Duke, Friedlander and Iwaniec. Apr 14 '15 at 20:59