A congruence mod p

Let $p$ be a prime number. Show that $$2^2\times 4^2\times \cdots \times (p-1)^2 \equiv (-1)^{\frac{p+1}{2}} \pmod {p} .$$ Any help will be appreciated!

• Maybe the condition that $p$ be odd should be added. – awllower Jun 1 '16 at 14:21

Using Wilson's Theorem,

$$(p-1)!\equiv-1\pmod p$$

Now $2r\equiv-(p-2r)\pmod p$

$$\implies\prod_{r=1}^{(p-1)/2}(2r)\equiv-1\cdot(-1)^{(p-1)/2}\pmod p$$

• Dear lab bhattacharjee, thank you very much for your time on my problem! – sebastian Jun 1 '16 at 6:53

We can also observe that $\prod\limits_{i=1}^{(p-1)/2}(2i)^2\equiv4^{(p-1)/2}\prod\limits_{i=1}^{(p-1)/2}i^2\equiv2^{p-1}\prod\limits_{i=1}^{(p-1)/2}i^2\equiv\prod\limits_{i=1}^{(p-1)/2}i^2\pmod p.$
Then observe that the set $\{i^2\mid i=1,\cdots,(p-1)/2\}$ all are roots of the polynomial $x^{(p-1)/2}-1$ modulo $p,$ i.e. over $\mathbb F_p.$ Thus the set consists of all the roots of the polynomial modulo $p.$ Therefore $$x^{(p-1)/2}-1\equiv\prod\limits_{i=1}^{(p-1)/2}(x-i^2)\pmod p.$$ And hence $\prod\limits_{i=1}^{(p-1)/2}i^2\equiv(-1)(-1)^{(p-1)/2}=(-1)^{(p+1)/2}\pmod p.$
P.S. The above argument is still incomplete: one has to show that $i^2\not\equiv j^2,\forall i,j=1,\cdots,(p-1)/2,$ and this may be left as an exercise. :P

Hope this helps.