Question:
If a and b are both quadratic residues of the odd prime p or both non-residues of p, show that the congruence ax^2 =b (modp) has a solution.

2. Because $\displaystyle a$ is a quadratic residue let $\displaystyle a\equiv s^2$ so $\displaystyle ax^{2}\equiv (sx)^{2}$ and since $\displaystyle b$ is a quadratic residue we know $\displaystyle b\equiv t^2$; let $\displaystyle t = sx$ and we are done.

EDIT:
I had failed to consider the case where they both are non-residues.

$\displaystyle ax^2 = b\ \pmod{p}$
$\displaystyle (ax)^2 = ab\ \pmod{p}$

This is solvable only when $\displaystyle ab$ is a quadratic residue; by euler's criterion, $\displaystyle ab$ is a quadratic residue iff and only iff both or neither of $\displaystyle a$ and $\displaystyle b$ are quadratic residues.

Let $\displaystyle ax\equiv s\pmod{p}$ be a solution to the congruence.

By the Euclidean algorithm, $\displaystyle a$ has a modular inverse since it is relatively prime to $\displaystyle p$ (if $\displaystyle p|a$, then there would be no such $\displaystyle s$ . If $\displaystyle a\equiv 0$,do we consider it a quadratic residue or what?).

In particular, then, $\displaystyle x\equiv a^{-1}s\pmod{p}$ is a solution to our original equation.