# Number of solutions to $mx^2+ny^2 \equiv k\pmod{p}$

I need a reference for the result which gives the number of solutions to the congruence $mx^2+ny^2 \equiv k\pmod{p}$. This result seems to be something that would be discussed in Gauss' Disquisitiones Arithmeticae, as it is proven from basic results in the theory of curves over finite fields.

Is anyone aware of a specific reference where the number of solutions to the above congruence is discussed?

-
Well, when $m$ and $-n$ are both quadratic residues, (and $p\neq 2$) the answer seems to be $p-1,$ by factoring the left hand side. – Igor Rivin Jul 3 '12 at 21:49
@Igor: When $-n/m$ is a quadratic residue, the same argument of course works. When $-n/m$ is not a quadratic residue, several arguments show that the answer is $p+1$. (kernel of the norm map $\mathbb F_{p^2}^{\times}\to \mathbb F_p^{\times}$, comparing the number of solutions for a single $x$ to a corresponding equation of the first type, using the isomorphism of the projective completion and $\mathbb P^1$ and counting points at $\infty$, probably etc.) Unfortunately I think Mike Decaro knows the answer but wants a reference for it. – Will Sawin Jul 3 '12 at 22:04

Dickson's History, Volume II, page 286, says "G. Libri proved that there are $n\pm1$ sets of solutions $\lt n$ of $$x^2+ay^2+b\equiv0\pmod n$$ if $a,b$ are not divisible by the prime $n$." The reference is Jour. fur Math. 9 (1832) 182.
Also, Dickson, page 296: "G. Frattini proved that the number of pairs of squares for which $x^2-Dy^2\equiv\lambda\pmod p$ is $(1/2)\{p-(D/p)\}$, where $(D/p)$ is the quadratic character of $D$ with respect to the prime $p$." Rendiconti Reale Accad. Lincei 4 (1885) 136-139.