If $\gcd({a,p})=1$ where $p\gt2$ is a prime and if $a$ has a square root modulo p, explain why $a^{\frac{p-1}{2}}\equiv 1 \pmod{p}$.
I wish I could provide some work, but all i've been able to find online is various theorems and proofs that don't seem to apply.
Euler's Criterion:
If p is an odd prime and p doesn't divide a, then $x^2 \equiv a \pmod{p}$ has a solution or no solution depending on whether $a^\frac{p-1}{2}\equiv1$ or $-1\pmod{p}$.