TITLE: Group theory proof of existence of a solution to $x^2\equiv -1\pmod p$ iff $p\equiv 1 \pmod 4$
QUESTION [9 upvotes]: I've read through the elementary proof of why there exists a solution $x$ to $x^2\equiv -1\pmod p$ iff $p\equiv 1 \pmod 4$ for $p$ an odd prime. Is there a group theory generalization for this fact as well?

REPLY [3 votes]: Probably the simplest way to state a corresponding group theory result is the generalization of Frobenius's theorem mentioned by Bill Dubuque. The generalization says that if $G$ is a finite group, then the number of solutions in $G$ to $x^n=1$ is a multiple of $\gcd(|G|,n)$. 
In the case of the congruence $x^2\equiv -1\pmod{p}$, the solutions to this congruence are exactly the solutions to $x^4\equiv 1 \pmod{p}$ that are not solutions to $x^2\equiv 1\pmod{p}$. The order of the group here is $p-1$, so the number of solutions to the first is a multiple of $\gcd(4,p-1)$; the number of solutions of the second is a multiple of $2$, and we know the two: $1$ and $-1$. Since every solution to $x^4\equiv 1\pmod{p}$ is a solution to $x^2\equiv 1 \pmod{p}$, there are solutions to $x^2\equiv -1\pmod{p}$ if and only if $\gcd(4,p-1) = 4$.