Number Theory - mod p Show that if there is no solution $y^2 = x $(mod $p$) then $x^{\frac{p-1}{2}} = -1$ (mod $p$)
I have been given the hint to look at pairs of residues mod $p (a,bx)$ with $ab = 1$ (mod $p$)
Looking for a solution to the problem and motivation behind the solution
 A: Suppose $x$ is nonsquare mod $p.\,$ For $\,a\not\equiv 0\,$ the map $\,a\mapsto a^{-1}x\,$ is an involution (self-inverse), and has no fixed points (else $\,a \equiv a^{-1} x\,\Rightarrow\ x \equiv a^2)\,$ so it partitions all elts $\not \equiv 0$ into $\color{#0a0}{(p\!-\!1)/2}$ pairs $(a,a^{-1}x)$ with product $\color{#c00}x.\,$ So the product $\Pi$ of all elts $\not\equiv 0$ is $\equiv \color{#c00}x^{\color{#0a0}{\large (p-1)/2}}.$ Also  $\,\Pi \equiv (p\!-\!1)!\,\equiv -1\,$ by Wilson's Theorem. Hence we have proved that $x$ nonsquare mod $p$ $\,\Rightarrow\,x^{(p-1)/2}\equiv -1.$
A: Let us assume that $p$ is an odd prime and $G=\mathbb{Z}/(p\mathbb{Z})^*$. 
$G$ is a cyclic group with order $p-1$, hence there is some $g\in G$ such that every element of $G$ can be represented as $g^k$ with $k\in\{0,1,\ldots,p-1\}$. The map $\psi:x\mapsto x^{\frac{p-1}{2}}$ is a homomorphism on $G$ and $\psi(G)$ is a subgroup with exactly two elements, hence for any $h\in G$ we have either $\psi(h)=1$ or $\psi(h)=-1$. If $h=g^{2m}$ we have
$$\psi(h) = \left(g^{2m}\right)^{\frac{p-1}{2}} = \left(g^m\right)^{p-1} = 1 $$
and if $h=g^{2m+1}$ we have $\psi(h)=g^{\frac{p-1}{2}}=-1$. It follows that $\ker\psi$ is exactly the subgroup of quadratic residues in $G$. If $y^2\equiv x\pmod{p}$ has no solutions then $x$ is a quadratic non-residue, so $x^{\frac{p-1}{2}}=-1$.
