# Relation between an integer represented by a binary quadratic form and a certain Dirichlet character defined by Jacobi symbol

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's easy to see that $D \equiv 0$ (mod $4$) or $D \equiv 1$ (mod $4$). If $D$ is not a square integer and gcd($a, b, c) = 1$, we say $f$ is primitive. If $D < 0$ and $a > 0$, we say $f$ is positive definite. 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$.

Is the following proposition true? If yes, how can 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 $\chi\colon (\mathbb{Z}/D\mathbb{Z})^\times\rightarrow \mathbb{Z}^\times = \{-1, 1\}$ be the map defined in this question. Let $f$ be a primitive binary quadratic form $f$ of discriminant $D$. If $D < 0$, we suppose that $f$ is positive definite. Suppose $m$ is an integer which is relatively prime to $D$ and it is represented by $f$. Then $\chi([m]) = 1$.

In the following proof, we use freely the properties of the Jacobi symbol as stated in this question.

Suppose $f = ax^2 + bxy + cy^2$. There exist integers $p, q$ such that $m = ap^2 + bpq + cq^2$. Let $d =$ gcd$(p, q)$. Let $p = dp'$, $q = dq'$. Then $m = d^2(ap'^2 + bp'q' + cq'^2)$. Let $n = ap'^2 + bp'q' + cq'^2$. Since gcd$(p', q') = 1$, $n$ is properly represented by $f$. Since $\chi([m]) = \chi([d])^2 \chi([n]) = \chi([n])$, we may assume $m$ is properly represented by $f$.

By this question, theres exists an integer $b$ such that $D \equiv b^2$ (mod $4m$).

Case 1 $D \equiv 0$ (mod $4$) and $m \gt 0$

Since $m$ is odd, $\chi([m]) = \left(\frac{D}{m}\right) = \left(\frac{b^2}{m}\right) = \left(\frac{b}{m}\right)^2 = 1$.

Case 2 $D \equiv 0$ (mod $4$) and $m \lt 0$

If $D \lt 0$, $f$ is positive definite by the assumption. Hence $m \gt 0$ by this question. This is a contradiction. Hence $D \gt 0$. Since $m$ is relatively prime to $D$, $m$ is odd. Since $D \equiv b^2$ (mod $4m$), $D \equiv b^2$ (mod $-m$). Hence $\chi([-m]) = \left(\frac{D}{-m}\right) = \left(\frac{b^2}{-m}\right) = \left(\frac{b}{-m}\right)^2 = 1$. Since $D \gt 0$, $\chi([-1]) = 1$ by this question. Hence $\chi([m]) = \chi([-1])\chi([-m]) = \chi([-1]) = 1$.

Case 3 $D \equiv 1$ (mod $4$) and $m \gt 0$

If $m$ is odd, $\chi([m]) = \left(\frac{D}{m}\right) = \left(\frac{b^2}{m}\right) = \left(\frac{b}{m}\right)^2 = 1$. Hence we suppose $m$ is even. Then we have $m = 2^\alpha n, \alpha \ge 1, n \ge 1$, where $n$ is odd. Since $D \equiv b^2$ (mod $n$), $\chi([n]) = \left(\frac{D}{n}\right) = \left(\frac{b^2}{n}\right) = \left(\frac{b}{n}\right)^2 = 1$. Hence $\chi([m]) = \chi([2^\alpha])\chi([n]) = \chi([2^\alpha])$.

If $\alpha$ is even, $\chi([2^\alpha]) = 1$. Hence $\chi([m]) = 1$.

If $\alpha$ is odd, $\chi([2^\alpha]) = \chi([2])$. Since $D \equiv b^2$ (mod $4m$), $D \equiv b^2$ (mod $8$). Hence $D \equiv 1$ (mod $8$) Hence $\chi([2]) = 1$ by this question. Hence $\chi([m]) = 1$.

Case 4 $D \equiv 1$ (mod $4$) and $m \lt 0$

If $D \lt 0$, $f$ is positive definite by the assumption. Hence $m \gt 0$ by this question. This is a contradiction. Hence $D \gt 0$.

Suppose $m$ is odd. Since $D \equiv b^2$ (mod $4m$), $D \equiv b^2$ (mod $-m$). Hence $\chi([-m]) = \left(\frac{D}{-m}\right) = \left(\frac{b^2}{-m}\right) = \left(\frac{b}{-m}\right)^2 = 1$. Since $D \gt 0$, $\chi([-1]) = 1$ by this question. Hence $\chi([m]) = \chi([-1])\chi([-m]) = 1$.

Suppose $m$ is even. Then we have $m = -2^\alpha n, \alpha \ge 1, n \ge 1$, where $n$ is odd. Since $D \equiv b^2$ (mod $n$), $\chi([n]) = \left(\frac{D}{n}\right) = \left(\frac{b^2}{n}\right) = \left(\frac{b}{n}\right)^2 = 1$. Hence $\chi([m]) = \chi([-1])\chi([2^\alpha])\chi([n]) = \chi([-1])\chi([2^\alpha]) = \chi([2^\alpha])$.

If $\alpha$ is even, $\chi([2^\alpha]) = 1$. Hence $\chi([m]) = 1$.

If $\alpha$ is odd, $\chi([2^\alpha]) = \chi([2])$. Since $D \equiv b^2$ (mod $4m$), $D \equiv b^2$ (mod $8$). Hence $D \equiv 1$ (mod $8$) Hence $\chi([2]) = 1$ by this question. Hence $\chi([m]) = 1$. This completes the proof.