# Math Help - Amount of quadratic residues and nonresidues modulo p

1. ## Amount of quadratic residues and nonresidues modulo p

I cannot find a proof/ reasoning behind the following statement:

If p is an odd prime then among the integers in $[1,p-1]$ there are exactly $\frac{p-1}{2}$ quadratic residues and exactly $\frac{p-1}{2}$ nonresidues.

My text says the reasoning behind this follows from the following fact:

Let $g$ be a primitive root modulo $p$ and assume $\gcd(a,p)=1$. Let $r$ be any integer such that $g^r\equiv{a}(mod\,p)$. Then $r$ is even if and only if $a$ is a quadratic residue modulo $p$.

But I don't really see how that follows from this. Any help would be appreciated.

Thanks.