<s>[INST] Does ($\frac{p-1}{2})$! satisty $x^2$ = 1modp? I'm trying to show that for p prime = 3 mod4, ($\frac{p-1}{2})!^2$ = 1 modp.
I assume I use Wilson's for the factorial and Euler's Totient Function for the (p-1), but I'm not sure how to string them together.
 [/INST] It is the case that, for prime $p \equiv 3 \pmod{4}$
$$
\frac{p-1}{2}!^2 \equiv 1 \pmod{p}
$$
To see why, first notice $k(p-k) \equiv -k^2 \equiv -(p-k)^2 \pmod{p}$. Begin with Wilson's Theorem
$$
(p-1)! = 1 \cdot 2 \cdot 3 \cdot 4\cdots (p-4)(p-3)(p-2)(p-1) \equiv -1 \pmod{p}
$$
Now rearrange this product in a clever way
$$
(p-1)! = 1 (p-1) 2 (p-2) 3 (p-3) 4 (p-4) \cdots \frac{p-1}{2} \frac{p+1}{2} \equiv -1 \pmod{p}
$$
Using our above fact, we obtain
$$
-1^2 \cdot -2^2 \cdot -3^2 \cdot -4^2 \cdots -(\frac{p-1}{2})^2 \equiv -1 \pmod{p}
$$
So we have
$$
(-1)^{\frac{p-1}{2}} 1^2\cdot2^2\cdot3^2\cdot4^2\cdots(\frac{p-1}{2})^2 \equiv -1 \pmod{p}
$$
If $p \equiv 3 \pmod{4}$, we have $(-1)^{\frac{p-1}{2}} = -1$ so
$$
1^2\cdot2^2\cdot3^2\cdot4^2\cdots(\frac{p-1}{2})^2 = \left(\frac{p-1}{2}\right)!^2  \equiv 1 \pmod{p}
$$
</s>