Advanced maths

Positive definite binary quadratic form reduction calculator

Binary quadratic-form reduction searches for a normalized representative under integer unimodular variable changes.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Binary quadratic-form reduction searches for a normalized representative under integer unimodular variable changes. Unlike a real inertia test, this retains the integer lattice. The calculator returns the reduced primitive positive-definite form, discriminant and an exact transformation matrix whose coefficient reconstruction is checked.

THE FORMULAQ(U[X,Y])=a′X²+b′XY+c′Y², det U=1, |b′|≤a′≤c′.

A worked example

The form 2x²+2xy+3y² has discriminant 4−24=−20 and already meets |b|≤a≤c with the required nonnegative boundary sign. Its reduced representative is therefore (2,2,3) with identity transformation. A nonreduced equivalent input can require several shears and variable rotations.

Good to know

Primitive integral positive-definite binary forms only, coefficients within ±1,000,000. Exact determinant-one changes, bounded iterations and explicit reduced-boundary convention. No indefinite reduction, full class-group computation or equivalence classification of every form with that discriminant.

Integer changes preserve the lattice problem

A binary form assigns an integer value to every integer pair when its coefficients are integral. A determinant-one integer variable change bijects those lattice pairs, preserving the represented values while changing coefficient appearance. A real orthogonal diagonalization does not generally preserve integer coordinates and therefore does not solve this equivalence problem.

Positive definiteness requires a positive leading coefficient and a negative discriminant. The page also requires primitive coefficients, meaning their common divisor is one. These are explicit input restrictions; an indefinite form or a nonprimitive scaling is not converted silently into a different supported class before reduction begins.

A reduced binary quadratic form retains its integer latticeQ = 2x²+2xy+3y²Discriminant: −20Reduced: (2,2,3)
The form 2x²+2xy+3y² has discriminant 4−24=−20 and already meets |b|≤a≤c with the required nonnegative boundary sign. Its reduced representative is therefore (2,2,3) with identity transformation. A nonreduced equivalent input can require several shears and variable rotations.

The Quadratic form inertia calculator with congruence transformation covers the nearby task. Real inertia classification does not solve integer unimodular equivalence or canonical binary reduction.

The reduced boundary convention removes ambiguity

Integer shears adjust the middle coefficient while leaving the lattice variable map invertible. Variable rotations exchange the leading and trailing roles without changing determinant one. Repeating these operations reaches the stated inequalities, with an additional sign convention when an equality lies on the boundary of the reduced region.

Several equivalent descriptions can occur on those boundaries unless signs are normalized consistently. The page uses nonnegative middle coefficient when its absolute value equals the leading coefficient or when the leading and trailing coefficients agree. Comparing another package’s representative requires matching that proper-equivalence and boundary convention first.

The transformation is checked exactly

The accumulated matrix is substituted into the original polynomial and its determinant is checked as exactly one. Reconstructed coefficients must equal the returned reduced tuple and retain the original discriminant. These arithmetic checks are stronger than showing that the original and reduced ellipses look similar on a plot.

The default already satisfies reduction, making the identity transformation a valid and informative answer. Other independent tests start from deliberately sheared reduced forms and compare Sage’s reduction. The result does not enumerate an entire class group or prove equivalence of every pair of forms merely because their discriminants happen to match.

Distinguish integer equivalence from real diagonalization

The form is Q(x,y)=ax²+bxy+cy². Positive definiteness requires a>0 and discriminant D=b²−4ac<0. Primitivity requires gcd(a,b,c)=1. Reduction changes integer coordinates using a matrix U with determinant one, preserving the represented integer values and the discriminant.

A real eigenvector rotation can diagonalize the associated symmetric matrix, but usually does not map the integer lattice bijectively to itself. It therefore answers a different question. The reduction certificate states Q(U[X,Y])=Qred(X,Y), with an exact integer U, rather than merely asserting that two real ellipses have the same signature.

Reduce a sheared form by direct substitution

Consider Q(x,y)=2x²+6xy+7y², whose discriminant is 36−56=−20. Set x=X−Y and y=Y. Expanding gives 2X²+2XY+3Y². The transformation matrix [[1,−1],[0,1]] has determinant one, and the new coefficients satisfy |b|≤a≤c.

This agrees with the default reduced triple (2,2,3). For example, old coordinates (x,y)=(0,1) correspond to (X,Y)=(1,1), and both forms evaluate to seven. Such a spot check is useful, but the calculator checks the complete transformed coefficients and determinant exactly, which verifies the identity for every integer pair.

Read the reduced-boundary convention

The inequalities |b|≤a≤c do not by themselves choose signs on every boundary. This page requires b≥0 when |b|=a or a=c. That convention removes duplicate boundary descriptions in the positive-definite reduction procedure. A reference using a different boundary sign convention can display a related representative without contradicting the transformation certificate.

The algorithm alternates integer shears and determinant-one rotations until the convention holds. The returned transformation is a coordinate map from the reduced variables to the original variables; using its inverse in the same formula reverses the claimed identity. Read the printed direction before transporting solutions between the two forms.

Keep the conclusion within one proper-equivalence class

The discriminant alone does not specify a unique equivalence class of primitive forms. Reduction of one supplied form does not enumerate every class at that discriminant, build a class group or solve all representation equations. A reduced triple is a compact representative for the supported equivalence problem, not a classification of every binary quadratic expression.

Indefinite and imprimitive forms have different treatments and are rejected by this form. Dividing coefficients by their gcd changes the represented values even if it creates a primitive form, so record that change if you perform it outside the calculator. Exact integer arithmetic preserves the certificate without rounding, subject to the stated coefficient and iteration limits.

A few questions, answered

Does real diagonalization reduce an integer form?

Not generally. The permitted change must be an integer matrix with determinant one.

Why a sign rule on reduced boundaries?

It chooses a consistent representative when equalities leave sign-related alternatives.

Can I replace the integer transformation with an eigenvector rotation?

Not for integer equivalence. A real rotation need not map integer pairs bijectively to integer pairs; the certificate requires an integer matrix of determinant one.

Does one reduced form enumerate all forms with its discriminant?

No. Other proper-equivalence classes can share the same discriminant. This page reduces one input form.

Find your calculator

Start typing to explore the library.