1

Previously: Literature on Uniqueness of Quadratic Residues Modulo a Prime. Unfortunately I wasn't able to solve this based on the previous answer.

Problem: This Blog post by Preshing shows how one can create a sequence of unique integers between $0$ and a prime $P \equiv 3 \bmod 4$. I'm using this quite sucessfully, but I've been asked for a proof which I have a hard time to find since I'm not in math.

The function is:

$$f(i) = \begin{cases} i^2 \bmod P,& \text{if } i\leq \frac{P}{2}\\ P - i^2 \bmod P, & \text{otherwise} \end{cases}$$

What I've found out so far:

(a) If $P$ is a prime, then $i^2 \bmod P$ evaluates to one $0$, $\frac{P-1}{2}$ residues, and also $\frac{P-1}{2}$ nonresidues.
(b) The Legendre Symbol $\left(\frac{a}{p}\right)$ evaluates to 1 if $a$ is a residue, and -1 if it is not.
(c) The Legendre Symbol is periodic with period $P$.
(d) The Legendre Symbol of $\left(\frac{-1}{P}\right)$ evaluates to -1 if $P$ is congruent to $3 \bmod 4$
(e) $\left(\frac{ab}{P}\right)$ is equivalent to $\left(\frac{a}{P}\right)\left(\frac{b}{P}\right)$
(f) It follows from (d, e) that $\left(\frac{-1 \cdot a}{P}\right) = \left(\frac{-1}{P}\right)\left(\frac{a}{P}\right) = -\left(\frac{a}{P}\right)$ if $P$ is congruent to $3 \bmod 4$.
(g) It follows from (b, c, f) that any residue of $i^2 \mod P$ is a nonresidue of $P - i^2 \bmod P$, and vice versa.

I'm stuck going forward from here, though. How exactly can I show that $f(x)$ produces unique integers?

I've observed that the results of $g(i) = i^2 \bmod P$ are mirrored in the middle, e.g. $g(i)$ for $P = 11$ gives $[1, 4, 9, 5, 3, 3, 5, 9, 4, 1]$, so the first half of input values gives all possible output values for $g(i)$, and the second half contains only duplicates. Due to (a, g), $h(i) = P - i^2 \bmod P$ must therefore produce the remaining possible values for the second half of input values. For that argument, I would need a proof that $g(x)$ really is always mirrored, however, which I couldn't find.

Thanks for any help!

Arturo Magidin
  • 398,050
Markus
  • 111
  • Since $p |n^2-m^2$ iff it divides $n+m$ or $n-m$, it is obvious that your function is injective when restricted to $[1,(p-1)/2]$, same when restricted to $[p-(p-1)/2,p-1]$. The point is that for $p\equiv 3\bmod 4$ then $-1$ is not a square $\bmod p$, thus $-i^2$ is never a square, thus $f([1,(p-1)/2])$ doesn't intersect $f([p-(p-1)/2,p-1])$ and hence $f$ is injective on $[1,p-1]$. – reuns Jan 17 '20 at 21:15

0 Answers0