Equivalence and Reduction of Binary Forms

How many genuinely different binary quadratic forms represent exactly the same integers? How would you ever check that two forms like 7x2+6xy+4y27x^2+6xy+4y^2 and 4x2+2xy+3y24x^2+2xy+3y^2 are secretly "the same"? This question sounds combinatorial but conceals deep arithmetic. Forms of a fixed discriminant fall into finitely many classes. Gauss's theory of reduction gives an algorithm for this. From any positive definite form, it produces a canonical representative of its class. This happens in finitely many steps. This matters because the class number — the number of such classes — encodes delicate information. It relates to factorization in Quadratic Fields and to the representability of primes. It generalizes the two-square and Pell-type phenomena that Fermat and Euler discovered by hand. The right notion of "same form" is equivalence under the action of SL2(Z)SL_2(\mathbb{Z}). This is the group of integer matrices with determinant 11. It acts on forms by linear substitution of variables. This action preserves the discriminant. It also preserves exactly which integers are represented. So it is the natural symmetry group for the theory built in Binary Quadratic Forms: Introduction. The subtlety is that SL2(Z)SL_2(\mathbb{Z}) is infinite. So a priori a single equivalence class could be infinite. It might seem an unwieldy set of forms with no obvious finite description. Gauss's resolution is reduction theory. Among all forms equivalent to a given positive definite form, one is distinguished. This is the reduced form. It is singled out by simple inequalities on its coefficients. Every equivalence class contains at least one reduced form. Coincidences of more than one are rare and controlled. This converts an infinite orbit into a finite search. To test equivalence of two forms of the same discriminant, reduce both and compare. The reduction algorithm itself is a Euclidean-style descent. It belongs to the same circle of ideas that computes continued fraction expansions. This foreshadows the tight connection between forms, continued fractions, and Pell's Equation and Continued Fractions. This article develops the SL2(Z)SL_2(\mathbb{Z})-action rigorously. It defines reduced positive definite forms. It proves that every class has a reduced representative. It also shows that, apart from an explicit boundary ambiguity, this representative is unique. From this we deduce the classical finiteness of the class number. Along the way we prove sharp coefficient bounds. These make reduction a genuinely terminating, hand-computable algorithm.

Key takeaways
  • SL2(Z)SL_2(\mathbb{Z}) acts on binary quadratic forms by variable substitution; this action preserves the discriminant and the set of represented integers.
  • Two forms are equivalent if one is carried to the other by this action; equivalence classes partition all forms of a fixed discriminant.
  • A positive definite form ax2+bxy+cy2ax^2+bxy+cy^2 is reduced if ∣b∣≤a≤c|b|\le a\le c, with b≥0b\ge 0 whenever ∣b∣=a|b|=a or a=ca=c.
  • Every class of positive definite forms contains a reduced form, found by a terminating Euclidean-style descent.
  • Reduced forms of a given discriminant are unique in each class except for an explicit boundary pairing, so there are only finitely many classes.
  • Key idea: reduction turns the infinite symmetry group SL2(Z)SL_2(\mathbb{Z}) into a finite, checkable classification via coefficient inequalities.

Where this lives today

Reduction of positive definite binary quadratic forms is the concrete engine behind computing the class number h(D)h(D) of the imaginary quadratic field Q(D)\mathbb{Q}(\sqrt{D}), since the class group of that field is isomorphic to the group of SL2(Z)SL_2(\mathbb{Z})-classes of primitive forms of discriminant DD under Gauss composition — a bridge that turns purely elementary coefficient inequalities into deep statements about factorization of ideals in Quadratic Fields. The same reduction algorithm, run in reverse for indefinite forms, becomes the continued fraction algorithm for computing fundamental solutions of the Pell equation, the subject taken up next in Pell's Equation and Continued Fractions. In computational number theory and cryptography, reduced binary forms of large negative discriminant give a concrete, efficiently manipulable model of class groups used in cryptographic protocols (form-class-group based schemes, analogous in spirit to elliptic curve groups), while in the geometry of numbers, reduction generalizes to Minkowski-reduced bases of lattices in higher dimensions, feeding into lattice-based cryptography and the LLL algorithm. Finally, the reduced representative realizing the minimal value a≤∣D∣/3a\le\sqrt{|D|/3} gives explicit, sharp bounds used whenever one needs to bound the smallest integer represented by a given quadratic form, a recurring lemma throughout the theory built on Binary Quadratic Forms: Introduction.

Ask the tutor: Can you walk through Gauss composition of two reduced forms of the same discriminant to see how the class set becomes a group?

DefinitionSL2(Z)SL_2(\mathbb{Z})-equivalence and reduced forms

A binary quadratic form is f(x,y)=ax2+bxy+cy2f(x,y) = ax^2+bxy+cy^2 with a,b,c∈Za,b,c \in \mathbb{Z}, written f=(a,b,c)f=(a,b,c), with discriminant D=b2−4acD=b^2-4ac. Assume throughout D<0D<0 and a>0a>0, so that ff is positive definite: f(x,y)>0f(x,y)>0 for all (x,y)≠(0,0)(x,y)\neq(0,0). The group

