0

Let $p$ be an odd prime number.

Let $c$ be a given integer between $0$ and $p-1$.

It seems that for every $p$ and every $c$ we can find integers $a,b$ such that :

$$ a^2 + p b^2 = c \mod p^2 $$

Is this true ?

And if so why ? How to prove it ?

Some arguments :

  1. We know that $50 $% is a quadratic residue.

See also

https://en.wikipedia.org/wiki/Cipolla%27s_algorithm

Can Cipolla algorithm be used as a primality test?

for computing sqrt mod or factoring.

So adding $a^2 + p b^2$ seems likely to be any $c$ by a density argument.

  1. And we know that $a^2 + p b^2$ is closed under multiplication since it is the norm of a ring.

See Brahmagupta's identity : https://en.wikipedia.org/wiki/Brahmagupta%27s_identity

Therefore if $c_1$ and $c_2$ have a solution then so does $c_3 = c_1 c_2$.

This seems to suggest we only need to consider $c$ being $1$ or prime.

  1. It is also believed that most numbers are a sum of square and a squareful number.

So these 3 seem to suggest it is likely true.

But I found no proof nor counterexample.

Maybe it matters if the associated ring is a UFD or not.

Or maybe it matters if $p$ is an idoneal number.

see : https://en.wikipedia.org/wiki/Idoneal_number

The question reminds me - justified or not - of this one I asked earlier :

Generating residues with $ a^n + b^n \mod p $

There are also some theorems and factorizations based on $\mod p^2$ but I am no expert in that.

I am not certain how hard or easy this problem is. Special cases led to diophantine in 4 th degree, but those are probably overkill or not the best way to go.

The fact that $p$ needs to be an odd prime might be the problem when reducing to diophantines.

Im not sure if infinite descent will work.

I also had the idea that $a^2$ and $p b^2$ could be primes over 2 in that mod. That would lead to a goldbach type idea.

So many things seem related.

But I was not able to find a proof.

Maybe the quadratic reciprocity theorem will help us.

Also possibly related :

The diophantine equation $ m = x^2 + 7y^2 $

and maybe this

solving for Gauss's composition law


The above is the main question.

I was thinking about the $\mod p^3$ case too, but I think that is false...

mick
  • 17,886

2 Answers2

3

It is not always solvable. Take $p=3$ and $c=2$.

Modulo $9=p^2$, $\;a^2\in\{0,1,4,7\}$ and $3b^2\in\{0,3\}$,

so $a^2+3b^2\equiv2$ has no solutions.

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88
  • Maybe one has to note that this equation is unsolvable even modulo $p=3$. Perhaps, if $c$ is a quadratic residue modulo $p$, then one can use Hensel's lemma to lift the solution modulo $p^2$. – richrow Jun 24 '24 at 11:42
1

Generalizing @J.W.Tanner's answer, this is trivially false for "50%" of the $c$'s: those which are not quadratic residues $\bmod p$.

If $p\mid c$, this is true iff $\frac cp$ is a quadratic residue $\bmod p$.

Finally, if $c=m^2+np$ for some integers $m\in[1,p-1]$ and $n$, this is always true. Indeed, let $k$ be an inverse $\bmod p$ of $2m$. Then, a solution is for instance $(a,b):=(m+k(n-1)p,1)$, since $$c-a^2=p\left(n-2mk(n-1)-k^2(n-1)^2p\right)\equiv p\pmod{p^2}.$$

Edit (to answer a comment). More generally, for $a=m+k(n-b^2)p$, $$c-a^2=p\left(n-2mk(n-b^2)-k^2(n-b^2)^2p\right)\equiv pb^2\pmod{p^2}.$$

Anne Bauval
  • 49,005