vEnhance's avatar

Jun 12, 2017

🖉 Positive Definite Quadratic Forms

I’m reading through Primes of the Form $x^2+ny^2$, by David Cox (link; it’s good!). Here are the high-level notes I took on the first chapter, which is about the theory of quadratic forms.

(Meta point re blog: I’m probably going to start posting more and more of these more high-level notes/sketches on this blog on topics that I’ve been just learning. Up til now I’ve been mostly only posting things that I understand well and for which I have a very polished exposition. But the perfect is the enemy of the good here; given that I’m taking these notes for my own sake, I may as well share them to help others.)

1. Overview

Definition 1. For us a quadratic form is a polynomial Q=Q(x,y)=ax2+bxy+cy2Q = Q(x,y) = ax^2 + bxy + cy^2, where aa, bb, cc are some integers. We say that it is primitive if gcd(a,b,c)=1\gcd(a,b,c) = 1.

For example, we have the famous quadratic form QFermat(x,y)=x2+y2.Q_{\text{Fermat}}(x,y) = x^2+y^2. As readers are probably aware, we can say a lot about exactly which integers can be represented by QFermatQ_{\text{Fermat}}: by Fermat’s Christmas theorem, the primes p1(mod4)p \equiv 1 \pmod 4 (and p=2p=2) can all be written as the sum of two squares, while the primes p3(mod4)p \equiv 3 \pmod 4 cannot. For convenience, let us say that:

Definition 2. Let QQ be a quadratic form. We say it represents the integer mm if there exists x,yZx,y \in \mathbb Z with m=Q(x,y)m = Q(x,y). Moreover, QQ properly represents mm if one can find such xx and yy which are also relatively prime.

The basic question is: what can we say about which primes/integers are properly represented by a quadratic form? In fact, we will later restrict our attention to “positive definite” forms (described later).

For example, Fermat’s Christmas theorem now rewrites as:

Theorem 3 (Fermat’s Christmas theorem for primes)

An odd prime pp is (properly) represented by QFermatQ_{\text{Fermat}} if and only if p1(mod4)p \equiv 1 \pmod 4.

The proof of this is classical, see for example my olympiad handout. We also have the formulation for odd integers:

Theorem 4 (Fermat’s Christmas theorem for odd integers)

An odd integer mm is properly represented by QFermatQ_{\text{Fermat}} if and only if all prime factors of mm are 1(mod4)1 \pmod 4.

Proof: For the “if” direction, we use the fact that QFermatQ_{\text{Fermat}} is multiplicative in the sense that (x2+y2)(u2+v2)=(xu±yv)2+(xvyu)2.(x^2+y^2)(u^2+v^2) = (xu \pm yv)^2 + (xv \mp yu)^2. For the “only if” part we use the fact that if a multiple of a prime pp is properly represented by QFermatQ_{\text{Fermat}}, then so is pp. This follows by noticing that if x2+y20(modp)x^2+y^2 \equiv 0 \pmod p (and xy≢0(modp)xy \not\equiv 0 \pmod p) then (x/y)21(modp)(x/y)^2 \equiv -1 \pmod p. \Box

Tangential remark: the two ideas in the proof will grow up in the following way.

  • The fact that QFermatQ_{\text{Fermat}} “multiplies nicely” will grow up to become the so-called composition of quadratic forms.
  • The second fact will not generalize for an arbitrary form QQ. Instead, we will see that if a multiple of pp is represented by a form QQ then some form of the same “discriminant” will represent the prime pp, but this form need not be the same as QQ itself.

2. Equivalence of forms, and the discriminant

The first thing we should do is figure out when two forms are essentially the same: for example, x2+5y2x^2+5y^2 and 5x2+y25x^2+y^2 should clearly be considered the same. More generally, if we think of QQ as acting on Z2\mathbb Z^{\oplus 2} and TT is any automorphism of Z2\mathbb Z^{\oplus 2}, then QTQ \circ T should be considered the same as QQ. Specifically,

Definition 5. Two forms Q1Q_1 and Q2Q_2 said to be equivalent if there exists T=(pqrs)GL(2,Z)T = \begin{pmatrix} p & q \\ r & s \end{pmatrix} \in \operatorname{GL}(2,\mathbb Z) such that Q2(x,y)=Q1(px+ry,qx+sy)Q_2(x,y) = Q_1(px+ry, qx+sy). We have detT=psqr=±1\det T = ps-qr = \pm 1 and so we say the equivalence is

  • a proper equivalence if detT=+1\det T = +1, and
  • an improper equivalence if detT=1\det T = -1.

