  The equation $x^2 + 1 = 0\mod p$ has solutions whenever $p = 2$ or $4n + 1$.
A famous theorem of Fermat says that these primes are exactly the ones that can
be described as a sum of two squares. That the roots of the former equation are
equidistributed is a beautiful theorem of Duke, Friedlander and Iwaniec from
1995. We show that a subsequence of the roots of the equation remains
equidistributed even when one adds a restriction on the primes which has to do
with the angle in the plane formed by their corresponding representation as a
sum of squares.
  Similar to Duke, Friedlander and Iwaniec, we reduce the problem to the study
of certain Poincare series, however, while their Poincare series were functions
on an arithmetic quotient of the upper half plane, our Poincare series are
functions on arithmetic quotients of $SL_2(\mathbb{R})$, as they have a
nontrivial dependence on their Iwasawa $\theta$-coordinate. Spectral analysis
on these higher dimensional varieties involves the nonspherical spectrum, which
posed a few new challenges. A couple of notable ones were that of obtaining
pointwise bounds for nonspherical Eisenstein series and utilizing a
non-spherical analogue of the Selberg inversion formula.
