# Modular root of $-1$

Take two distinct coprime integers $a,b$ and take $q=a^2+b^2$. Consider the equation $(xy^{-1})^2\equiv-1\bmod q$. The solutions are two roots which correspond to $(x,y)=(a,b)$ and $(x,y)=(b,a)$. Look at the representative $\alpha$ of $(xy^{-1})\bmod q$ where $\alpha\in[-q/2,q/2)$ holds.

1. Is there structure to $q$ that achieve large ratio $r=\frac{|\alpha|}{\sqrt q}$ ($r=2$ is achievable at $b=a-1$)?

2. If $a,b$ are randomly picked with $a<b<2a$ then what is the probability $r<q^\epsilon$ holds for fixed $\epsilon\in[0,\frac12]$?

• For question 1: just looking at prime $q$, it is known by work of Duke, Friedlander, and Iwaniec that the normalized roots $\alpha/q$ are uniformly distributed in $[0,1]$; in particular, your $r$ can be as large as $\sqrt q-\varepsilon$ for any $\varepsilon>0$. – Greg Martin Aug 16 '18 at 8:19
• @GregMartin Is there structure to these extremal $q$? The lower bound seems $2$ and is achieved by $b=a-1$. – 1.. Aug 16 '18 at 8:23
• Explicit structure will give you information about primes of the form $p=a^2+1$, so it is not an easy question. – Alexey Ustinov Aug 16 '18 at 8:53
• @AlexeyUstinov Why will this give information about $a^2+1$ prime? – 1.. Aug 29 '18 at 22:02