# If $P$ is an odd prime number such that $P=2k+1$, then prove $(k!)^2\equiv (-1)^{k+1} \mod P$

A question I have been given for an assignment is as follows. If $$P$$ is an odd prime number such that $$P=2k+1$$, then prove $$(k!)^2\equiv (-1)^{k+1} \mod P$$

Hint: Try to see how to group the terms in the product $$(P-1)!=(2k)!=1*2*3*...*(2k-2)*(2k-1)*(2k)$$ to get two products, each equal to $$k!$$ modulo $$P$$.

Given this is an assignment for a grade I am not looking for anyone to provide a full answer, but I would appreciate direction on how to begin solving this and what knowledge to apply. I've tried creating and attempting to relate equivalent expressions for multiple parts of the problem and hint, but I honestly do not feel as if I'm even working in the right direction towards the goal.

• hint: two groups are $2k!!$ and $(2k-1)!!$
– user645636
Oct 23 '19 at 23:26
• Hint: Another way to write $p-1$ is as $-1$ mod p. Similarly $p-2\equiv -2$ mod p. So you can write $(p-1)!=(1)(2)\cdot\cdot\cdot(-2)(-1)$ Oct 24 '19 at 18:48

Hint. Use Wilson's theorem, which states that $$(P-1)!\equiv(-1)\pmod{P}$$. And then, from $$2k \equiv -1 \pmod{P}$$, $$2k -1 \equiv -2 \pmod{P}$$,..., and $$k-1 \equiv -k \pmod{P}$$, you can follow to the desired congruence.