Fermat's $p=a^2+b^2$ theorem There is one little part of the proof I didn't quite get. 

If we assume that $p$ is a prime such that $p \equiv 1\pmod 4$ and $x$ an element of order $2$ in $\mathbb{Z}_p$. Why $x$ must be equal to $-1$? Or, equivalently, why is $-1$ the only element of order $2$ in $\mathbb{Z}_p$ with $p \equiv 1\pmod 4$?


Because $\mathbb Z_p$ is a field, so the only solutions to $x^2=1$ satisfy $(x-1)(x+1)=0$, or $x=\pm 1$. $x=-1$ is the only one of order $2$.
