In mathematics, a quadratic field is a field extension K/Q of the form

${\displaystyle K=\mathbb {Q} ({\sqrt {d}})}$

where d is a non-zero rational number. Such extensions run over all field extensions of the rational number field that are of degree 2 (quadratic extensions). If d > 0 this is called a real quadratic field, and for d < 0 an imaginary quadratic field. Such fields are a basic class of examples in algebraic number theory. They have been studied in great depth, initially as part of the theory of quadratic forms. There remain some unsolved problems.

We can take d to be an integer. In fact d can be changed by any perfect square, so that to get all the fields exactly once we should take representative d up to squares. That is, we may take d to be a square free integer, positive or negative. The discriminant of the corresponding quadratic field is then d, if d is congruent to 1 modulo 4, and otherwise 4d.

For example, when d is −1 so that K is the field of so-called Gaussian rationals, the discriminant is −4. The reason for the definition relates to general algebraic number theory; the algebraic integers in K are spanned by 1 and the square root of d only in the second case, and in the first case there are such integers that lie at half the 'lattice points' (for example, when d = −3 the complex cube roots of unity).

## The quadratic subfield of the prime cyclotomic field

A classical example of the construction of a quadratic field is to take the unique quadratic field inside the cyclotomic field generated by a primitive p-th root of unity, with p a prime number > 2. The uniqueness is a consequence of Galois theory, there being a unique subgroup of index 2 in the Galois group over Q. As explained at Gaussian period, the discriminant of the quadratic field is p for p = 4n + 1 and −p for p = 4n + 3. This can also be predicted from enough ramification theory. In fact p is the only prime that ramifies in the cyclotomic field, so that p is the only prime that can divide the quadratic field discriminant. That rules out the 'other' discriminants −4p and 4p in the respective cases.

If one takes the other cyclotomic fields, they have Galois groups with extra 2-torsion, and so contain at least three quadratic fields.

## Prime factorization into ideals

Any prime number p gives rise to an ideal p.OK in the ring of integers OK of a quadratic field K. In line with general theory, this may be

1. a prime ideal, or
2. a product of two distinct prime ideals of OK, or
3. the square of a prime ideal of OK.

The third case happens only for the primes dividing the discriminant. The other two cases both occur, as p varies, and in a certain sense are equally likely. The second case is called p splitting, and the first case p remaining inert. The first case corresponds to the quotient ring

OK/p.OK

being a finite field with p2 elements, the second to it being a product of two finite fields each with p elements. In the third case, p is said to ramify, and the quotient ring contains non-zero nilpotent elements.