So we generally will only care about forms up to proper equivalence. (It will be useful to distinguish between proper/improper equivalence later.)

Naturally we seek some invariants under this operation. By far the most important is:

Definition 6. The discriminant of a quadratic form Q=ax2+bxy+cy2Q = ax^2 + bxy + cy^2 is defined as D=b24ac.D = b^2-4ac. The discriminant is invariant under equivalence (check this). Note also that we also have D0,1(mod4)D \equiv 0 , 1 \pmod 4.

Observe that we have 4a(ax2+bxy+cy2)=(2ax+by)2Dy2.4a \cdot (ax^2+bxy+cy^2) = (2ax + by)^2 - Dy^2. So if D<0D < 0 and a>0a > 0 (thus c>0c > 0 too) then ax2+bxy+cy2>0ax^2+bxy+cy^2 > 0 for all x,y>0x,y > 0. Such quadratic forms are called positive definite, and we will restrict our attention to these forms.

Now that we have this invariant, we may as well classify equivalence classes of quadratic forms for a fixed discriminant. It turns out this can be done explicitly.

Definition 7. A quadratic form Q=ax2+bxy+cy2Q = ax^2 + bxy + cy^2 is reduced if

  • it is primitive and positive definite,
  • bac|b| \le a \le c, and
  • b0b \ge 0 if either b=a|b| = a or a=ca = c.

Exercise 8. Check there only finitely many reduced forms of a fixed discriminant.

Then the big huge theorem is:

Theorem 9 (Reduced forms give a set of representatives)

Every primitive positive definite form QQ of discriminant is properly equivalent to a unique reduced form. We call this the reduction of QQ.

Proof: Omitted due to length, but completely elementary. It is a reduction argument with some number of cases. \Box

Thus, for any discriminant DD we can consider the set Cl(D)={reduced forms of discriminant D}\operatorname{Cl}(D) = \left\{ \text{reduced forms of discriminant } D \right\} which will be the equivalence classes of positive definite of discriminant DD. By abuse of notation we will also consider it as the set of equivalence classes of primitive positive definite forms of discriminant DD.

We also define h(D)=Cl(D)h(D) = \left\lvert \operatorname{Cl}(D) \right\rvert; by the exercise, h(D)<h(D) < \infty. This is called the class number.

Moreover, we have h(D)1h(D) \ge 1, because we can take x2D/4y2x^2 - D/4 y^2 for D0(mod4)D \equiv 0 \pmod 4 and x2+xy+(1D)/4y2x^2 + xy + (1-D)/4 y^2 for D1(mod4)D \equiv 1 \pmod 4. We call this form the principal form.

3. Tables of quadratic forms

Example 10 (Examples of quadratic forms with h(D)=1h(D) = 1, D0(mod4)D \equiv 0 \pmod 4)

The following discriminants have class number h(D)=1h(D) = 1, hence having only the principal form:

  • D=4D = -4, with form x2+y2x^2 + y^2.
  • D=8D = -8, with form x2+2y2x^2 + 2y^2.
  • D=12D = -12, with form x2+3y2x^2+3y^2.
  • D=16D = -16, with form x2+4y2x^2 + 4y^2.
  • D=28D = -28, with form x2+7y2x^2 + 7y^2.

This is in fact the complete list when D0(mod4)D \equiv 0 \pmod 4.

Example 11 (Examples of quadratic forms with h(D)=1h(D) = 1, D1(mod4)D \equiv 1 \pmod 4)

The following discriminants have class number h(D)=1h(D) = 1, hence having only the principal form:

  • D=3D = -3, with form x2+xy+y2x^2 + xy + y^2.
  • D=7D = -7, with form x2+xy+2y2x^2 + xy + 2y^2.
  • D=11D = -11, with form x2+xy+3y2x^2 + xy + 3y^2.
  • D=19D = -19, with form x2+xy+5y2x^2 + xy + 5y^2.
  • D=27D = -27, with form x2+xy+7y2x^2 + xy + 7y^2.
  • D=43D = -43, with form x2+xy+11y2x^2 + xy + 11y^2.
  • D=67D = -67, with form x2+xy+17y2x^2 + xy + 17y^2.
  • D=163D = -163, with form x2+xy+41y2x^2 + xy + 41y^2.

This is in fact the complete list when D1(mod4)D \equiv 1 \pmod 4.

Example 12 (More examples of quadratic forms)

