Given an odd prime $p$, let $S\subseteq \mathbb F_p$ be the set of quadratic residues modulo $p$. Given $a,b\in \mathbb F_p$ we write $aS+b$ for the set $$aS+b:=\{t\in\mathbb F_p:\ t=ax^2+b \text{ for some $x\in\mathbb F_p$}\}.$$
What is the cardinality of $S\cap ((S+1)\cup (2-S))$?
I would say that they are $\frac 3 8 p+ o(p)$, because of the following heuristic:
- the residues of the form $x^2$ are $\sim \frac p 2$ out of $p$;
- there's small correlation between a residue mod p being of the form $x^2$ or $1+y^2$;
- so $\# S\cap (S+1)$ should be $\sim p/4$.
This in fact is quickly provable in a number of ways.
- similar reasoning for the equation $\# S\cap (2-S)$.
Now, one would guess that, given random $x,y,z$, the equalities $x^2=1+y^2$ and $x^2=2-z^2$ are achieved for $1/4$ of the $x^2$s. So by Inclusion-Exclusion we get the heuristic.
I expect this to be provable in finite time by standard computations and the error term would be related to Weil's bound, aka Riemann Hypothesis on finite fields.
But how is it possible to make the above heuristic reasoning rigorous up to (1+o(1)), in a simple, direct and general way?
In other words, how to make oneself safe to assume the approximate independence of equations as above when doing this sort of ballpark estimates?
Let's restrict to linear equations between quadratic residues or to the specific example above, in this question. But of course the same question is interesting for other sets of residues that should "distribute randomly" modulo p, for example sets related to sums of characters.
Possible approaches so far:
- Estimate $\# S\cap S\cap(S+1)\cap(2-S)$ via Inclusion-Exclusion after counting precisely enough the solutions of the equation $(x^2-1-y^2)(x^2-2+z^2)=0$.
- Compute first effectively the expected Weil error bound, then compute the cardinality numerically for a large enough prime.
- Transform the problem into character sums as in Jyrki Lahtonen comment below.