Question:
Let $a$ be a quadratic residue to a prime modulus $p$. Prove $a^{(p-1)/2} \equiv 1 \pmod{p}$.
My attempt at a solution:
\begin{align*}
&a\text{ is a quadratic residue}\\\
&\Longrightarrow a\text{ is a residue class of $p$ which has even index $c$ relative to a primitive root $g$}\\\
&\Longrightarrow a \equiv g^c \pmod{p}\\\
&\Longrightarrow a \equiv g^{2k} \pmod{p}\text{ where $2k=c$}\\\
&\Longrightarrow g^{2kv} \equiv g^{c} \pmod{p}\text{ for some natural number $v$}\\\
&\Longrightarrow 2kv \equiv c \pmod{p-1}\text{ (by a proof in class)}\\\
&\Longrightarrow 2kv \equiv 2k \pmod{p-1}\\\
&\Longrightarrow kv \equiv k \pmod{(p-1)/2}\\\
&\Longrightarrow v \equiv k(k^{-1}) \pmod{(p-1)/2}\text{ since $\gcd(2k, p-1)$ is not equal to 1}\\\
&\Longrightarrow k^{-1} \text{ (k inverse exists)}\\\
&\Longrightarrow v \equiv 1 \pmod{(p-1)/2}.
\end{align*}
I believe this implies that $g^{(p-1)/2} \equiv 1 \pmod{p}$, is this correct?
Although what I was required to show was $a^{(p-1)/2} \equiv 1 \pmod{p}$, am I on the right track, how do I show this, I've spent quite some time on this and looked over all the proofs in my notes, I can't seem to find out how.