Here are tables for small discriminants with h(D)>1h(D) > 1. When D0(mod4)D \equiv 0 \pmod 4 we have

  • D=20D = -20, with h(D)=2h(D) = 2 forms 2x2+2xy+3y22x^2 + 2xy + 3y^2 and x2+5y2x^2 + 5y^2.
  • D=24D = -24, with h(D)=2h(D) = 2 forms 2x2+3y22x^2 + 3y^2 and x2+6y2x^2 + 6y^2.
  • D=32D = -32, with h(D)=2h(D) = 2 forms 3x2+2xy+3y23x^2 + 2xy + 3y^2 and x2+8y2x^2 + 8y^2.
  • D=36D = -36, with h(D)=2h(D) = 2 forms 2x2+2xy+5y22x^2 + 2xy + 5y^2 and x2+9y2x^2 + 9y^2.
  • D=40D = -40, with h(D)=2h(D) = 2 forms 2x2+5y22x^2 + 5y^2 and x2+10y2x^2 + 10y^2.
  • D=44D = -44, with h(D)=3h(D) = 3 forms 3x2±2xy+4y23x^2 \pm 2xy + 4y^2 and x2+11y2x^2 + 11y^2.

As for D1(mod4)D \equiv 1 \pmod 4 we have

  • D=15D = -15, with h(D)=2h(D) = 2 forms 2x2+xy+2y22x^2 + xy + 2y^2 and x2+xy+4y2x^2 + xy + 4y^2.
  • D=23D = -23, with h(D)=3h(D) = 3 forms 2x2±xy+3y22x^2 \pm xy + 3y^2 and x2+xy+6y2x^2+ xy + 6y^2.
  • D=31D = -31, with h(D)=3h(D) = 3 forms 2x2±xy+42x^2 \pm xy + 4 and x2+xy+8y2x^2 + xy + 8y^2.
  • D=39D = -39, with h(D)=4h(D) = 4 forms 3x2+3xy+4y23x^2 + 3xy + 4y^2, 2x2±2xy+5y22x^2 \pm 2xy + 5y^2 and x2+xy+10y2x^2 + xy + 10y^2.

Example 13 (Even More Examples of quadratic forms)

Here are some more selected examples:

  • D=56D = -56 has h(D)=4h(D) = 4 forms x2+14y2x^2+14y^2, 2x2+7y22x^2+7y^2 and 3x2±2xy+5y23x^2 \pm 2xy + 5y^2.
  • D=108D = -108 has h(D)=3h(D) = 3 forms x2+27y2x^2+27y^2 and 4x2±2xy+7y24x^2 \pm 2xy + 7y^2.
  • D=256D = -256 has h(D)=4h(D) = 4 forms x2+64y2x^2+64y^2, 4x2+4xy+17y24x^2+4xy+17y^2 and 5x2±2xy+13y25x^2\pm2xy+13y^2.

4. The Character χD\chi_D

We can now connect this to primes pp as follows. Earlier we played with QFermat=x2+y2Q_{\text{Fermat}} = x^2+y^2, and observed that for odd primes pp, p1(mod4)p \equiv 1 \pmod 4 if and only if some multiple of pp is properly represented by QFermatQ_{\text{Fermat}}.

Our generalization is as follows:

Theorem 14 (Primes represented by some quadratic form)

Let D<0D < 0 be a discriminant, and let pDp \nmid D be an odd prime. Then the following are equivalent:

  • (Dp)=1\left( \frac Dp \right) = 1, i.e. DD is a quadratic residue modulo pp.
  • The prime pp is (properly) represented by some reduced quadratic form in Cl(D)\operatorname{Cl}(D).

This generalizes our result for QFermatQ_{\text{Fermat}}, but note that it uses h(4)=1h(-4) = 1 in an essential way! That is: if (1/p)=1(-1/p) = 1, we know pp is represented by some quadratic form of discriminant D=4D = -4… but only since h(4)=1h(-4) = 1 do we know that this form reduces to QFermat=x2+y2Q_{\text{Fermat}} = x^2+y^2.

Proof: First assume WLOG that p4ap \nmid 4a and Q(x,y)0(modp)Q(x,y) \equiv 0 \pmod p. Thus pyp \nmid y, since otherwise this would imply xy0(modp)x \equiv y \equiv 0 \pmod p. Then 04aQ(x,y)(2ax+by)2Dy2(modp)0 \equiv 4a \cdot Q(x,y) \equiv (2ax + by)^2 - Dy^2 \pmod p hence D(2axy1+b)2(modp)D \equiv \left( 2axy^{-1} + b \right)^2 \pmod p.

