Writing integers modulo p as the sum of a quadratic residue and quadratic non-residue

elementary-number-theorymodular arithmeticmodular-nth-rootsnumber theoryprime numbers

I am interested if for a given $x \in\mathbb Z/p\mathbb Z$ we can write $$x = a+ b \tag{$*$}$$ for $a$ a quadratic residue and $b$ a non-residue modulo $p$.

If $p \equiv 3 \pmod 4$ this is true since we can write always write $x = r^2 – s^2$ as the difference of 2 squares and then $a = r^2$ and $b = -s^2$ suffice since $-1$ is a non-residue modulo $p$.

Similarly if $p \equiv 1 \pmod 4$ then $-1$ is a residue and so we cannot write $x=a+b$ for $x=0$ else both $a$ and $b$ are residues/non-residues.

However for $x\neq 0$ and $p \equiv 1 \pmod 4$ I believe $(*)$ still holds – but I have failed to prove it. Does anyone have a proof or counterexample?

Best Answer

First of all, it is enough to show the existence when $x=1$, since given $1=a+b$ where $a$ is a quadratic residue and $b$ is not, $x=ax+bx$ must be such that one of the $ax,bx$ is a quadratic residue and the other isn't.

When $p=5$ the existence can be checked manually: $1=2+4$. Suppose for $p\equiv1\pmod4$ and $p>5$ that there exists no quadratic residue $a$ and non-quadratic residue $b$ such that $a+b=1$.

Let $1<a<p-1$ be such that $\bar a\in\mathbb F_p^\times$ is a quadratic residue. Such an integer exists, since there are at least $(p-1)/2>2$ quadratic residues.

Then $\bar a+1$ must also be a quadratic residue, since otherwise $(\bar a+1)+(-\bar a)=1$ would be a counter-example.

The same argument shows that $\bar a-1$ must also be a quadratic residue since $(1-\bar a)$.

Thus, inductively, all $1\le a\le p-1$ must be a quadratic residue, a contradiction.