# Proper Representation Criterion for Binary Quadratic Forms

Recall that if $f(x, y) = ax^2 + bxy + cy^2$ is a binary quadratic form then an integer $n \in \mathbb{Z}$ is said to be properly represented by $f(x, y)$ if there exists integers $x_0, y_0 \in \mathbb{Z}$ such that:

(1)and $(x_0, y_0) = 1$. We will now state an important criterion which tells us when an integer $n$ can be properly represented by a binary quadratic form.

Theorem 1: Let $n \neq 0$ and let $d \neq 0$. Then $n$ can be properly represented by some binary quadratic form $f(x, y)$ with discriminant $d$ if and only if the congruence $x^2 \equiv d \pmod {4|n|}$ has a solution. |

**Proof:**$\Leftarrow$ Suppose that $x^2 \equiv d \pmod {4|n|}$ has a solution. Then there exists an integer $s$ such that $s^2 \equiv 4 \pmod {4|n|}$. So $s^2 - d = 4nk$ for some integer $k$. Let:

- Then $f(x, y)$ has discriminant $b^2 - 4|n|c = d$. Also, observe that:

- Since $(1, 0) = 1$, we see that $n$ can be properly represented by $f(x, y)$.

- $\Rightarrow$ Suppose that $n$ can be properly represented by some binary quadratic form $f(x, y) = ax^2 + bxy + cy^2$ with discriminant $d = b^2 - 4ac$. Then there exists $x_0, y_0 \in \mathbb{Z}$ such that $n = f(x_0, y_0)$ and $(x_0, y_0) = 1$. Since $(x_0, y_0) = 1$ there exists integers $m_1, m_2 \in \mathbb{Z}$ such that $m_1m_2 = 4|n|$ and $(x_0, m_1) = 1$, $(y_0, m_2) = 1$. Observe that:

- Plugging in $x = x_0$ and $y = y_0$ gives us:

- So $(2ax_0 + by_0)^2 \equiv dy_0^2 \pmod {m_2}$. Since $(y_0, m_2) = 1$, there exists $y_0^{-1} \in \mathbb{Z}$ such that $y_0y_0^{-1} = 1$. So:

- We can similarly obtain a solution to $x^2 \equiv d \pmod {m_1}$. By the Chinese Remainder Theorem, there exists a unique solution modulo $m_1m_2 = 4|n|$, that is, $x^2 \equiv d \pmod {4|n|}$ has a solution. $\blacksquare$

Lemma 2: Let $f(x, y)$ be a binary quadratic form. If $p$ is a prime and $p$ is represented by $f(x, y)$ then any such representation is a proper representation. |

**Proof:**Let $f(x, y) = ax^2 + bxy + cy^2$ and suppose that there exists $x_0, y_0 \in \mathbb{Z}$ such that:

- Let $(x_0, y_0) = g$. Then the equation above implies that $g | p$. So $g = 1$ or $g = p$. But $g \neq p$, so $g = 1$, that is, $(x_0, y_0) = 1$. So $p$ can is properly represented by $f(x, y)$. $\blacksquare$

Theorem 3: Let $p$ be a prime. Then there exists a binary quadratic form $f(x, y)$ with discriminant $d$ (where $d \equiv 0, 1 \pmod 4$) which properly represents $p$ if and only if $\left ( \frac{d}{p} \right ) = 1$ or $p | d$. |

For example, let $f(x, y) = x^2 + y^2$. Observe that $d = -4$. A prime $p$ can be properly represented by $f(x, y)$ if and only if $\left ( \frac{-4}{p} \right ) = 1$ or $p | -4$. Observe that:

(8)So $\left ( \frac{-1}{p} \right ) = 1$ if and only if $p \equiv 1 \pmod 4$. And $p | -4$ implies that $p = 2$. So the only primes that can be properly represented as the sum of two squares are primes for which $p \equiv 1 \pmod 4$ and $p = 2$.