The converse direction is amusing: let m2=D+pkm^2 = D + pk for integers mm, kk. Consider the quadratic form Q(x,y)=px2+mxy+ky2.Q(x,y) = px^2 + mxy + ky^2. It is primitive of discriminant DD and Q(1,0)=pQ(1,0) = p. Now QQ may not be reduced, but that’s fine: just take the reduction of QQ, which must also properly represent pp. \Box

Thus to every discriminant D<0D < 0 we can attach the Legendre character (is that the name?), which is a homomorphism

χD=(D) ⁣:(Z/DZ)×{±1}\chi_D = \left( \tfrac{D}{\bullet} \right) \colon \left( \mathbb Z / D\mathbb Z \right)^\times \rightarrow \{ \pm 1 \}

with the property that if pp is a rational prime not dividing DD, then χD(p)=(Dp)\chi_D(p) = \left( \frac{D}{p} \right). This is abuse of notation since I should technically write χD(p(modD))\chi_D(p \pmod D), but there is no harm done: one can check by quadratic reciprocity that if pq(modD)p \equiv q \pmod D then χD(p)=χD(q)\chi_D(p) = \chi_D(q). Thus our previous result becomes:

Theorem 15 (ker(χD)\ker(\chi_D) consists of representable primes)

Let pDp \nmid D be prime. Then pker(χD)p \in \ker(\chi_D) if and only if some quadratic form in Cl(D)\operatorname{Cl}(D) represents pp.

As a corollary of this, using the fact that h(8)=h(12)=h(28)=1h(-8) = h(-12) = h(-28) = 1 one can prove that

Corollary 16 (Fermat-type results for h(4n)=1h(-4n) = 1)

Let p>7p > 7 be a prime. Then pp is

  • of the form x2+2y2x^2 + 2y^2 if and only if p1,3(mod8)p \equiv 1, 3 \pmod 8.
  • of the form x2+3y2x^2 + 3y^2 if and only if p1(mod3)p \equiv 1 \pmod 3.
  • of the form x2+7y2x^2 + 7y^2 if and only if p1,2,4(mod7)p \equiv 1, 2, 4 \pmod 7.

Proof: The congruence conditions are equivalent to (4n/p)=1(-4n/p) = 1, and as before the only point is that the only reduced quadratic form for these D=4nD = -4n is the principal one. \Box

5. Genus theory

What if h(D)>1h(D) > 1? Sometimes, we can still figure out which primes go where just by taking mods.

Let QCl(D)Q \in \operatorname{Cl}(D). Then it represents some residue classes of (Z/DZ)×(\mathbb Z/D\mathbb Z)^\times. In that case we call the set of residue classes represented the genus of the quadratic form QQ.

Example 17 (Genus theory of D=20D = -20)

Consider D=20D = -20, with ker(χD)={1,3,7,9}(Z/DZ)×.\ker(\chi_D) = \left\{ 1, 3, 7, 9 \right\} \subseteq (\mathbb Z/D\mathbb Z)^\times. We consider the two elements of Cl(D)\operatorname{Cl}(D):

  • x2+5y2x^2 + 5y^2 represents 1,9(Z/20Z)×1, 9 \in (\mathbb Z/20\mathbb Z)^\times.
  • 2x2+2xy+3y22x^2+2xy+3y^2 represents 3,7(Z/20Z)×3, 7 \in (\mathbb Z/20\mathbb Z)^\times.

Now suppose for example that p9(mod20)p \equiv 9 \pmod{20}. It must be represented by one of these two quadratic forms, but the latter form is never 9(mod20)9 \pmod{20} and so it must be the first one. Thus we conclude that

  • p=x2+5y2p = x^2+5y^2 if and only if p1,9(mod20)p \equiv 1, 9 \pmod{20}.
  • p=2x2+2xy+3y2p = 2x^2 + 2xy + 3y^2 if and only if p3,7(mod20)p \equiv 3, 7 \pmod{20}.

The thing that makes this work is that each genus appears exactly once. We are not always so lucky: for example when D=108D = -108 we have that

Example 18 (Genus theory of D=108D = -108)

The two elements of Cl(108)\operatorname{Cl}(-108) are:

  • x2+27y2x^2+27y^2, which represents exactly the 1(mod3)1 \pmod 3 elements of (Z/DZ)×(\mathbb Z/D\mathbb Z)^\times.
  • 4x2±2xy+7y24x^2 \pm 2xy + 7y^2, which also represents exactly the 1(mod3)1 \pmod 3 elements of (Z/DZ)×(\mathbb Z/D\mathbb Z)^\times.

