I also have to prove this for $$2^2 \times 4^2 \times 6^2 \cdots \times (p-1)^2 \equiv (-1)^{(p+1)/2} \pmod{p}$$ I made some progress so far and got stuck. I said that since p is odd, $(p+1)/2$ is even. Then we can say that $(-1)^{\mathrm{even}}= 1$, so $(-1)^{(p+1)/2}\pmod{p}$ can be written as $1\pmod{p}$. I know that the product of odds is odd and the product of evens is even, but I cant prove that the left side of this equation in either case is congruent to $1 \pmod{p}$. Any help here would be greatly appreciated.

  • 1
    $\begingroup$ You would probably use Wilson's Theorem. $\endgroup$ Feb 16, 2011 at 19:42
  • 2
    $\begingroup$ Hint: if $z$ is even then $p-z$ is odd and vice versa. $\endgroup$ Feb 16, 2011 at 19:43
  • 2
    $\begingroup$ Also, $(p+1)/2$ is not always even: try $p=5$. $\endgroup$ Feb 16, 2011 at 19:44
  • $\begingroup$ @YuvalFilmus (5+1)/2 is not even? $\endgroup$ Feb 18, 2022 at 14:50
  • $\begingroup$ $(5+1)/2 = 3$, which is odd. $\endgroup$ Feb 18, 2022 at 17:24

2 Answers 2


You can start with Wilson's theorem, $(p-1)! \equiv -1 \pmod{p}.$ Rearrange the factorial thus, with $p=2m+1,$ $$-1 \equiv 1(p-1)2(p-2) \ldots m(p-m) \equiv 1(-1)2(-2) \ldots m(-m) \equiv 1^22^2 \ldots m^2(-1)^m \pmod{p}.$$

So we have shown

$$1^22^2 \ldots m^2 \equiv (-1)^{m+1} $$

or, noting that $m=(p-1)/2,$ in terms of $p$

$$1^12^2 \ldots \left( \frac{p-1}{2} \right)^2 \equiv (-1)^{(p+1)/2}.$$

Now we construct the product on the LHS, so consider first $2^24^2 \ldots (p-1)^2$ and factor out $2^{2p-2}$ then use Fermat, $2^{p-1} \equiv 1 \pmod{p}.$

You should now have the result for the product with the even numbers, use that along with Wilson's theorem again to prove the desired result for the product with the odd numbers.

  • $\begingroup$ I don't understand how you ignored the odd terms in the end of the second line and moved to the 3rd line that says "Now consider..." $\endgroup$
    – Katie Barosie
    Feb 17, 2011 at 3:41
  • $\begingroup$ I think we may apply quadratic reciprocity law to do so, to classify some cases, can we do that? $\endgroup$
    – awllower
    Feb 17, 2011 at 4:29
  • $\begingroup$ @Katie: Please see the additional information the edit. I tried to reach a balance between giving enough information to tackle it and ruining the problem for you. And that, unfortunately, involves a bit of guesswork on a site like this as we don't get to meet the OP. (The proof that intelligent life exists elsewhere in the universe is that they have not tried to contact us yet.) $\endgroup$ Feb 17, 2011 at 8:26
  • $\begingroup$ Hi Derek, I was just wondering how to factor out $2^{2p-2}$ as this factor might not exist - take $p=7$ for example. The even numbers are $2^2 \cdot 4^2 \cdot 6^2$ but this has the common factor $2^8$. Please advise. $\endgroup$ Feb 9, 2013 at 6:29


we can write $1\equiv -(p-1)\pmod p$,

Now write $1^2 \times 3^2 \dots(p-2)^2$ as $1\times(-(p-1))\times 3\times(-(p-3)\dots(p-2)(-(P-(p-2)))$, $\implies 1^2 \times 3^2 \dots(p-2)^2 = 1\times(-(p-1))\times3\times(-(p-3)\dots(p-2)(-(P-(p-2)))\\\equiv-1^m (p-1)! \equiv-1^{m+1}\pmod p$ wilson theorem, $1^2 \times 3^2 \dots(p-2)^2\equiv-1^{(p+1)/2} \pmod p$ (as taken $p=2m+1$)

similar for another case

  • $\begingroup$ Your post is hardly legible (please use LateX) and the quality of the explanations needs to be improved. (-1) $\endgroup$ Feb 19, 2016 at 19:08

You must log in to answer this question.