If $p$ is an odd prime and $p \nmid a$, show that $a^{(p-1)/2} \equiv \pm 1 \pmod{p}$.
So I can completely see Fermat's Little Theorem in this problem, in class we went over the theorem as well as an alternate version which states $a^p \equiv a \pmod{p}$. Looking this over I am still not quite sure how the formula above would yield a a $\pm 1$. Any help is appreciated.