So the best we can conclude is that p=x2+27y2p = x^2+27y^2 OR p=4x2±2xy+7y2p = 4x^2\pm2xy+7y^2 if and only if p1(mod3)p \equiv 1 \pmod 3. This is because the two distinct quadratic forms of discriminant 108-108 happen to have the same genus.

We now prove that:

Theorem 19 (Genii are cosets of ker(χD)\ker(\chi_D))

Let DD be a discriminant and consider the Legendre character χD\chi_D.

  • The genus of the principal form of discriminant DD constitutes a subgroup HH of ker(χD)\ker(\chi_D), which we call the principal genus.
  • Any genus of a quadratic form in Cl(D)\operatorname{Cl}(D) is a coset of the principal genus HH in ker(χD)\ker(\chi_D).

Proof: For the first part, we aim to show HH is multiplicatively closed. For D0(mod4)D \equiv 0 \pmod 4, D=4nD = -4n we use the fact that (x2+ny2)(u2+nv2)=(xu±nyv)2+n(xvyu)2.(x^2+ny^2)(u^2+nv^2) = (xu \pm nyv)^2 + n(xv \mp yu)^2. For D1(mod4)D \equiv 1 \pmod 4, we instead appeal to another “magic” identity 4(x2+xy+1D4y2)(2x+y)2(modD)4\left( x^2+xy+\frac{1-D}{4}y^2 \right) \equiv (2x+y)^2 \pmod D and it follows from here that HH is actually the set of squares in (Z/DZ)×(\mathbb Z/D\mathbb Z)^\times, which is obviously a subgroup.

Now we show that other quadratic forms have genus equal to a coset of the principal genus. For D0(mod4)D \equiv 0 \pmod 4, with D=4nD = -4n we can write a(ax2+bxy+cy2)=(ax+b/2y)2+ny2a(ax^2+bxy+cy^2) = (ax+b/2 y)^2 + ny^2 and thus the desired coset is shown to be a1Ha^{-1} H. As for D1(mod4)D \equiv 1 \pmod 4, we have 4a(ax2+bxy+cy2)=(2ax+by)2Dy2(2ax+by)2(modD)4a \cdot (ax^2+bxy+cy^2) = (2ax + by)^2 - Dy^2 \equiv (2ax+by)^2 \pmod D so the desired coset is also a1Ha^{-1} H, since HH was the set of squares. \Box

Thus every genus is a coset of HH in ker(χD)\ker(\chi_D). Thus:

Definition 20. We define the quotient group Gen(D)=ker(χD)/H\operatorname{Gen}(D) = \ker(\chi_D) / H which is the set of all genuses in discriminant DD. One can view this as an abelian group by coset multiplication.

Thus there is a natural map ΦD ⁣:Cl(D)Gen(D).\Phi_D \colon \operatorname{Cl}(D) \twoheadrightarrow \operatorname{Gen}(D). (The map is surjective by Theorem 14.) We also remark than Gen(D)\operatorname{Gen}(D) is quite well-behaved:

Proposition 21 (Structure of Gen(D)\operatorname{Gen}(D))

The group Gen(D)\operatorname{Gen}(D) is isomorphic to (Z/2Z)m(\mathbb Z/2\mathbb Z)^{\oplus m} for some integer mm.

Proof: Observe that HH contains all the squares of ker(χD)\ker(\chi_D): if ff is the principal form then f(t,0)=t2f(t,0) = t^2. Thus claim each element of Gen(D)\operatorname{Gen}(D) has order at most 22, which implies the result since Gen(D)\operatorname{Gen}(D) is a finite abelian group. \Box

In fact, one can compute the order of Gen(D)\operatorname{Gen}(D) exactly, but for this post I Will just state the result.

Theorem 22 (Order of Gen(D)\operatorname{Gen}(D))

Let D<0D < 0 be a discriminant, and let rr be the number of distinct odd primes which divide DD. Define μ\mu by:

  • μ=r\mu = r if D1(mod4)D \equiv 1 \pmod 4.
  • μ=r\mu = r if D=4nD = -4n and n3(mod4)n \equiv 3 \pmod 4.
  • μ=r+1\mu = r+1 if D=4nD = -4n and n1,2(mod4)n \equiv 1,2 \pmod 4.
  • μ=r+1\mu = r+1 if D=4nD = -4n and n4(mod8)n \equiv 4 \pmod 8.
  • μ=r+2\mu = r+2 if D=4nD = -4n and n0(mod8)n \equiv 0 \pmod 8.

