The first part of this series posts concentrates on quadratic forms in two variables over the integers.

A quadratic form $q$ over the integer ring $\mathbb{Z}$, is just a bilinear form, $q: \mathbb{Z}^2 \rightarrow \mathbb{Z}$. For example, $q(x,y)=ax^2+bxy+cy^2(a,b,c,x,y\in\mathbb{Z})$ is a general expression for a quadratic form.

We say that two quadratic forms $q_1,q_2$ are equivalent if there is an invertible matrix $P\in M_2(\mathbb{Z})$ such that $q_1(x,y)=q_2((x,y)P)$ (here we take the convention that $q(x,y)=q((x,y))$, the latter, $(x,y)$ is an element in $\mathbb{Z}^2$, while in the first case we just take the corresponding coordinates). Furthermore, we say that they are properly equivalent if this matrix has determinant $1$. We can verify that these two relations are indeed equivalent relations. So the classification problem arises: classify these quadratic forms under one of these equivalent relations.

We have to find some invariants in these equivalent relations. One of them is the discriminant of a quadratic form. Suppose that a quadratic form is $q(x,y)=ax^2+bxy+cy^2$, then we define the discriminant of this quadratic form to be $D=b^2-4ac$. It can be verified easily that the discriminant of a quadratic form doesn’t change under an invertible transformation. So we have a necessary condition for two quadratic forms to be equivalent: their discriminants are the same.

Another property which is invariant under invertible transformations is the set of integers that can be represented by a quadratic form. We say that an integer $u$ can be represented by a quadratic form $q$ if there are two integers $x,y$ such that $q(x,y)=u$. An invertible transformation acting on $q$ is the same as a base change on $\mathbb{Z}^2$. So we see that it is indeed the case that the set of integers represented by a quadratic form is invariant under invertible transformations.

To solve the classification problem, we propose of finding some ‘minimal’ form in a sense to be clarified for each equivalent class. We say that a quadratic form $q=(a,b,c)$(from now on, for convenience we write $(a,b,c)$ for a quadratic form $q(x,y)=ax^2+bxy+cy^2$) is Lagrange-reduced if these coefficients satisfy $-|a|. One important result is that every quadratic form is equivalent to some Lagrange-reduced form. In fact, there even exists a nice algorithm for this process. Before that, we must say a few words about some elementary invertible transformation.

It is readily seen that (we denote $\approx$ for the equivalent relation, and $\approx'$ for the properly equivalent relation) for a quadratic form $(a,b,c)$, we have $(a,b,c)\approx(a,-b,c)$, and $(a,b,c)\approx'(c,-b,a),\approx'(a,b+2a,c+b+a), \approx' (a,b-2a,c-b+a)$. These transformations are called elementary transformations. They are going to be the building block of several results later on.

Now take a quadratic form(without loss of generality, or by using the above elementary transformations, we can assume the quadratic form to be) $(a,b,c)(a\neq 0)$. Then again using the equivalent relations $(a,b,c)\approx' (a,b-2a,c-b+a), \approx' (a,b+2a,c+b+a)$, we can always assume that $b$ lies in the interval $(-|a|,|a|]$. Now if $0<|c|<|a|$, then we apply the transformation $(a,b,c)\approx'(c,-b,a)$, and we can proceed until this form is transformed into a Lagrange-reduced form or a form like $(a,b,0)$. In the latter case, we have that the discriminant $D=b^2$. If we assume that the discriminant of the quadratic form is not a square, then we must have that this quadratic form is properly equivalent to a Lagrange-reduced form.

Another way to show the result is to introduce the concept, primitive representation, which is also an important concept on its own right. We say that an integer $u$ is primitively represented by a form $q$, if there exists a pair of integers $x,y$ such that $u=q(x,y)$, what is more, $x,y$ are coprime. Suppose that a non-zero integer $n$ is primitively represented by $q$ through a pair of integers $u,u'$(that is to say $n=q(u,u')=au^2+buu'+cu'^2$). Then by the Bezout lemma, we can find another pair of integers, $v,v'$ such that $uv-u'v'=1$. Then we define a new quadratic form $q'(x,y)=q(x(u,u')+y(v,v'))=q(xu+yv,xu'+yv')$ $=a(xu+yv)^2+b(xu+yv)(xu'+yv')+c(xu'+yv')^2$ $=(au^2+buu'+cu'^2)x^2+...=nx^2+...$. So all in all, $(a,b,c)\approx' (n,b',c')$. Utilize again those elementary transformations above, we can assume that $-|n|. In other words, if $n$ can be primitively represented by a form, then this form is properly equivalent to a form like $(n,b',c')(-|n|. Now consider the set of absolute values of the integers represented by the quadratic form $q$. Suppose $a$ is the smallest non-zero integer in this set, then we can readily see that $a$ or $-a$( we write it as $\epsilon a$) is primitively represented by $q$. Then $q\approx' q'=(\epsilon a,b,c)(-|a|. Since obviously $c$ can be represented by $q'$, if we assume that $D$ is not a square, then $c$ can’t be zero(easily verified), so we must have $|c|\geq |a|$, which completes the proof.

