Let $f = ax^2 + bxy + cy^2$ be a binary quadratic form over $\mathbb{Z}$. We say $D = b^2 - 4ac$ is the discriminant of $f$. It is easy to see that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). If $D$ is a non-square integer and gcd$(a, b, c) = 1$, we say $f$ is primitive. Let $m$ be an integer. If $m = ax^2 + bxy + cy^2$ has a solution in $\mathbb{Z}^2$, we say $m$ is represented by $F$. If $m = ax^2 + bxy + cy^2$ has a solution $(s, t)$ such that gcd$(s, t) = 1$, we say $m$ is properly represented by $f$.
Suppose $m$ is properly represented by $ax^2 + bxy + cy^2$. Then $D$ is a quadratic residue modulo $m$ by this question.
Now I would like to ask if the converse holds. Namely, is the following proposition correct? If yes, how do we prove it?
Proposition Let $D$ be a non-square integer such that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). Let $m$ be an odd integer such that gcd$(m, D) = 1$. Suppose $D$ is a quadratic residue modulo $m$. Then there exists a primitive form $f = ax^2 + bxy + cy^2$ of discriminant $D$ and $m$ is properly represented by $f$.
[It’s also perfectly fine to ask and answer your own question, as long as you pretend you’re on Jeopardy! — phrase it in the form of a question. To be crystal clear, it is not merely OK to ask and answer your own question, it is explicitly encouraged.]http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/ – Makoto Kato Nov 07 '13 at 00:24