Then Gen(D)=2μ1\left\lvert \operatorname{Gen}(D) \right\rvert = 2^{\mu-1}.

6. Composition

We have already used once the nice identity (x2+ny2)(u2+nv2)=(xu±nyv)2+n(xvyu)2.(x^2+ny^2)(u^2+nv^2) = (xu \pm nyv)^2 + n(xv \mp yu)^2. We are going to try and generalize this for any two quadratic forms in Cl(D)\operatorname{Cl}(D). Specifically,

Proposition 23 (Composition defines a group operation)

Let f,gCl(D)f,g \in \operatorname{Cl}(D). Then there is a unique hCl(D)h \in \operatorname{Cl}(D) and bilinear forms Bi(x,y,z,w)=aixz+bixw+ciyz+diywB_i(x,y,z,w) = a_ixz + b_ixw + c_iyz + d_iyw for i=1,2i=1,2 such that

  • f(x,y)g(z,w)=h(B1(x,y,z,w),B2(x,y,z,w))f(x,y) g(z,w) = h(B_1(x,y,z,w), B_2(x,y,z,w)).
  • a1b2a2b1=+f(1,0)a_1b_2 - a_2b_1 = +f(1,0).
  • a1c2a2c1=+g(1,0)a_1c_2 - a_2c_1 = +g(1,0).

In fact, without the latter two constraints we would instead have a1b2a2b1=±f(1,0)a_1b_2 - a_2b_1 = \pm f(1,0) and a1c2a2c1=±g(1,0)a_1c_2 - a_2c_1 = \pm g(1,0), and each choice of signs would yield one of four (possibly different) forms. So requiring both signs to be positive makes this operation well-defined. (This is why we like proper equivalence; it gives us a well-defined group structure, whereas with improper equivalence it would be impossible to put a group structure on the forms above.)

Taking this for granted, we then have that

Theorem 24 (Form class group)

Let D0,1(mod4)D \equiv 0, 1 \pmod 4, D<0D < 0 be a discriminant. Then Cl(D)\operatorname{Cl}(D) becomes an abelian group under composition, where

  • The identity of Cl(D)\operatorname{Cl}(D) is the principal form, and
  • The inverse of the form ax2+bxy+cy2ax^2+bxy+cy^2 is ax2bxy+cy2ax^2-bxy+cy^2.

This group is called the form class group.

We then have a group homomorphism ΦD ⁣:Cl(D)Gen(D).\Phi_D \colon \operatorname{Cl}(D) \twoheadrightarrow \operatorname{Gen}(D). Observe that ax2+bxy+cy2ax^2 + bxy + cy^2 and ax2bxy+cy2ax^2 - bxy + cy^2 are inverses and that their ΦD\Phi_D images coincide (being improperly equivalent); this is expressed in the fact that Gen(D)\operatorname{Gen}(D) has elements of order 2\le 2. As another corollary, the number of elements of Cl(D)\operatorname{Cl}(D) with a given genus is always a power of two.

We now define:

Definition 25. An integer n1n \ge 1 is convenient if the following equivalent conditions hold:

  • The principal form x2+ny2x^2+ny^2 is the only reduced form with the principal genus.
  • ΦD\Phi_D is injective (hence an isomorphism).
  • h(D)=2μ1\left\lvert h(D) \right\rvert = 2^{\mu-1}.

Thus we arrive at the following corollary:

Corollary 26 (Convenient numbers have nice representations)

Let n1n \ge 1 be convenient. Then pp is of the form x2+ny2x^2+ny^2 if and only if pp lies in the principal genus.

Hence the representability depends only on p(mod4n)p \pmod{4n}.

OEIS A000926 lists 65 convenient numbers. This sequence is known to be complete except for at most one more number; moreover the list is complete assuming the Grand Riemann Hypothesis.

7. Cubic and quartic reciprocity

To treat the cases where nn is not convenient, the correct thing to do is develop class field theory. However, we can still make a little bit more progress if we bring higher reciprocity theorems to bear: we’ll handle the cases n=27n=27 and n=64n=64, two examples of numbers which are not convenient.

7.1. Cubic reciprocity

First, we prove that

Theorem 27 (On p=x2+27y2p = x^2+27y^2)

