4

I came across the two congruences that for $p$ an odd prime,

$$1^2\cdot 3^2\cdot 5^2\cdots (p-2)^2\equiv (-1)^{(p+1)/(2)}\pmod p$$

and

$$2^2\cdot 4^2\cdot 6^2\cdots (p-1)^2\equiv (-1)^{(p+1)/(2)}\pmod p$$

What is the reason for this? It seems to me to be closely related to Wilson's Theorem, and possibly Fermat's little theorem since $p-1=2k$ for some $k$, and then $j^{2k}\equiv 1\pmod p$ for all the evens and odds $j$ less than $p$, but I wasn't able to complete this train of thought.

yunone
  • 22,333

2 Answers2

4

Modulo $p$, you have $k=-(p-k)$ and so both products are equal to $(p-1)!(-1)^{(p-1)/2} \equiv (-1)^{(p+1)/2} \pmod{p}$ by Wilson's theorem.

Yuval Filmus
  • 57,157
0

I amplify the details -

The crux is to use $\color{purple}{ p-k\equiv -k \mod p }$.

$ [ 2 \cdot 4 ... (p - 3) \cdot (p-1)] \cdot \quad \color{purple}{[ 2 \cdot 4 ... (p - 3) \cdot (p-1)]} $ $\equiv [ 2 \cdot 4 ... (p - 3) \cdot (p-1)] \cdot \quad \color{purple}{[ (p-2) \cdot (p-4) ... \cdot (1) \quad \cdot (-1)^\frac{p-1}{2}]} (\mod p) = (p - 1)! \quad \cdot (-1)^\frac{p-1}{2} \equiv -1 \quad \cdot (-1)^\frac{p-1}{2} \quad (mod p)$

The last line is by reason of Wilson's Theorem.