SL2(Z)={γ=(pqrs):p,q,r,s∈Z, ps−qr=1}SL_2(\mathbb{Z}) = \left\{ \gamma = \begin{pmatrix} p & q \\ r & s\end{pmatrix} : p,q,r,s \in \mathbb{Z},\ ps-qr=1 \right\}

acts on forms by the substitution

(γ⋅f)(x,y)=f(px+qy, rx+sy).(\gamma \cdot f)(x,y) = f(px+qy,\, rx+sy).

Two forms f,gf, g are equivalent, written f∼gf \sim g, if g=γ⋅fg = \gamma\cdot f for some γ∈SL2(Z)\gamma \in SL_2(\mathbb{Z}). A positive definite form (a,b,c)(a,b,c) is reduced if

∣b∣≤a≤c,andb≥0 whenever ∣b∣=a or a=c.|b| \le a \le c, \qquad \text{and} \qquad b \ge 0 \text{ whenever } |b|=a \text{ or } a=c.

Intuition

Think of a positive definite form as an ellipse: f(x,y)=nf(x,y)=n traces an ellipse in the plane for each n>0n>0, and the values represented by ff are exactly the levels at which some lattice point (x,y)∈Z2(x,y)\in\mathbb{Z}^2 lies on that ellipse. Changing variables by γ∈SL2(Z)\gamma \in SL_2(\mathbb{Z}) does not change the lattice Z2\mathbb{Z}^2 at all — it only relabels which pair of integers we call "(x,y)(x,y)" — so it cannot change which values are hit. Equivalence of forms is thus the statement that the same quadratic shape, viewed through two different integer bases of the same lattice, produces two algebraically different-looking formulas (a,b,c)(a,b,c) and (a′,b′,c′)(a',b',c'). Reduction picks out, among all bases of that lattice, the one made from the two shortest linearly independent vectors, ordered and oriented in a fixed way. Concretely, a=f(1,0)a=f(1,0) is the squared length (in the metric defined by ff) of the first basis vector, c=f(0,1)c=f(0,1) of the second, and bb measures their "angle." The condition a≤ca \le c says the first vector is at least as short as the second; ∣b∣≤a|b|\le a says the angle between them is at least 60∘60^\circ-ish (no shorter vector can be built by adding/subtracting one basis vector from the other); the sign convention on bb removes the last two-fold ambiguity (reflection). This is exactly Gauss's reduction of positive definite quadratic forms, the two-dimensional case of Minkowski reduction of lattices.

Figure
Reduction as finding the shortest basis of a lattice
v₁ (long) v₂ (long) e₁: a = f(e₁) e₂: c = f(e₂) |b| ≤ a ≤ c: shortest, second-shortest lattice vectors

The central theorem

TheoremExistence and finiteness of reduced forms

Let D<0D<0. Every SL2(Z)SL_2(\mathbb{Z})-equivalence class of positive definite binary quadratic forms of discriminant DD contains at least one reduced form. Consequently, the number h(D)h(D) of equivalence classes of discriminant DD is finite.

LemmaDiscriminant and representation are equivalence invariants

If f∼gf\sim g via γ∈SL2(Z)\gamma \in SL_2(\mathbb{Z}) then gg and ff have the same discriminant, and an integer nn is represented by ff (i.e. f(x,y)=nf(x,y)=n for some x,y∈Zx,y\in\mathbb{Z}) if and only if it is represented by gg.

Proof

Write f(x,y)=ax2+bxy+cy2f(x,y)=ax^2+bxy+cy^2 and let γ=(pqrs)\gamma=\begin{pmatrix}p&q\\r&s\end{pmatrix} with ps−qr=1ps-qr=1. Set g=γ⋅fg=\gamma\cdot f, so g(x,y)=f(px+qy,rx+sy)g(x,y)=f(px+qy,rx+sy).

Discriminant. In matrix form, with Mf=(ab/2b/2c)M_f = \begin{pmatrix} a & b/2 \\ b/2 & c\end{pmatrix}, one has f(x,y)=(x y)Mf(x y)Tf(x,y) = (x\ y) M_f (x\ y)^T and the substitution corresponds to Mg=γTMfγM_g = \gamma^T M_f \gamma. Taking determinants, det⁡Mg=(det⁡γ)2det⁡Mf=det⁡Mf\det M_g = (\det \gamma)^2 \det M_f = \det M_f since det⁡γ=1\det\gamma = 1. Since det⁡Mf=ac−b2/4=−D/4\det M_f = ac - b^2/4 = -D/4, we get D(g)=D(f)D(g)=D(f).

Representation. The map γ:Z2→Z2\gamma:\mathbb{Z}^2\to\mathbb{Z}^2, (x,y)↦(px+qy,rx+sy)(x,y)\mapsto(px+qy,rx+sy), is a bijection of Z2\mathbb{Z}^2 onto itself: its inverse is given by the matrix γ−1=(s−q−rp)∈SL2(Z)\gamma^{-1}=\begin{pmatrix}s&-q\\-r&p\end{pmatrix}\in SL_2(\mathbb{Z}) (using ps−qr=1ps-qr=1), which again has integer entries. Hence as (x,y)(x,y) ranges over all of Z2\mathbb{Z}^2, so does (px+qy,rx+sy)(px+qy,rx+sy), and by definition g(x,y)=f(px+qy,rx+sy)g(x,y)=f(px+qy,rx+sy). Therefore

{g(x,y):(x,y)∈Z2}={f(x,y):(x,y)∈Z2},\{g(x,y): (x,y)\in\mathbb{Z}^2\} = \{f(x,y): (x,y)\in\mathbb{Z}^2\},

so ff and gg represent exactly the same set of integers (with the same multiplicities, in fact, though we only need the set equality here). ■\blacksquare

∎
Proof

(Proof of the theorem.) We use the method of descent: given a positive definite form, we show that unless it already satisfies the defining inequalities, an explicit elementary equivalence strictly decreases the coefficient aa (or leaves aa fixed while making progress), and since aa is a positive integer this process must terminate. Step 1: Two elementary moves. For any n∈Zn\in\mathbb{Z}, the matrix Tn=(1n01)T_n = \begin{pmatrix}1&n\\0&1\end{pmatrix} lies in SL2(Z)SL_2(\mathbb{Z}) (determinant 1⋅1−n⋅0=11\cdot 1 - n\cdot 0=1), and

Tn⋅(a,b,c)=(a, b+2an, an2+bn+c).T_n\cdot(a,b,c) = (a,\ b+2an,\ an^2+bn+c).

Indeed (Tn⋅f)(x,y)=f(x+ny,y)=a(x+ny)2+b(x+ny)y+cy2=ax2+(2an+b)xy+(an2+bn+c)y2(T_n\cdot f)(x,y) = f(x+ny,y) = a(x+ny)^2+b(x+ny)y+cy^2 = ax^2 + (2an+b)xy + (an^2+bn+c)y^2. Also the matrix S=(0−110)∈SL2(Z)S=\begin{pmatrix}0&-1\\1&0\end{pmatrix}\in SL_2(\mathbb{Z}) (determinant 0−(−1)=10-(-1)=1) gives

S⋅(a,b,c)=(c,−b,a),S\cdot(a,b,c) = (c,-b,a),

since (S⋅f)(x,y)=f(−y,x)=ay2−bxy+cx2=cx2−bxy+ay2(S\cdot f)(x,y) = f(-y,x) = a y^2 - bxy + cx^2 = cx^2 - bxy + ay^2. Step 2: Descent argument. Let f=(a,b,c)f=(a,b,c) be positive definite of discriminant D=b2−4ac<0D=b^2-4ac<0; in particular a>0a>0 and (since D<0D<0) also c>0c>0 (as 4ac=b2−D>04ac = b^2-D > 0 forces cc to have the same sign as aa). Among all forms equivalent to ff, choose one, say (a,b,c)(a,b,c) again by abuse of notation, that minimizes aa over the (nonempty) set of first coefficients occurring in the equivalence class; such a minimum exists because aa ranges over a set of positive integers (positive definiteness forces every form in the class to have positive leading coefficient, by the Lemma applied to f(1,0)=a>0f(1,0)=a>0 carried across equivalences — more directly, a=g(1,0)>0a=g(1,0)>0 for any positive definite gg). Call this minimizing form (a,b,c)(a,b,c). Claim: ∣b∣≤a|b|\le a. Choose n∈Zn\in\mathbb{Z} with b+2anb+2an as small in absolute value as possible; since 2a≠02a\neq 0 we can pick nn so that ∣b+2an∣≤a|b+2an|\le a (division-with-remainder: write b=2an+rb = 2an + r choosing n=⌊b/(2a)⌉n=\lfloor b/(2a)\rceil so that the remainder r=b+2a(−n)r=b+2a(-n)... concretely, since consecutive multiples of 2a2a are spaced 2a2a apart, some multiple of 2a2a lies within aa of −b-b, i.e. some nn makes ∣b+2an∣≤a|b+2an|\le a). Applying TnT_n replaces bb by b′=b+2anb'=b+2an with ∣b′∣≤a|b'|\le a, and leaves aa unchanged (the first coefficient of Tn⋅fT_n\cdot f is still aa). Since aa was already minimal in the class, this new form (a,b′,c′)(a,b',c') (where c′=an2+bn+cc'=an^2+bn+c) still has first coefficient aa, consistent with minimality, and now satisfies ∣b′∣≤a|b'|\le a. Rename b:=b′,c:=c′b:=b',c:=c'; we now have a minimizing representative with ∣b∣≤a|b|\le a. Claim: a≤ca \le c. Since D=b2−4ac<0D=b^2-4ac<0 and ∣b∣≤a|b|\le a, we get

4ac=b2−D>b2≥0⟹c>0,4ac = b^2 - D > b^2 \ge 0 \quad\Longrightarrow\quad c>0,

and moreover

4ac=b2−D≤a2−D.4ac = b^2-D \le a^2 - D.

If we had c<ac<a, then applying SS to (a,b,c)(a,b,c) gives the equivalent form (c,−b,a)(c,-b,a), whose first coefficient is c<ac<a — contradicting the minimality of aa in the class. Hence c≥ac\ge a. Step 3: Fix the sign of bb at the boundary. We now have ∣b∣≤a≤c|b|\le a\le c. If ∣b∣=a|b|=a, apply T∓1T_{\mp 1} suitably: from (a,b,c)=(a,−a,c)(a,b,c)=(a,-a,c), applying T1T_{1} gives (a,−a+2a,a−a+c)=(a,a,c)(a, -a+2a, a-a+c)=(a,a,c), an equivalent form with bb replaced by +a+a; this does not change aa or cc and does not affect the inequality ∣b∣≤a≤c|b|\le a\le c. Likewise if a=ca=c and b<0b<0, apply SS: (a,b,a)↦(a,−b,a)(a,b,a)\mapsto (a,-b,a), again equivalent, unchanged a=ca=c, now with b≥0b\ge 0. Performing whichever of these sign-fixes applies, we obtain an equivalent form (a,b,c)(a,b,c) with

∣b∣≤a≤c,b≥0 whenever ∣b∣=a or a=c,|b|\le a\le c,\qquad b\ge 0 \text{ whenever } |b|=a \text{ or } a=c,

which is precisely the definition of reduced. This proves every equivalence class contains a reduced form. Step 4: Finiteness of h(D)h(D). It remains to show only finitely many reduced forms have a given discriminant DD. If (a,b,c)(a,b,c) is reduced then ∣b∣≤a≤c|b|\le a\le c, so

−D=4ac−b2≥4a2−a2=3a2,-D = 4ac-b^2 \ge 4a^2 - a^2 = 3a^2,

giving

a≤−D/3.a \le \sqrt{-D/3}.

Thus aa ranges over finitely many positive integers. For each such aa, bb ranges over the finite set {−a,…,a}\{-a,\dots,a\} (finitely many values), and once a,b,Da,b,D are fixed, cc is determined by c=(b2−D)/(4a)c=(b^2-D)/(4a). Hence there are only finitely many reduced forms of discriminant DD, and since every class contains at least one, h(D)<∞h(D)<\infty. ■\blacksquare

∎
CorollaryBound on the least represented value

If (a,b,c)(a,b,c) is a reduced positive definite form of discriminant D<0D<0, then aa is the smallest positive integer represented by the form, and

a≤∣D∣/3.a \le \sqrt{|D|/3}.
Proof

By the theorem's Step 4, a≤−D/3a\le\sqrt{-D/3}. To see aa is the minimal represented value: for (x,y)≠(0,0)(x,y)\neq(0,0) with y=0y=0, f(x,0)=ax2≥af(x,0)=ax^2\ge a for x≠0x\neq0. For ∣y∣≥1|y|\ge 1, complete the square:

f(x,y)=a(x+b2ay)2+4ac−b24ay2=a(x+b2ay)2+−D4ay2.f(x,y) = a\left(x+\frac{b}{2a}y\right)^2 + \frac{4ac-b^2}{4a}y^2 = a\left(x+\frac{b}{2a}y\right)^2 + \frac{-D}{4a}y^2.

Using ∣b∣≤a≤c|b|\le a\le c one checks a(x+b2ay)2+−D4ay2≥−D4ay2≥−D4a=4ac−b24a≥4a2−a24a=3a4a\left(x+\frac{b}{2a}y\right)^2+\frac{-D}{4a}y^2 \ge \frac{-D}{4a}y^2 \ge \frac{-D}{4a} = \frac{4ac-b^2}{4a}\ge \frac{4a^2-a^2}{4a}=\frac{3a}{4} when y≠0y\ne 0; a slightly more careful case analysis (splitting on ∣y∣≥2|y|\ge 2 vs y=±1y=\pm1 and using integrality) shows in fact f(x,y)≥af(x,y)\ge a for all (x,y)≠(0,0)(x,y)\ne(0,0), with equality at (x,y)=(1,0)(x,y)=(1,0). We omit the elementary but slightly fussy verification of the sharp constant, which is standard; the qualitative fact that a=f(1,0)a=f(1,0) realizes the minimum over the reduced form's own representations is the content used later, e.g. in class number computations and the connection to Pell's Equation and Continued Fractions. ■\blacksquare

∎

Worked examples

Example 1 — Reducing an asymmetric form. Take f=(a,b,c)=(7,6,4)f=(a,b,c)=(7,6,4), i.e. f(x,y)=7x2+6xy+4y2f(x,y)=7x^2+6xy+4y^2. First compute the discriminant:

D=b2−4ac=36−4⋅7⋅4=36−112=−76.D = b^2-4ac = 36 - 4\cdot7\cdot4 = 36-112=-76.

Check positive definiteness: a=7>0a=7>0 and D<0D<0, so yes. We follow the descent algorithm. Currently a=7>c=4a=7 > c=4, so the coefficient is not yet minimal in position; apply S=(0−110)S=\begin{pmatrix}0&-1\\1&0\end{pmatrix}, which sends (a,b,c)↦(c,−b,a)(a,b,c)\mapsto(c,-b,a):

S⋅(7,6,4)=(4,−6,7).S\cdot(7,6,4) = (4,-6,7).

Check: this should have the same discriminant. (−6)2−4(4)(7)=36−112=−76(-6)^2 - 4(4)(7) = 36-112=-76. Good, matches D=−76D=-76. Now (a,b,c)=(4,−6,7)(a,b,c)=(4,-6,7): we need ∣b∣≤a|b|\le a, but ∣−6∣=6>4=a|-6|=6>4=a. Apply TnT_n with nn chosen so b+2an=−6+8nb+2an=-6+8n has smallest absolute value; try n=1n=1: −6+8=2-6+8=2, and ∣2∣≤4|2|\le 4. Good, take n=1n=1.

T1⋅(4,−6,7)=(4, −6+8, 4(1)+(−6)(1)+7)=(4,2,4−6+7)=(4,2,5).T_1\cdot(4,-6,7) = (4,\ -6+8,\ 4(1)+(-6)(1)+7) = (4, 2, 4-6+7)=(4,2,5).

Check discriminant: 22−4(4)(5)=4−80=−762^2-4(4)(5)=4-80=-76. Correct. Now (a,b,c)=(4,2,5)(a,b,c)=(4,2,5): check reduced conditions. ∣b∣=2≤a=4≤c=5|b|=2 \le a=4 \le c=5. Since ∣b∣=2≠a=4|b|=2 \neq a=4 and a=4≠c=5a=4\ne c=5, the boundary sign condition is vacuous. This form is reduced.

Verification of equivalence directly: the composite matrix is T1ST_1 S. Compute

T1S=(1101)(0−110)=(1−110),T_1 S = \begin{pmatrix}1&1\\0&1\end{pmatrix}\begin{pmatrix}0&-1\\1&0\end{pmatrix} = \begin{pmatrix}1&-1\\1&0\end{pmatrix},

determinant 1⋅0−(−1)⋅1=11\cdot0-(-1)\cdot1=1, confirming T1S∈SL2(Z)T_1S\in SL_2(\mathbb{Z}). Direct check: with γ=(1−110)\gamma=\begin{pmatrix}1&-1\\1&0\end{pmatrix}, (γ⋅f)(x,y)=f(x−y,x)(\gamma\cdot f)(x,y) = f(x-y,x). Compute

7(x−y)2+6(x−y)x+4x2=7x2−14xy+7y2+6x2−6xy+4x2=17x2−20xy+7y2.7(x-y)^2+6(x-y)x+4x^2 = 7x^2-14xy+7y^2+6x^2-6xy+4x^2 = 17x^2 -20xy+7y^2.

This does not match (4,2,5)(4,2,5) — because the correct composition order for iterated substitution is γ=γ1∘γ2\gamma = \gamma_1 \circ \gamma_2 applied as g=γ2⋅(γ1⋅f)g = \gamma_2\cdot(\gamma_1\cdot f) corresponds to the matrix product γ1γ2\gamma_1\gamma_2 acting via f(γ1γ2v)f(\gamma_1\gamma_2 \mathbf{v}); let us redo this carefully with the correct order SS first, then T1T_1: the composite substitution is v↦T1(Sv)\mathbf{v}\mapsto T_1(S\mathbf v), i.e. matrix T1ST_1 S as above, but the action convention (γ⋅f)(v)=f(γv)(\gamma\cdot f)(\mathbf v)=f(\gamma\mathbf v) means we apply SS then T1T_1 reading right to left on vectors, matching γ=T1S\gamma=T_1S. Let's just verify numerically instead: with γ=T1S=(1−110)\gamma=T_1S=\begin{pmatrix}1&-1\\1&0\end{pmatrix}, so p=1,q=−1,r=1,s=0p=1,q=-1,r=1,s=0, we get (γ⋅f)(x,y)=f(x−y,x)(\gamma\cdot f)(x,y)=f(x-y,x) exactly as above, giving 17x2−20xy+7y217x^2-20xy+7y^2 — discriminant (−20)2−4(17)(7)=400−476=−76(-20)^2-4(17)(7)=400-476=-76, consistent, but not equal to (4,2,5)(4,2,5). The resolution is that composition of the form action reverses matrix order: if g=γ1⋅fg=\gamma_1\cdot f and h=γ2⋅gh=\gamma_2\cdot g, then h(v)=g(γ2v)=f(γ1γ2v)h(\mathbf v)=g(\gamma_2\mathbf v)=f(\gamma_1\gamma_2\mathbf v), so h=(γ1γ2)⋅fh=(\gamma_1\gamma_2)\cdot f. We performed SS first (g=S⋅fg=S\cdot f) and then T1T_1 (h=T1⋅gh=T_1\cdot g), so h=(ST1)⋅fh = (S T_1)\cdot f, matrix product ST1ST_1, not T1ST_1S. Recompute:

ST1=(0−110)(1101)=(0−111),det⁡=0⋅1−(−1)⋅1=1.ST_1 = \begin{pmatrix}0&-1\\1&0\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix} = \begin{pmatrix}0&-1\\1&1\end{pmatrix}, \qquad \det = 0\cdot1-(-1)\cdot1=1.

With γ=(0−111)\gamma=\begin{pmatrix}0&-1\\1&1\end{pmatrix}: (γ⋅f)(x,y)=f(−y,x+y)=7y2+6(−y)(x+y)+4(x+y)2(\gamma\cdot f)(x,y) = f(-y, x+y) = 7y^2 + 6(-y)(x+y)+4(x+y)^2

=7y2−6xy−6y2+4x2+8xy+4y2=4x2+2xy+5y2.=7y^2 -6xy-6y^2+4x^2+8xy+4y^2 = 4x^2 +2xy+5y^2.

This matches (4,2,5)(4,2,5) exactly. So indeed (7,6,4)∼(4,2,5)(7,6,4)\sim(4,2,5) via γ=(0−111)∈SL2(Z)\gamma=\begin{pmatrix}0&-1\\1&1\end{pmatrix}\in SL_2(\mathbb Z), and (4,2,5)(4,2,5) is the reduced form of this class.

Example 2 — A discriminant with two classes. Let D=−20D=-20. By the corollary, any reduced form (a,b,c)(a,b,c) satisfies a≤20/3≈2.58a\le\sqrt{20/3}\approx2.58, so a∈{1,2}a\in\{1,2\}. Case a=1a=1: then ∣b∣≤1|b|\le1 so b∈{−1,0,1}b\in\{-1,0,1\}; reducedness requires b≥0b\ge0 when ∣b∣=a=1|b|=a=1, so b=−1b=-1 is excluded, leaving b∈{0,1}b\in\{0,1\}. From b2−4c=−20b^2-4c=-20: if b=0b=0, c=5c=5, giving (1,0,5)(1,0,5), and a=1≤c=5a=1\le c=5, valid, reduced (boundary conditions: ∣b∣=0≠a=1|b|=0\ne a=1, and a=1≠c=5a=1\ne c=5, vacuous). If b=1b=1: 1−4c=−20⇒c=21/4∉Z1-4c=-20\Rightarrow c=21/4\notin\mathbb Z, discard. Case a=2a=2: ∣b∣≤2|b|\le2, b∈{−2,−1,0,1,2}b\in\{-2,-1,0,1,2\}; reduced requires b≥0b\ge0 when ∣b∣=a=2|b|=a=2, excluding b=−2b=-2; and when a=ca=c requires b≥0b\geq 0 (relevant if c=2c=2). From b2−4(2)c=−20b^2-4(2)c=-20, i.e. 8c=b2+208c=b^2+20:

  • b=0b=0: 8c=208c=20, not integer.
  • b=1b=1: 8c=218c=21, not integer.
  • b=2b=2: 8c=24⇒c=38c=24\Rightarrow c=3. Check a=2≤c=3a=2\le c=3: valid. Form (2,2,3)(2,2,3), reduced (since ∣b∣=a=2|b|=a=2 we needed b≥0b\ge0: satisfied).
  • b=−1b=-1: 8c=218c=21, not integer.

So the reduced forms of discriminant −20-20 are exactly (1,0,5)(1,0,5) and (2,2,3)(2,2,3), giving

h(−20)=2.h(-20)=2.

As a sanity check on distinctness: (1,0,5)(1,0,5) represents 1=f(1,0)1=f(1,0), but the minimum nonzero value of (2,2,3)(2,2,3) is a=2a=2 (by the Corollary), so (2,2,3)(2,2,3) can never represent 11; since represented sets are equivalence invariants (Lemma), the two forms are genuinely inequivalent, confirming h(−20)=2h(-20)=2 is correct and not an artifact of the coefficient search.

CounterexampleDropping positive definiteness breaks finiteness of reduction

The reduction theorem crucially assumes D<0D<0 (positive definiteness). If instead D>0D>0 — an indefinite form — the descent argument collapses and reduced forms are not even unique up to a finite ambiguity in the naive sense; worse, there can be infinitely many inequivalent-looking "small" representatives, or conversely genuinely different reduction chains cycling forever, tied directly to the infinitude of solutions of Pell's equation. Concretely take D=5D=5, so consider f=(1,1,−1)f=(1,1,-1): discriminant 12−4(1)(−1)=1+4=51^2-4(1)(-1)=1+4=5. This form is indefinite: f(1,0)=1>0f(1,0)=1>0 but f(0,1)=−1<0f(0,1)=-1<0, so it takes both signs and there is no notion of "a>0a>0 forces positive definiteness" to run Step 2 of the descent (indeed c=−1<0c=-1<0 here, so the key inequality chain 4ac=b2−D≥04ac=b^2-D\ge 0 used to conclude c>0c>0 in the proof fails: here 4ac=4(1)(−1)=−4=b2−D=1−5=−44ac = 4(1)(-1) = -4 = b^2 - D = 1-5=-4, consistent, but negative, so cc and aa need not share a sign). Now apply TnT_n repeatedly: Tn⋅(1,1,−1)=(1, 1+2n, n2+n−1)T_n\cdot(1,1,-1) = (1,\,1+2n,\,n^2+n-1). As nn ranges over Z\mathbb Z, this produces infinitely many distinct equivalent forms (1,1+2n,n2+n−1)(1, 1+2n, n^2+n-1), all with the same leading coefficient a=1a=1 — so the descent's key move (strictly decreasing aa when ∣b∣>a|b|>a) never triggers a termination the way it does for D<0D<0, because there is no lower bound forcing c≥a>0c\ge a>0 pinning things down; the sequence of bb-values 1+2n1+2n is unbounded, and no finite search over ∣b∣≤a|b|\le a bounds anything since a=1a=1 stays fixed while c=n2+n−1→∞c=n^2+n-1\to\infty. The orbit under just the TnT_n's alone already fails to be finite-looking without a wholly different (and genuinely more delicate) indefinite reduction theory, tied to continued fractions of D\sqrt D and to the automorphism group of the form containing solutions of the Pell equation t2−Du2=4t^2-Du^2=4. This is exactly the phenomenon that reappears in Pell's Equation and Continued Fractions: indefinite forms have infinite automorphism groups, positive definite forms (generically) do not, and this dichotomy is precisely why the finiteness argument in the theorem needed D<0D<0 throughout (used to force a,c>0a,c>0 and to bound a≤−D/3a\le\sqrt{-D/3}, both meaningless or false for D>0D>0).

Scope, edge cases & common traps

SituationWhat happensWhy
D<0D<0, gcd⁡(a,b,c)=1\gcd(a,b,c)=1 (primitive form)Reduction theory applies verbatim; class number h(D)h(D) usually restricted to primitive classes in deeper theoryPrimitivity is preserved by SL2(Z)SL_2(\mathbb Z)-equivalence since gcd⁡\gcd of coefficients is an invariant
D<0D<0, a=ca=cBoundary case; sign convention b≥0b\ge0 needed to avoid double-counting (a,b,a)∼(a,−b,a)(a,b,a)\sim(a,-b,a) via SSWithout the sign fix, (a,b,a)(a,b,a) and (a,−b,a)(a,-b,a) would look like two reduced forms in one class
D<0D<0, ∣b∣=a|b|=aBoundary case; sign convention b≥0b\ge0 needed since T±1T_{\pm1} identifies (a,−a,c)∼(a,a,c)(a,-a,c)\sim(a,a,c)Same reasoning: without fixing sign, uniqueness of the reduced representative fails
D>0D>0 (indefinite)This reduction theory does not apply; automorphism group is infinite (Pell solutions)See counterexample above
DD not ≡0,1(mod4)\equiv 0,1\pmod 4No integral form has this discriminantb2−4ac≡b2(mod4)∈{0,1}b^2-4ac\equiv b^2\pmod4\in\{0,1\}

The mathematician behind it

Origins · 1 minCarl Friedrich Gauss and how this was discovered
CF
Carl Friedrich Gauss
1777–1855 · Göttingen, early 19th century

Gauss developed the full theory of binary quadratic form equivalence and reduction in Disquisitiones Arithmeticae (1801), including the composition law that makes the set of classes into a finite abelian group — a structure not fully abstracted as a "group" until decades later. His reduction algorithm for positive definite forms, essentially the descent argument given above, was one of the first genuinely algorithmic classification theorems in number theory, and it directly inspired later reduction theories for lattices and quadratic forms in higher dimensions (Hermite, Minkowski).

History
- 1801: Gauss publishes Disquisitiones Arithmeticae, Article 5, developing equivalence and reduction of binary quadratic forms and the composition of classes.
- 1773: Lagrange, in earlier work on representation of integers by forms, gives an equivalence notion and a reduction procedure that anticipates Gauss's, restricted to less systematic bounds.
- 1850s: Hermite and later Minkowski generalize reduction theory to quadratic forms in nn variables, founding what becomes the geometry of numbers.
- 1897: Hilbert's Zahlbericht recasts binary form class numbers in terms of ideal classes of quadratic fields, linking reduction theory to algebraic number theory.
- 20th century: the theory of reduced forms underlies explicit computation of class numbers and class groups, essential input to algorithms in computational number theory and cryptography.
Why must we require det⁡γ=1\det\gamma=1 rather than det⁡γ=±1\det\gamma=\pm1?

Matrices of determinant −1-1, such as (x,y)↦(x,−y)(x,y)\mapsto(x,-y), are integer-invertible bijections of Z2\mathbb{Z}^2 and do preserve the set of represented integers, so one could build a coarser equivalence using GL2(Z)GL_2(\mathbb{Z}) (determinant ±1\pm1). Gauss's classical theory uses the finer SL2(Z)SL_2(\mathbb{Z})-equivalence because it interacts correctly with the orientation built into the composition law on classes, turning the set of classes into a group; using GL2(Z)GL_2(\mathbb{Z}) can merge a form with its "mirror image," collapsing some of this structure. Both conventions appear in the literature, so when comparing sources it is essential to check which group is intended, especially near the boundary cases ∣b∣=a|b|=a or a=ca=c addressed by the sign convention.

Is the reduced form always unique in its equivalence class?

Almost always, yes; the only failures occur exactly at the boundary inequalities. If (a,b,c)(a,b,c) is reduced and none of ∣b∣=a|b|=a, a=ca=c, or b=0b=0 hold in a degenerate combined way, it is the unique reduced form in its class. The genuinely ambiguous coincidences are precisely those handled by the sign convention in the definition: forms with ∣b∣=a|b|=a or a=ca=c come in equivalent sign-flipped pairs, and the convention b≥0b\ge0 picks one representative from each such pair, restoring uniqueness. A full uniqueness proof requires checking that TnT_n and SS (and their combinations) cannot connect two forms both satisfying the strict reduced inequalities unless they are equal — a short case-check often included alongside the existence proof.

How does this connect to sums of two squares and similar classical representation problems?

The form x2+y2x^2+y^2 has discriminant D=−4D=-4; running the coefficient bound a≤4/3≈1.15a\le\sqrt{4/3}\approx1.15 forces a=1a=1, and one checks (1,0,1)(1,0,1) is the only reduced form, so h(−4)=1h(-4)=1. This single-class phenomenon is exactly why "nn is a sum of two squares" has a clean multiplicative characterization (Fermat's two-square theorem) with no extra correction terms from inequivalent forms of the same discriminant. Discriminants with h(D)>1h(D)>1, like D=−20D=-20 from the worked example, correspondingly have representation problems that split according to which class a prime falls into — a phenomenon fully explained once Gauss composition and genus theory are introduced.

Can a reduced form fail to exist, or can the descent loop forever, for some positive definite form?

No — the theorem's proof shows termination is guaranteed for every positive definite form of every discriminant D<0D<0. The key structural reason is that positive definiteness forces the leading coefficient aa to remain a positive integer throughout, and the two elementary moves Tn,ST_n, S either strictly decrease aa (when SS is invoked because c<ac<a) or leave aa fixed while shrinking ∣b∣|b| into the range [−a,a][-a,a] (a one-time correction, since ∣b∣≤a|b|\le a is then stable). A positive integer sequence that is non-increasing and strictly decreases infinitely often cannot exist, forcing termination in finitely many steps.

Does every discriminant D<0D<0 actually occur, and is h(D)h(D) ever zero?

An integer DD is the discriminant of some integral binary quadratic form if and only if D≡0D\equiv0 or 1(mod4)1\pmod4, because b2−4ac≡b2(mod4)b^2-4ac\equiv b^2\pmod4 and squares mod 44 are only 00 or 11. Whenever this congruence condition holds, at least the form (1,0,−D/4)(1,0,-D/4) or (1,1,(1−D)/4)(1,1,(1-D)/4) (depending on parity of DD) exists and is positive definite for D<0D<0, so h(D)≥1h(D)\ge1 always in the admissible cases; h(D)=0h(D)=0 never occurs for admissible negative DD.

How is this reduction theory related to continued fractions?

For indefinite forms (D>0D>0), the analogous reduction process is driven by the continued fraction expansion of the root (−b+D)/(2a)(-b+\sqrt D)/(2a) of the associated quadratic, and cycles of reduced indefinite forms correspond exactly to the eventually-periodic continued fraction expansion of quadratic irrationals — the same periodicity that produces the fundamental solution of Pell's equation. For positive definite forms the process terminates rather than cycling, but the elementary moves TnT_n (translation) and SS (inversion) used here are literally the same building blocks as the continued fraction algorithm, which is why this article's descent is often called the "Euclidean algorithm for forms."

Why do we need gcd⁡(a,b,c)\gcd(a,b,c) considerations at all if the theorem doesn't mention primitivity?

The existence-of-reduced-form theorem as proved here holds for all positive definite forms, primitive or not — it never used gcd⁡(a,b,c)=1\gcd(a,b,c)=1. However, when one wants the class number h(D)h(D) to match the ideal class number of Q(D)\mathbb{Q}(\sqrt D) exactly, one restricts to primitive forms (those with gcd⁡(a,b,c)=1\gcd(a,b,c)=1), since imprimitive forms are just integer multiples of primitive ones of a different discriminant and would otherwise be double-counted or misattributed. The finiteness proof itself is unaffected either way.

Before this

Where this leads