A prime p>3p > 3 is of the form x2+27y2x^2+27y^2 if and only if p1(mod3)p \equiv 1 \pmod 3 and 22 is a cubic residue modulo pp.

To do this we use cubic reciprocity, which requires working in the Eisenstein integers Z[ω]\mathbb Z[\omega] where ω\omega is a cube root of unity. There are six units in Z[ω]\mathbb Z[\omega] (the sixth roots of unity), hence each nonzero number has six associates (differing by a unit), and the ring is in fact a PID.

Now if we let π\pi be a prime not dividing 33, and α\alpha is coprime to π\pi, then we can define the cubic Legendre symbol by setting

(απ)3α13(Nπ1)(modπ){1,ω,ω2}. \left( \frac{\alpha}{\pi} \right)_3 \equiv \alpha^{\frac13(N\pi-1)} \pmod \pi \in \left\{ 1, \omega, \omega^2 \right\}.

Moreover, we can define a primary prime π3\pi \nmid 3 to be one such that π1(mod3)\pi \equiv -1 \pmod 3; given any prime exactly one of the six associates is primary. We then have the following reciprocity theorem:

Theorem 28 (Cubic reciprocity)

If π\pi and θ\theta are disjoint primary primes in Z[ω]\mathbb Z[\omega] then (πθ)3=(θπ)3.\left( \frac{\pi}{\theta} \right)_3 = \left( \frac{\theta}{\pi} \right)_3. We also have the following supplementary laws: if π=(3m1)+3nω\pi = (3m-1) + 3n\omega, then

(ωπ)3=ωm+nand(1ωπ)3=ω2m. \left( \frac{\omega}{\pi} \right)_3 = \omega^{m+n} \qquad\text{and}\qquad \left( \frac{1-\omega}{\pi} \right)_3 = \omega^{2m}.

The first supplementary law is for the unit (analogous to (1/p)(-1/p)) while the second reciprocity law handles the prime divisors of 3=ω2(1ω)23 = -\omega^2(1-\omega)^2 (analogous to (2/p)(2/p).)

We can tie this back into Z\mathbb Z as follows. If p1(mod3)p \equiv 1 \pmod 3 is a rational prime then it is represented by x2+xy+y2x^2+xy+y^2, and thus we can put p=ππp = \pi \overline{\pi} for some prime π\pi, N(π)=pN(\pi) = p. Consequently, we have a natural isomorphism Z[ω]/πZ[ω]Z/pZ.\mathbb Z[\omega] / \pi \mathbb Z[\omega] \cong \mathbb Z / p \mathbb Z. Therefore, we see that a given a(Z/pZ)×a \in (\mathbb Z/p\mathbb Z)^\times is a cubic residue if and only if (α/π)3=1(\alpha/\pi)_3 = 1.

In particular, we have the following corollary, which is all we will need:

Corollary 29 (When 22 is a cubic residue)

Let p1(mod3)p \equiv 1 \pmod 3 be a rational prime, p>3p > 3. Write p=ππp = \pi \overline{\pi} with π\pi primary. Then 22 is a cubic residue modulo pp if and only if π1(mod2)\pi \equiv 1 \pmod 2.

Proof: By cubic reciprocity:

(2π)3=(π2)3π13(N21)π(mod2). \left( \frac{2}{\pi} \right)_3 = \left( \frac{\pi}{2} \right)_3 \equiv \pi^{\frac13(N2-1)} \equiv \pi \pmod 2.

\Box

Now we give the proof of Theorem 27.

Proof: First assume p=x2+27y2=(x+33y)(x33y).p = x^2+27y^2 = \left( x+3\sqrt 3 y \right)\left( x-3\sqrt 3 y \right). Let π=x+33y=(x+3y)+6yω\pi = x + 3 \sqrt{-3} y = (x+3y) + 6y\omega be primary, noting that π1(mod2)\pi \equiv 1 \pmod 2. Now clearly p1(mod3)p \equiv 1 \pmod 3, so done by corollary.

For the converse, assume p1(mod3)p \equiv 1 \pmod 3, p=ππp = \pi \overline{\pi} with π\pi primary and π1(mod2)\pi \equiv 1 \pmod 2. If we set π=a+bω\pi = a + b\omega for integers aa and bb, then the fact that π1(mod2)\pi \equiv 1 \pmod 2 and π1(mod3)\pi \equiv -1 \pmod 3 is enough to imply that 6b6 \mid b (check it!). Moreover, p=a2ab+b2=(a12b)2+27(16b)2p = a^2-ab+b^2 = \left( a - \frac{1}{2} b \right)^2 + 27 \left( \frac16b \right)^2 as desired. \Box

