Let $n$ be a positive integer and $p=4n+1$, a prime number. Show that $(\frac{p-1}2)!$ is a root of $x^2+1=0$ in $\mathbb Z_p$ I have to prove the following part, but I can not. Please help me.

Let $n$ be a positive integer and $p=4n+1$, a prime number.
Show that:

$((p-1)/2)!$ is a root of $x^2+1=0$ equation over $\mathbb{Z}_p$.
We will use the following lemma. 

Lemma (Wilson's Theorem): Let $p$ be a prime number. Then $(p-1)! \equiv -1 $ (mod $p$).

Proof: There are several proofs on the "Wilson's Theorem" Wikipedia page, and many available elsewhere online. I'd encourage you to try to prove it yourself before looking them up, though!

$$\tag*{$\blacksquare$}$$

Now observe that, for each $i$, we have (working in $\mathbb{Z}_p$)

$$
\frac{p-i}{2} = \frac{p-i}{2} - p = \frac{-p - i}{2} = -\frac{p+i}{2}
$$

It follows from this that

\begin{align}
(p-1)! &amp;= (1)(2)\ldots(\frac{p-1}{2})(\frac{p+1}{2})\ldots(p-2)(p-1)
\\
&amp;= (1)(2)\ldots(\frac{p-1}{2})(-\frac{p-1}{2})\ldots(-2)(-1)
\\
&amp;= (-1)^{\frac{p-1}{2}}\Big((\frac{p-1}{2})!\Big)^2
\end{align}
Now, since $p = 4n+1$, we have that $(p-1)/2 = 2n$ is even, which means that $(-1)^\frac{p-1}{2} = 1$. Finally then, applying Wilson's Theorem, we obtain

$$
\Big((\frac{p-1}{2})!\Big)^2 = (p-1)! = -1
$$
and the result follows.
Wilsons Theorem says $(p-1)! \equiv -1 \pmod p$.

And for any $k$ consecutive numbers, $m+1, m+2,.....,m+k$ we know that $k!$ divides $\prod (m+k)$.

So $\frac{p-1}{2}!$ will divide $1*2.....*\frac{p-1}2$ and $\frac {p-1}{2}!$ will divide $(\frac{p-1}2+1)*(\frac {p-1}2 +2)*.....*(p-1)$.

SO $(\frac{p-1}2)!^2$ will divide $1*2*...... *(p-1)=(p-1)!$.

So $(\frac{p-1}2)!^2 \equiv (p-1)! \equiv -1 \pmod p$ ad $(\frac{p-1}2)!^2 + 1 \equiv 0 \pmod p$.