# When does $ax^2 + by^2 + c z^2 = 0$ have a non-trivial solution mod $p$?

I was wondering, is there a simple criterion for the coefficients $(a,b,c)$ to know when the equation $ax^2 + by^2 + c z^2 = 0$ has a non-trivial solution mod $p$? Any comments are appreciated.

• When $a+b+c = 0 \mod p$
– user261263
Nov 11, 2017 at 6:34
• Is $p$ prime? If so then the answer is "always". Nov 11, 2017 at 6:42
• @LordSharktheUnknown Yes $p$ is prime. Could you possibly elaborate on that little more by any chance? Nov 11, 2017 at 6:42
• Currently, the question is a bit silly - $x=y=z=0$ works for all $p$. If you are curious about solutions when not all of $x,y,z$ are zero, you should update the question to include this. Nov 11, 2017 at 7:17
• @KReiser O, yes. Of course. Nov 11, 2017 at 10:41

If any of $a,b,c$ are zero, then we can easily find a solution. For instance, if $c = 0$, then $(0,0,1)$ is solution. So assume $a,b,c$ are all nonzero. We will show there is a solution by counting. There are $\frac{p-1}{2}$ nonzero squares in $\mathbb{F}_p$ and since multiplication by $a$ is a bijection, then $A = \{a x^2 : x \in \mathbb{F}_p\}$ contains $\frac{p+1}{2}$ elements (including $0$, now). Similarly, the set $B = \{-by^2 - c : y \in \mathbb{F}_p\}$ contains $\frac{p+1}{2}$ as well. Since $\mathbb{F}_p$ only contains $p$ elements, then there must be some overlap, i.e., $A \cap B \neq \varnothing$. Thus there exist $x,y \in \mathbb{F}_p$ such that $ax^2 = -b y^2 - c$, so $ax^2 + by^2 + c = 0$, hence $(x,y,1)$ is a solution to your equation. By completing the square and doing a little algebra, one can use this result to show that every conic over a finite field has a (rational) point.
As a note, by dividing your equation through by $-c$, we can instead consider solutions to the equation \begin{align} \label{hilbert} a x^2 + b y^2 = z^2 \, . \tag{1} \end{align} Just as the Legendre symbol $\left(\frac{a}{p}\right)$ describes when the equation $x^2 = a$ has a solution in $\mathbb{F}_p$, the Hilbert symbol $(a,b)_{\mathbb{F}_p}$ describes when (\ref{hilbert}) has a solution in $\mathbb{F}_p$. The Hilbert symbol determines whether the quaternion algebra given by $i^2 = a$, $j^2 = b$ is split or ramified, so this post gives a (much more convoluted) proof using quaternion algebras that your equation always has a solution.