7.2. Quartic reciprocity

This time we work in Z[i]\mathbb Z[i], for which there are four units ±1\pm 1, ±i\pm i. A prime is primary if π1(mod2+2i)\pi \equiv 1 \pmod{2+2i}; every prime not dividing 2=i(1+i)22 = -i(1+i)^2 has a unique associate which is primary. Then we can as before define

α14(Nπ1)(απ)4(modπ){±1,±i} \alpha^{\frac14(N\pi-1)} \equiv \left( \frac{\alpha}{\pi} \right)_4 \pmod{\pi} \in \left\{ \pm 1, \pm i \right\}

where π\pi is primary, and α\alpha is nonzero mod π\pi. As before p1(mod4)p \equiv 1 \pmod 4, p=ππp = \pi\overline{\pi} we have that aa is a quartic residue modulo pp if and only if (a/π)4=1\left( a/\pi \right)_4 = 1 thanks to the isomorphism Z[i]/πZ[i]Z/pZ.\mathbb Z[i] / \pi \mathbb Z[i] \cong \mathbb Z / p \mathbb Z. Now we have

Theorem 30 (Quartic reciprocity)

If π\pi and θ\theta are distinct primary primes in Z[i]\mathbb Z[i] then

(θπ)4=(πθ)4(1)116(Nθ1)(Nπ1). \left( \frac{\theta}{\pi} \right)_4 = \left( \frac{\pi}{\theta} \right)_4 (-1)^{\frac{1}{16}(N\theta-1)(N\pi-1)}.

We also have supplementary laws that state that if π=a+bi\pi = a+bi is primary, then

(iπ)4=i12(a1)and(1+iπ)4=i14(abb21). \left( \frac{i}{\pi} \right)_4 = i^{-\frac{1}{2}(a-1)} \qquad\text{and}\qquad \left( \frac{1+i}{\pi} \right)_4 = i^{\frac14(a-b-b^2-1)}.

Again, the first law handles units, and the second law handles the prime divisors of 22. The corollary we care about this time in fact uses only the supplemental laws:

Corollary 31 (When 22 is a quartic residue)

Let p1(mod4)p \equiv 1 \pmod 4 be a prime, and put p=ππp = \pi\overline{\pi} with π=a+bi\pi = a+bi primary. Then (2π)4=ib/2\left( \frac{2}{\pi} \right)_4 = i^{-b/2} and in particular 22 is a quartic residue modulo pp if and only if b0(mod8)b \equiv 0 \pmod 8.

Proof: Note that 2=i3(1+i)22 = i^3(1+i)^2 and applying the above. Therefore

(2π)4=(iπ)43(1+iπ)42=i32(a1)i12(abb21)=i(a1)12b(b+1). \left( \frac{2}{\pi} \right)_4 = \left( \frac{i}{\pi} \right)_4^3 \left( \frac{1+i}{\pi} \right)_4^2 = i^{-\frac32(a-1)} \cdot i^{\frac12(a-b-b^2-1)} = i^{-(a-1) - \frac{1}{2} b(b+1)}.

Now we assumed a+bia+bi is primary. We claim that a1+12b20(mod4).a - 1 + \frac{1}{2} b^2 \equiv 0 \pmod 4. Note that since (a+bi)1(a+bi)-1 was is divisible by 2+2i2+2i, hence N(2+2i)=8N(2+2i)=8 divides (a1)2+b2(a-1)^2+b^2. Thus 2(a1)+b22(a1)+(a1)2(a1)(a3)0(mod8)2(a-1) + b^2 \equiv 2(a-1) + (a-1)^2 \equiv (a-1)(a-3) \equiv 0 \pmod 8 since aa is odd and bb is even. Finally,

(2π)4=i(a1)12b(b+1)=i12b+(a1+12b2)i12b(modp). \left( \frac{2}{\pi} \right)_4 = i^{-(a-1) - \frac{1}{2} b(b+1)} = i^{-\frac{1}{2} b + (a-1+\frac{1}{2} b^2)} \equiv i^{-\frac{1}{2} b} \pmod p.

\Box

From here we quickly deduce

Theorem 32 (On p=x2+64y2p = x^2+64y^2)

If p>2p > 2 is prime, then p=x2+64y2p = x^2+64y^2 if and only if p1(mod4)p \equiv 1 \pmod 4 and 22 is a quartic residue modulo pp.