# For odd prime $p$, show there exist nonzero residues $x$ and $y$ mod $p$ s.t. $ax^2+by^2 \equiv 0$ mod $p$ iff $(\frac{-ab}{p}) = 1$

The question is exactly what I put in the title. But I will restate it below anyway:

For odd prime $$p$$, show there exist nonzero residues $$x$$ and $$y$$ mod $$p$$ such that $$ax^2+by^2 \equiv 0$$ mod $$p$$ iff $$(\frac{-ab}{p}) = 1$$.

And here I'm using $$(\frac{-ab}{p})$$ to mean a Legendre symbol, just so that is clear. This is a homework problem that I am stuck on, and I am hoping someone can give me a hint to help me along. Been stuck on it for an unreasonably long time and have made very little progress.

I got the forward direction, where I showed that using the values of $$x$$ and $$y$$ that I chose, $$ax^2 + by^2 \equiv 0$$ mod $$p$$ $$\implies (\frac{-ab}{p}) = 1$$. I have gotten nowhere with the other direction of the implication though, and it makes me think that I may have picked incorrect values for $$x$$ and $$y$$, or that I was not supposed to choose explicit values for these in the first place.

The textbook we are using has got some rules regarding Legendre symbols immediately preceding this problem, such as $$(\frac{ab}{p}) = (\frac{a}{p})(\frac{b}{p})$$ if $$p \nmid ab$$, and Euler's Criterion which says $$(\frac{a}{p}) \equiv a^{\frac{p-1}{2}}$$ mod $$p$$. I think that I am supposed to make use of these, but I'm not sure how. Any suggestions would be greatly appreciated!

• It is immediate that $ax^2 + by^2 \equiv 0$ has a solution iff $(\frac{-a/b}{p})=1$ (for $p\nmid ab$) Oct 12, 2020 at 8:41
• If you want to be cheeky about it write $b(ax^2 + by^2) = ab x^2 + (by)^2$. Oct 12, 2020 at 8:57

$$ax^2+by^2\equiv0\hspace{-0.7em}\pmod{p}\iff-ab\equiv\big(byx^{-1}\big)^2\hspace{-0.8em}\pmod{p}$$