Advanced maths

Quadratic number field integral basis and discriminant calculator

Determine the maximal quadratic order integral basis and signed field discriminant, then express a rational quadratic element in that basis to test integrality.

Your numbers

Signed squarefree integer within ±1000000,excluding0 and1.
The element is a+b*sqrt(D).
Use an integer,finite decimal or fraction.

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

Determine the maximal quadratic order integral basis and signed field discriminant, then express a rational quadratic element in that basis to test integrality.

THE FORMULAω=(1+√D)/2 if D≡1 mod4, otherwise ω=√D; Δ_K=D or4D respectively

A worked example

For D=5,the maximal integral basis is1,(1+√5)/2 and field discriminant5. The default element has integral coordinates(0,1),trace1 and norm−1.

Good to know

Squarefree signed D within±1000000,excluding0 and1;exact rational element coefficients. Input is a+b√D. Reports maximal order and the index/conductor of Z[√D],not arbitrary-order class groups,units or general number-field integral bases.

Fix the squarefree field parameter

A quadratic number field is Q with the square root of a squarefree integer D adjoined. Positive D gives a real quadratic field and negative D an imaginary quadratic field. The values zero and one do not define degree-two fields and are excluded from this calculator's input domain.

Remove square factors before entering D. For example, Q of square root twenty is the same field as Q of square root five, but the coefficient of the radical changes when rewriting an element. Rejecting nonsquarefree input prevents the field parameter and the element-coordinate convention from drifting apart silently.

The half-integer basis enlarges the quadratic orderω = (1+√5)/2blue: Z[√5]all points: O_K20 = 2² × 5coefficient lattice in (a,b)
Scroll across to see the full diagram.
In coordinates a+b√5, the maximal order contains both the integer lattice Z[√5] and its translate by(1/2,1/2). Thus Z[√5] has index2 and discriminant20,while the field discriminant is5.

Compare this with the Quadratic number field arithmetic calculator with norm and trace. Determine the maximal order integral basis and field discriminant,then test integrality in that basis; arithmetic norm/trace alone does not do this.

Choose the maximal order integral basis

The ring of algebraic integers is a free abelian group of rank two. If D is congruent to one modulo four, its basis is one and the half-sum of one with square root D. In the other squarefree cases, one and square root D already form the maximal integral basis.

The half-sum is integral because it satisfies a monic quadratic with integer coefficients. Looking only for integer coefficients in the original one, square-root basis would miss it. This is why a norm-and-trace arithmetic page alone does not fully communicate the structure of the maximal quadratic order.

Keep field and order discriminants separate

The discriminant of the maximal integral basis is D in the half-sum case and four D otherwise. This signed integer is the field discriminant. The power basis one, square root D always has discriminant four D, which can describe a proper suborder instead of the maximal order.

When D is one modulo four, the suborder Z of square root D has index two in the maximal order, and its discriminant is four times the field discriminant. Otherwise its index is one. The calculator checks this square-index identity exactly and reports the conductor of this particular suborder using the same index.

Convert the entered element to integral coordinates

The input element is a plus b square root D, with rational coefficients. In the half-sum basis, square root D equals two omega minus one, so the new coordinates are a minus b and two b. In the ordinary square-root basis the coordinates remain a and b.

An element is an algebraic integer precisely when both coordinates in the maximal integral basis are integers. This gives a direct exact test with rational arithmetic. Fractions remain fractions until the test, so a denominator cannot disappear through a floating point tolerance or an accidentally rounded decimal display.

Check the golden-ratio example

For D equal to five and a and b both one half, the entered element is omega itself. Its maximal-order coordinates are zero and one, proving integrality despite both original coefficients having denominator two. Its trace is one, and its norm is negative one.

The monic annihilating polynomial is x squared minus x minus one. The field discriminant is five, while the discriminant of the original square-root power basis is twenty. The two lattices differ by index two, which the diagram represents through an additional translated set of coefficient points rather than complex-plane embeddings.

Use trace and norm as companion checks

Conjugation changes the sign of the square-root term, so the trace is two a and the norm is a squared minus D times b squared. These rational values also give the monic quadratic x squared minus trace times x plus norm satisfied by every element of the field.

For a nonrational element this polynomial is its minimal polynomial. If b is zero, the same quadratic is a repeated linear factor and is only an annihilating polynomial; the actual minimal polynomial has degree one. The integrality decision still comes from the maximal-basis coordinates and remains valid in that boundary case.

Do not infer further arithmetic from the basis

An integral basis identifies the maximal order as a lattice, but it does not by itself list its units, ideal classes or prime splitting behavior. A field discriminant is a useful structural invariant rather than an answer to each of those distinct arithmetic problems. Their computations require additional methods and inputs.

The current conductor output refers specifically to Z of square root D inside the maximal order. An arbitrary order of conductor f has basis one and f omega and discriminant f squared times the field discriminant, but no arbitrary conductor selector is implemented here. The declared radicand bound keeps squarefreeness verification finite and exact.

A few questions, answered

Can I enter D=20?

First reduce it to squarefree D=5 and rewrite the element coefficients accordingly.

Can half-integer coefficients describe an integer?

Yes. When D≡1 mod4,the maximal basis includes (1+√D)/2.

Which discriminant is returned first?

The signed field discriminant of the maximal order; the Z[√D] order discriminant is also shown separately.

Does this find units or class numbers?

No. It computes the integral basis,discriminants,element coordinates and integrality test.

Find your calculator

Start typing to explore the library.