This question is part of my number theory assignment which I couldn't solve.
Let p be an odd prime and gcd(a, p) =1 =gcd(k, p). Show that if the equation $x^{2}- ay^{2} =kp$ admits a solution then (a/p) =1.
Attempt : let $x_{0}$ and $y_{0}$ be a solution. Then ${x_{0}}^2 - a{ y_{0}}^2 =kp $ if I can prove that inverse of $y_{0}$ exists then I am done. But I don't find any way to prove it and so can you please help?
If $x^2-ay^2=kp$ for integers $x,y$ then modulo $p$, you get $x^2=ay^2$. Moreover, $x$ cannot be a multiple of $p$, otherwise $y$ would be also a multiple of $p$ (because $(a,p)=1$), so $kp$ would be a multiple of $p^2$ which is absurd since $(k,p)=1$. Similarly, $y$ cannot be a multiple of $p$. So you get that $$\left( \frac{x}{p}\right)\neq 0 \quad \text{and} \quad \left( \frac{y}{p}\right)\neq 0$$
Hence $$1=\left( \frac{x^2}{p}\right) = \left( \frac{ay^2}{p}\right)=\left( \frac{a}{p}\right)\left( \frac{y^2}{p}\right)=\left( \frac{a}{p}\right)$$