For which primes $p$ is $-1$ not the sum of two non-zero quadratic residues? I am trying go find a characterisation of the primes $p$ for which no two non-zero quadratic residues add to $-1$.
Equivalently, we are looking for the values of $p$ for which the equation $x^2 + y^2 = -1$ has a solution in $\mathbb{Z}/p\mathbb{Z}^*$.
Let $R$ be the set of non-zero quadratic residues modulo $p$. Then $|R| = (p-1)/2$. By the Cauchy-Davenport theorem,
$$|R + R| \geq p-2.$$
Moreover, Vosper's theorem tells us that the equality is attained only when $R$ is an arithmetic progression, which I think is false for $p > 5$, but I have not been able to prove this.
That would mean that at most one value of $\mathbb{Z}/p\mathbb{Z}$ is not attained by the sum of two non-zero quadratic residues. It would be interesting to determine in general the values for $p$ for which this is the case and also what value is unattainable. Here we are just asking for the values of $p$ for which $-1$ is that value.
 A: *

*If $-1$ is a square $=c^2$ then $x^2+y^2=(x+cy)(x-cy)$, if $p\ne 2$ then for any $a\ne 0$,
$x+cy=a,x-cy=-1/a$ iff $x=\frac{a-1/a}{2},y=\frac{a+1/a}{2c}$, for $p> 5$ it suffices to take $a\ne \pm 1,a\ne \pm c$ to obtain that $-1=x^2+y^2$ with $x,y$ both non-zero.

*If $-1$ is not a square then $H = \{ \sum_{j=1}^J x_j^2,J\ge 0,x_j\in Z/pZ\}$ is a subgroup of $Z/pZ$ thus it is the whole of it. Choose $J$ minimum such that $\sum_{j=1}^J x_j^2$ is a not a square, we get $\sum_{j=2}^J x_j^2 = y^2$, $a=x_1^2+y^2$ is not a square, $-1=a b^2$ and $-1 = (x_1b)^2+(yb)^2$ where $x_1b,yb$ both are non-zero.

*The remaining cases are $p\le 5$
A: Turns out it is easier to answer the general question:
"Given a prime $p$, for what values of $k\in\mathbb{Z}/p\mathbb{Z}$ does the equation
$$\qquad \qquad \qquad x^2 + y^2 = k \qquad \qquad \qquad(1)$$
have a solution such that $x,y\neq 0$?"
Let $\mathfrak{R}$ be the subgroup of $\mathbb{Z}/p\mathbb{Z}$ of its non-zero quadratic residues and $\mathfrak{N}$ its only coset, i.e. the set of quadratic non-residues.
Recall that $|\mathfrak{R}| = |\mathfrak{N}| = \dfrac{p-1}{2}$. Applying the Cauchy-Davenport theorem to $\mathfrak{R} + \mathfrak{R}$, the amount of possible values of $k$ for which $(1)$ has a solution is at least $p-2$. Therefore, the amount of possible non-zero values of $k$ for which $(1)$ has a solution is at least $p-3$.
By the pigeonhole principle, if $p > 5$ then $p-3 > \dfrac{p-1}{2}$ and thus we are guaranteed a solution for some $k_r\in\mathfrak{R}$ and for some $k_n\in \mathfrak{N}$. Let $(x_r,y_r)$ and $(x_n,y_n)$ be solutions to their respective values of $k$.
We will distinguish three cases:


*

*$k\in\mathfrak{R}.$
In this case, there are $u,v\in \mathbb{Z}/p\mathbb{Z}^*$ such that $u^2 = k$ and $v^2 = k_r$. Then 
$$(uv^{-1}x_r)^2 + (uv^{-1}y_r)^2 = k.$$


*

*$k\in\mathfrak{N}.$
In this case, $kk_n^{-1}\in \mathfrak{R}$ and thus there is $w\in \mathbb{Z}/p\mathbb{Z}^*$ such that $w^2k_n = k$. Then
$$(wx_n)^2 + (wy_n)^2 = k.$$


*

*$k = 0.$
In this case we have
$$x^2 + y^2 = 0 \iff (xy^{-1})^2 = -1 \iff -1 \in \mathfrak{R} \iff p \equiv 1 \pmod 4.$$
This means that if $\mathfrak{R} + \mathfrak{R} = \mathbb{Z}/p\mathbb{Z}$ if $p\equiv 1 \pmod 4$ and $p > 5$; and $\mathfrak{R} + \mathfrak{R} = \mathbb{Z}/p\mathbb{Z}^*$ if $p\equiv 3 \pmod 4$ and $p > 5$. This implies that our question has positive answer for $p > 5$. The cases where $p \leq 5$ can be studied separately without any complications.
