# Residue classes modulo $8$ of odd integers represented by a binary quadratic form whose discriminant is even

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$). We suppose $D$ is not a square integer.

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$. Suppose gcd($m, D) = 1$. Let $p$ be an odd prime divisor of $D$. By this question, $\left(\frac{m}{p}\right)$ does not depend on the choice of $m$. So it is natural to ask what can be said for the prime $2$ if $D \equiv 0$ (mod $4$).

We suppose $D \equiv 0$ (mod $4$). Let $m, k$ be odd integers represented by $f$. We would like to investigate relations between the residue class of $m$ modulo $8$ and that of $k$.

Question Are the following statements true?

1) If $D/4 \equiv 0$ (mod $8$), $mk \equiv 1$ (mod $8$).

2) If $D/4 \equiv 1, 5$ (mod $8$), $mk \equiv 1, 3, 5, 7$ (mod $8$).

3) If $D/4 \equiv 2$ (mod $8$), $mk \equiv 1, 7$ (mod $8$).

4) If $D/4 \equiv 3, 4, 7$ (mod $8$), $mk \equiv 1, 5$ (mod $8$).

5) If $D/4 \equiv 6$ (mod 8), $mk \equiv 1, 3$ (mod $8$).

We use the method of my answer to this question.

Let $(p, r)$ be an integer solution of $m = ax^2 + bxy + cy^2$. Let $(q, s)$ be an integer solution of $k = ax^2 + bxy + cy^2$. Let $f(px + qy, rx + sy) = Ax^2 + Bxy + Cy^2$. Then

$A = ap^2 + bpr + cr^2$

$B = 2apq + b(ps + qr) + 2crs$

$C = aq^2 + bqs + cs^2$

Hence $A = m$ and $C = k$. Since $B^2 - 4AC = D(ps - qr)^2$, $B^2 - 4mk = D(ps - qr)^2$.

Let $t = ps - qr$. Then $4mk = B^2 - Dt^2$. Since $B^2 = 4mk + Dt^2$, $B^2 \equiv 0$ (mod $4$). Hence $B$ is even. Let $B = 2u$. Then $4mk = 4u^2 - Dt^2$. Hence $mk = u^2 - (D/4)t^2$.

Case 1 $D/4 \equiv 0$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1$ (mod $8$).

Case 2 $D/4 \equiv 1$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $t^2 \equiv 0, 1, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 3, 5, 7$ (mod $8$).

Case 3 $D/4 \equiv 2$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 2t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $2t^2 \equiv 0, 2$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 7$ (mod $8$).

Case 4 $D/4 \equiv 3$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 3t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $3t^2 \equiv 0, 3, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 5$ (mod $8$).

Case 5 $D/4 \equiv 4$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 4t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $4t^2 \equiv 0, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 5$ (mod $8$).

Case 6 $D/4 \equiv 5$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 5t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $5t^2 \equiv 0, 5, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 3, 5, 7$ (mod $8$).

Case 7 $D/4 \equiv 6$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 5t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $6t^2 \equiv 0, 6$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 3$ (mod $8$).

Case 8 $D/4 \equiv 7$ (mod $8$)

Since $mk = u^2 - (D/4)t^2$, $mk \equiv u^2 - 7t^2$ (mod $8$). Since $u^2 \equiv 0, 1, 4$ (mod $8$) and $7t^2 \equiv 0, 7, 4$ (mod $8$) and $mk$ is odd, $mk \equiv 1, 5$ (mod $8$).