Now we spare some time for the case when $D$ is a square. Suppose the form is $q=(a,b,c)$ with $D=b^2-4ac=k^2$. If $k\geq1$ and $a>0$, then the equation $a^2+bx+c=0$ has rational solutions, suppose one of them is $\frac{u}{w}=\frac{-b+k}{2a}$ with $u,w$ coprime. Then we can find another pair of integers $t,v$ such that $ut-wv=1$. Then consider the new form, $q'(x,y)=q(xu+yv,xw+yt)$. These two are properly equivalent, which is not hard to see. After some calculations, the magical result is that $q'$ looks like $q'=(0,-k,c)$. So after some elementary transformations, we get that $q\approx (0,k,c)(0\leq c. If $k>0$ and $a=0$, then if $c\neq0$, we can change the place of $a$ and $c$ and proceed as above. If $c$ is also zero, then we are done. If $k=0$, we have that $q(x,y)=ax^2+4acxy+cy^2=(\sqrt{a}x+\sqrt{c}y)^2$. Since $ac$ is a square, we can assume that $a=d^2f,c=e^2f$ where $f$ is a product of distinct primes. Furthermore, we assume that the greatest common divisor of $d,c$ is $g=gcd(d,e)$ such that $d=d'g,e=e'g$. Then we have that $q(x,y)=fg^2(d'x+e'y)^2$. Since $d',e'$ are coprime, so by Bezout’s lemma, we can find another pair of integers $u,v$ such that $d'u-e'v=1$. By defining a new form $q(x,y)=q'(d'x+e'y,vx+uy)$, we get that $q'(x,y)=fg^2x^2$. So $q\approx (fg^2,0,0)$. What is more, it follows that this kind of reduced form is unique.

In the above, we have shown that each quadratic form is properly equivalent to some Lagrange-reduced form. Then we may  wonder whether we can replace ‘some’ by ‘one unique’. The answer is, NO. That is to say, two Lagrange-reduced form can be properly equivalent. For example, the forms$(1,1,-1),(-1,1,1)$ are in fact properly equivalent. Indeed, $(1,1,-1)\approx' (-1,-1,1)\approx' (-1,1,1)$.

But when the discriminant $D$ is negative, things become easier. Note that when $D<0$, we have that the quadratic form is definite(either positive or negative). So in order to simplify things, we always assume that a form is positive definite, in other words, in $(a,b,c)$, we must have $a>0$. What is more, in the case $a=c$, we have $(a,b,a)\approx'(a,-b,a)$. Here we always have $|b|<|a|$ since the discriminant is negative. But the result is that these two Lagrange-reduced forms are properly equivalent, which is a bit annoying. So to get some uniqueness, we have to get rid of this kind of things. So we demand that $b\geq0$ for the case $a=c$. So in sum, we can define another type of reduced forms, the Gauss-reduced forms. A quadratic form of discriminant negative $(a,b,c)$ is said to be Gauss-reduced, if $-a and if$a=c$ then $b\geq 0$.

Then Gauss gives a result as follows: a quadratic form of discriminant negative is properly equivalent to one and only one Gauss-reduced form.

The proof is not very hard, but we will not present it here.

Another important concept in the theory of quadratic forms is primitive forms. As the words go, a form $q=(a,b,c)$ is said to be primitive, if $a,b,c$ are coprime. Clearly primitivity is also a property that is invariant under invertible transformations. We denote by $P(D)$, the properly equivalent primitive class of quadratic forms of discriminant $D$, and by $h(D)$ the cardinality of $P(D)$. If $D\equiv 0(mod 4)$, then $(1,0,-D/4)$ is a primitive form of discriminant $D$, if $D\equiv 1(mod 4)$, then $(1,1,\frac{1-D}{4})$ is a primitive form of discriminant $D$. So we showed that $P(D)$ is never empty. But the problem is how $h(D)$ varies with $D$.

Gauss conjectured that the only negative values of $D$ such that $h(D)=1$ is $-3,-4,-7,-8,-11,-12,-16,-19,-27,-28,-43,-67,-163$. This conjecture was solved by Stark, Heegner and Baker. These numbers are closely related to the Heegner numbers, $1, 2, 3, 7, 11, 19, 43, 67, 163$. The former numbers are all multiples of the latter. Heegner proved that the polynomial $x^2+x+\frac{1+D}{4}$ can express primes for all $0\leq x\leq \frac{1+D}{4}-2$ if and only if $D$ is a Heegner number. Note that the discriminant of the polynomial is just $-D$.