A quadratic field extension is an extension of dimension 2. Let E/F be such an extension and let u be anything in EF. Now F(u) = E, and u satisfies an irreducible polynomial of degree 2. Such a polynomial is called quadratic, hence we have a quadratic extension.
Conversely, adjoin the root of an irreducible quadratic polynomial to a field F to get an extension E/F of dimension 2. The extension is quadratic iff it is F(u), where u is the root of an irreducible quadratic polynomial.
If F = Q, the rationals, the extension is called a quadratic number field.
If the extension E/F lives in the reals, it is a positive quadratic extension. If the extension brings in complex numbers it is a negative quadratic extension. This terminology comes from the discriminant d of the polynomial p(u), which is positive or negative respectively.
Apply the quadratic formula, and the root u of p(x) is sqrt(d) modified by the coefficients of p, which already live in F. (This assumes F does not have characteristic 2.) Adjoining u produces the same extension as adjoining sqrt(d). All that matters is the value of d.
If two discriminants d1 and d2 have a ratio that is a square in F, then sqrt(d1) is a scale multiple of sqrt(d2). Either spans the other, and they both produce the same extension. The value of d only matters up to the squares in F.
Let R be integrally closed, and let F be the fraction field of R. Multiply u by something in R, so that u becomes algebraic over R. This does not change the field extension. Since R is integrally closed, the minimum polynomial of u is monic with coefficients in R. Thus we can look at polynomials x2 + bx + c, having discriminant d = b24c. If d = v2, with v in F, then v is integral over R, hence in R. We only need ask whether d is a square in R. If yes then the polynomial splits. If not, the extension is quadratic. In summary, a quadratic extension is F adjoin sqrt(d), where d is in R, but d is not a square in R. Beware, the integral ring may not be as simple as R adjoin sqrt(d).
Let R be a pid. Field extensions and their integral rings correspond. This can help characterize both the quadratic field extensions and the integral rings thereof. Then, if we wish, we may explore smaller subrings, although these subrings are not integrally closed, hence they are not dedekind.
Let u be an element in EF. Thus E = F(u). For simplicity, assume u = sqrt(d) for some d in F. Now the conjugate of u is u, and the norm of a+bu is the product of the conjugates, giving a2  db2. The trace is 2a.
Adjoin i, the square root of 1, to Q and to Z. The ring extension is called the gaussian integers, and a geometric argument proves this ring is a ufd. It is therefore integrally closed in its fraction field Q[i]. We have produced our first quadratic extension, along with its integral ring.
Since Z[i] is an integral ring over a pid, it is dedekind, and since it is dedekind and a ufd, it is a pid. Prime ideals and prime elements coincide.
The norm of a+bi is the product of its conjugates, which is a2 + b2. Remember that norm and product commute in any ring extension. If u is a unit, write uv = 1 and take norms to show u is a unit. Conversely, if u is a unit then the product of the conjugates of u, including u itself, is a unit, which makes u a unit.
If x is prime in Z then x is prime in Z[i]. Write x = yz and take norms, and y or z is a unit, whence y or z is a unit. These properties are used to determine when the prime p (in the integers) factors in the gaussian integers. The factorization is completely characterized. 2 factors into 1+i squared, p = 1 mod 4 factors into two distinct conjugate primes, and p = 3 mod 4 remains prime in Z[i].
Since prime elements and prime ideals coincide, the splitting problem has been solved for the gaussian integers. There are three cases: p = 2, p = 1 mod 4, and p = 3 mod 4, as described above. You may want to confirm the degree equation in each case. Multiplicity times ramification degree times residue degree = 2.
Since the splitting problem does not change with localization, we know how p factors in Z[i] localized about p. These are the gaussian rationals without p in the denominator.
Another quadratic extension has been fully characterized, the eisenstein integers. Adjoin (1+sqrt(3))/2 to Z and find a ufd, hence a pid. The prime over 3 is ramified, p = 2 mod 3 is inert, and p = 1 mod 3 splits into two conjugate primes.
Building slightly taller parallelograms in the complex plane, you can adjoin (1+sqrt(7))/2, or (1+sqrt(11))/2, to Z. This builds two more ufds, integral rings inside Q(sqrt(7)) and Q(sqrt(11)) respectively. We haven't investigated primes over primes for these extensions, but we will.
Let F be the fraction field of R, where R is integrally closed. Let 1 and u be a basis for the quadratic extension E/F. As shown earlier, we can assume u is the square root of m for some m in R. If m is divided by a square then the extension F(u) is the same, so assume m is squarefree.
Build a matrix of the traces of the pairwise products of the basis elements and take the determinant to find the discriminant.

det = 4m 
Of course it's easier to use the alternate formula, the square of the differents between the two conjugates. (u  u)2 = 4m.
The integral ring S of E/F/R is trapped between the module spanned by 1 and u, and the module spanned by 1/4m and u/4m. Let x be algebraic over R. Write x as (a + b*sqrt(m))/4m. The conjugate of x satisfies the same monic polynomial. Use these two roots to reverse engineer the polynomial.
The linear coefficient is a/2m. Thus a is something in R times 2m. This makes a/4m an integer or a half integer, (using the term integer as a member of R), or an integer divided by some of the factors of 2 if 2 is not itself prime.
Assume R is a ufd, and move to the constant coefficient a2/16m2  mb2/16m2. The first term is an integer, or a quarter integer, or something in between. Let g be a prime factor of 2 that survives in the denominator of a/4m. If there are j copies of g in the denominator, then the first term has a valuation of 2j relative to g. The second term, b2/16m, must have the same valuation. The valuation of m must be even, and m is square free, hence g does not divide m. That leaves b/4 to have a valuation of j, which means b/4m also has a valuation of j. This is the same as a/4m. We have a common denominator. If one is a half integer than so is the other.
Next assume g does not survive in the denominator of a/4m. If there are k powers of g in 2, then b has at least 2k powers of g. If g divides m, then b has at least 2k+1 powers of g. Either way there are no powers of g in the denominator of b/4m.
In summary, an integral element, written as a linear combination of 1 and u, has coefficients that belong to R, or they share a common denominator that is a factor of 2, and in that case the denominator and m are coprime.
These conditions are necessary, but not sufficient for every ufd. This is because a fraction with g2j in the denominator, minus another fraction with g2j in the denominator, is not guaranteed to lie in R. The valuation does not always fall back to 0.
Watch what happens when R = Z. Assuming half integers, both terms have a common denominator of 4. Pull this out and the first term is 1 mod 4, and the second term is 1/m mod 4. The difference drops to 0 iff m = 1 mod 4. The elements of S take the form a + b×sqrt(m), where m is square free, and a and b are integers, and also half integers if m = 1 mod 4.
When half integers are involved, 1 and sqrt(m) do not build a basis for S as a free Z module. Instead, let u = (1+sqrt(m))/2. Now 1 and u span the integral ring S. Also, the discriminant is m, rather than 4m.
Now go the other direction. If S is an integral ring with a discriminant d0, see if d0 is divisible by 4, and reconstruct m accordingly. Thus d0 determines the quadratic extension of Q and the associated integral ring S over Z.
Let O be an order of S, i.e. a subring inside S, and view O as a Z module. Naturally O contains Z, so mod out by Z and O becomes a subgroup of Z*u, where u is the "other" generator. For each nonnegative integer l there is an order Z cross Zlu. This is a subgroup of S, but we need to prove it is a ring. Multiply two such elements together and show the coefficient on u is still divisible by l. This because u is integral, and u2 becomes an integer times u plus an integer.
The covolume of the sublattice is l, and the discriminant of the order is l2×d0.
Let's try some other base rings. Let R be the gaussian integers, and consider a quadratic extension of R. Let g = 1+i, which is a prime factor of 2. Remember that g2 = 2 (up to associates), and the residue degree of g is 2. Assume g survives in the denominator, hence g does not divide m. A complex number that is coprime to g, such as m, is always 1 mod g, and it is 1 or i mod 2.
Think of x as a/g + (b/g)m, where a and b are odd complex integers. The constant term of the polynomial of x is a2/2  (b2/2)m. Square 1 or i mod 2 and get 1, hence a2 and b2 are 1 mod 2. This only works if m is 1 mod 2. If m is 3i, for example, which is i mod 2, then the extension is already integrally closed, and we cannot supplement by putting g in the denominator.
Let m = 1 mod 2, so that g becomes a valid denominator. What about g2 = 2? Now we're looking mod 4. a2 and b2 come out 1 or 3. m must also be 1 or 3 mod 4, and it determines whether a2 and b2 agree or disagree.
Let R be the eisenstein integers, where 2 is once again prime. There are 12 values mod 4 that are coprime to 2, but only 3 of them are squares: 1, w, and 3w+3. m must be one of these, and it determines the ratio of a2 to b2.
It's time to solve the splitting problem for all quadratic number fields.
In an earlier section we tackled the gaussian integers, but that was relatively easy since the gaussian integers form a pid. With some help from localization, analogous reasoning allows us to characterize the prime ideals of S, the integral ring of E/Q/Z.
Let E = Q[u], where u = sqrt(m). Turn S into a pid by localizing about the prime ideal P, generated by p in Z. This does not change the splitting problem, i.e. the factorization of p*S inside S.
Only prime ideals Q lying over P survive localization. They may be found by searching for their prime generators.
The norm is the same formula we saw before, a+bu = a2  mb2, but this time a and b could be rational, as long as they don't have p in the denominator.
First assume p is odd, and p does not divide m. In the context of this pid, p is composite iff some element f has a norm that is a proper factor of p2, a norm that is an associate of p. Thus f times its conjugate is an associate of p. This means a2  mb2 is divisible by p and not p2. Get a common denominator for a and b, and look at numerators. Now a2  mb2 is divisible by p, and not p2, where a and b are integers. Write a2 = mb2 mod p, whence a = b = 0 (which would make the expression divisible by p2), or m is a square mod p. (We saw this with the gaussian integers; 1 had to be a square mod p).
Conversely, let m be a square mod p. Set a = sqrt(m) mod p and b = 1. Now f times its conjugate is divisible by p, but f is not, as its components are between 1 and p1. We don't have to worry about f = 0, because m is square free. Therefore f is a proper factor of p iff m is a square mod p.
Multiply f by its denominator, so that it is expressed using integer coefficients. Suppose f, a proper factor of p, is an associate of its conjugate. That makes the quotient a unit in SP. Write this as f2/f. The denominator has one factor of p. The numerator includes the term 2abu. Since p does not divide 2, a, or b, the numerator is not divisible by p. The quotient is not part of SP, f and its conjugate are not associates, and P splits into two distinct primes.
Remember that norm equals index, so the residue field of f has size p, just like p in Z. The residue degree is 1, and since there is but one factor of f in p, i.e. p = f times f conjugate, the ramification degree is also 1. This happens across two primes, f and f conjugate, hence the uniform degree equation is satisfied. This is a good sanity check on our work.
Let p = 2, where p still does not divide m. Now a and b are rational with odd denominators, or denominators with one factor of 2 if m = 1 mod 4. Again, we are looking for f = a+bu, with f = 2. Clear any odd denominators, which are units in SP. If b is an even integer than a is also even, and the norm is divisible by 4. A similar result holds if a is even. If a and b are odd integers we can obtain 2 mod 4, but only when m is 3 mod 4. This is illustrated by 1+i lying over 2, when m = 1 (the gaussian integers).
Finally let a and b be half integers. Multiply through by 4, so that a and b become odd integers, and f is 8, but not 16. Write a2 = mb2 mod 8, but not mod 16. An odd square mod 16 is either 1 or 9. Suitable values of a and b can be found iff m = 1 mod 8. When m = 1 mod 16 try a = 3 and b = 1, and when m = 9 mod 16 try a = b = 1. Remember that these must be divided by 2 to get back to f.
Conversely, set a = b = 1 when m = 3 mod 4, a = b = 1/2 when m = 9 mod 16, and a = 3/2 and b = 1/2 when m = 1 mod 16. This creates f with the proper norm. Thus 2 splits iff m = 3 mod 4 or 1 or 9 mod 16.
Assume the aforementioned primes are associates of their conjugates, and see if the quotient is a unit in SP. Write this as f2/f, whence the denominator has one factor of 2. Start with m = 3 mod 4. The second coefficient is 2ab, which becomes ab, which is odd. The first coefficient, a2 + mb2, is divisible by 4, and when 2 is divided out, courtesy of f downstairs, we have an even number. The norm of this quotient is odd, which is a unit, hence this is a unit, and the prime ideals coincide.
With m = 1 mod 8, 2ab becomes a half integer, and ab is a quarter integer, which is not part of the ring. The primes are distinct. To illustrate, if (3+u)/2 and its conjugate are part of the same prime ideal Q then so is their sum, or 3. Since 32 = 1, Q is all of S.
The next item to consider is p dividing m, which was not an issue with m = 1. Since m is square free, m = p*v with p and v coprime. This means pv is a unit in ZP. Set f = p+u and note that f has norm p*(pv). Thus f is a proper factor of p.
Again, ask whether f and its conjugate are associates by looking at f2/f. The quotient looks like p+v + 2u. Its norm is p2+2vp+v2  4m. Since p does not divide v2, this is a unit, and the prime ideals coincide.
Here is a summary of our results.
If p divides m there is one prime Q over P, such that Q2 = P.
If p is odd and m is a square mod p, p is the product of two distinct primes.
If p is odd and m is not a square mod p, p remains prime in S. In other words, p is an inert prime.
If p = 2 and m = 3 mod 4, P = Q2.
If p = 2 and m = 5 mod 8, p remains prime.
If p = 2 and m = 1 mod 8, p is the product of two distinct primes.
Notice that P is ramified iff p divides the discriminant, be it m or 4m.
Pull back from localization and look at the prime ideal Q lying over P. If Q = P then Q remains principal, generated by p. No surprise there, an inert prime is principal. Otherwise Q is generated by f (in S) and p. If f generates p then we have all of Q, so ask whether f generates p. As ideals, {f} times some other ideal equals {p}, and by unique factorization in S, that other ideal is the conjugate of f. Thus Q is principal iff f is an associate of p, or ±p. In other words, Q is principal iff a2  mb2 = ±p for certain integers or half integers a and b.
By the dirichlet unit theorem, a negative quadratic extension has only roots of 1 as units. Picture the extension in the complex plane. Often the square root of m, or even half the square root of m, is too large to fit in the unit circle. Exceptions are sqrt(1), giving the fourth roots of 1, and (1+sqrt(3))/2, giving the sixth roots of 1.
Now consider a positive quadratic extension. This fits in the real line, and the only roots of 1 are ±1. Along with this subgroup of order 2, a fundamental unit u generates a free, cyclic multiplicative group of units.
Plot sqrt(m) along the y axis, as though it were imaginary. S is now a grid of points in this plane, a grid of rectangles determined by integers a and b, a along the x axis and sqrt(m)b along the y axis. If m is 1 mod 4 you must include the half points, i.e. the centers of the rectangles. All units lie on the hyperbola a2  mb2 = ±1, rather than the unit circle. In similar fashion, the associates of w lie on the hyperbola a2  mb2 = ±w. The asymptotes are a = ±sqrt(m)b, two lines that intersect at the origin. The slopes of the asymptotes are steep when m is large.
Looking at the unit hyperbola, points on the left and right branch have norm 1, and points on the upper and lower branch have norm 1. Points inside these branches have norms above 1 and below 1. There are no points of S outside these branches, except for the origin, with norm 0.
1 has norm 1, but does any unit have norm 1? If so then the fundamental unit, that seeds the cycle, must have norm 1, and norms alternate between 1 and 1 through the powers of u. Assume m contains a prime p that is 3 mod 4. Reduce mod p and look for a2 = 1 mod p. There is no such integer, or half integer, hence the fundamental unit u has norm 1. Other values of m admit 1, such as 1+sqrt(2), 2+sqrt(5), 3+sqrt(10), (3+sqrt(13)/2, 4+sqrt(17), etc.
Conjugating u reflects it through the x axis. This is also the inverse of u, an equally valid fundamental unit. Negating u reflects it through the origin. With this in mind, we can search for u in the first quadrant.
Since u is not 1, both of its coordinates are positive. Consider the product of a+b×sqrt(m) times c+d×sqrt(m), where all coefficients are positive. The result is entirely positive, and increasing any one of the four coefficients increases both coefficients on the product. Use as a metric the sum of the two coefficients. If a and b are both ½, as small as they can be, then d becomes (d+c)/2, and c becomes at least (c+d*sqrt(5))/2. (Remember that half integers don't kick in until m = 5.) These sum to more than c+d. The metric increases monotonically with the powers of u. To find u, look for a pair a,b that yields a norm of ±1, having the smallest a+b. Here is a brute force program to do that.
We have stumbled upon a method for solving a class of problems in number theory based on Pell's equation: x^2  my^2 = ±1. Suppose you would like to find all integer solutions to:
a2  73b2 = 24
Find the fundamental unit, in this case 1068+125*sqrt(73). This has a norm of 1, so we will be interested in the even powers of u. Then find any point w with norm 24. 24 is a square mod 73, specifically, 24 is the square of 30, hence 24 splits into two prime ideals. If these ideals are principal then a generator will have norm 24, consistent with the index of the ideal in S. An example is w = 43+5*sqrt(73). So the solution to our equation is w times all the even powers (negative and positive) of u, times ±1.
Adjoin sqrt(m) to the integers, where m is square free, and establish the minkowski bound as [4/π×]sqrt(m)[/2]. The factor 4/π comes in when m is negative, and we divide by 2 when m is 1 mod 4. For m in {1,2,3,7,2,3,5,13} the bound is less than 2. The extension is a ufd.
You can prove other extensions are ufds, you just have to work a little harder. Let m = 173. The bound is 6.576, so consider primes over 2, 3, and 5. Review the splitting rules, and note that 2 does not split. It generates an ideal with index 4, which is within our bound, but it is principal. 3 and 5 are also inert, as 173 is a nonsquare mod 3 and mod 5. Hence the extension is a ufd.
When m = 21 the bound is 2.3, and 2 does not split. When m = 29 the bound is 2.7, and 2 does not split. When m = 53 the bound is 3.64, and 2 and 3 are inert. When m = 77 the bound is 4.387, and 2 and 3 are inert. All these are ufds. Similar calculations confirm 293, 437, 19, 43, 67, and 163.
When an odd prime p splits,m is a square mod p. Let x be the square root of m mod p, and x+u is a multiple of p, though not usually a multiple of p2. (If it is, use x+p+u instead.) Call this w, and w/1 generates the localized image of Q. Thus w and p generate Q. If w generates p then Q is principal. w generates p iff p/w lies in S, iff pw/w has no net denominator. With w = x+u, the second component becomes a fraction if w is anything other than ±p, so just ask whether ±p+m is a square. As you might imagine, this doesn't happen very often, but sometimes it does. How about m = 61, for 61 is a square mod 3, and 61+3 is 8 squared. In other words, the prime lying over 3 is generated by 8+u and is principal. The bound is 3.9, and 2 is no trouble since 61 is 5 mod 8, hence this is another ufd.
Stepping away from quadratics for a moment, let's look at the cube root of 2. This is not a galois extension, and it has a lumpy split. In other words, the uniform degree equation does not apply. One prime over 5 has residue degree 5, and the other has residue degree 25. You can review the calculations here. When I investigated primes over primes, I asserted the extension was a ufd; now we can prove it.
If t is the cube root of 2, t generates an ideal whose cube is 2. The norm of t is 2, and t is a prime ideal in the extension. Localize about 2 and t generates the only prime ideal. When all prime ideals are principal the ring is a pid. The extension is a pid, and with just one prime ideal, it is a dvr. This is integrally closed.
t+1 has norm 3, generating another prime ideal. Its cube is 3*(t2+t+1), and since t2+t+1 is a unit, (1+t)3 = 3, as an equation of ideals. Like 2, 3 is totally ramified. Localize about 3 and find one prime principal ideal, hence a dvr. This too is integrally closed.
The conjugates of t are t times the cube roots of 1. Multiply the pairwise differences and square to get a discriminant of 108. Localize about any prime p other than 2 or 3 and 108 becomes a unit. Thus the extension is integrally closed at p. We've covered all the primes, hence the extension is integrally closed, and the integral ring of Q adjoin the cube root of 2, and dedekind.
The minkowski bound is 2.3, and the prime of index 2 is principal, so the extension is a ufd.
When adjoining the cube root of r, the discriminant is 27r2. The norm of t+1 is r+1, and the norm of t1 is r1. Set r = 3 and the discriminant is a power of 3. The extension is integrally closed at all primes other than 3, and since 3 is totally ramified by t3, the extension is integrally closed, and dedekind.
t1, with norm 2, generates a maximal ideal of index 2. t2+t+1 has norm 4, and (t1) * (t2+t+1) = t31, or 2. The product of these two principal ideals is 2. Take the quotient mod 2, (so we are now working mod 2), and then the quotient mod t2+t+1. This polynomial is irreducible mod 2, hence a finite field of order 4. The ideal generated by t2+t+1 is maximal, and 2 is the product of two principal ideals with residue degrees 2 and 4.
the minkowski bound is 3.46. The primes lying over 2 are principal, and 3 is totally ramified by a principal ideal, hence Z adjoin the cube root of 3 is a ufd.
If you're interested in the cube root of 5, 5 is totally ramified as usual, and the minkowski bound is 5.77, so step back to 2 and 3. t23 has norm 2, and the "other" factor of 2 is 3t2+5t+9. This becomes t2+t+1 mod 2, which is irreducible, giving a field of order 4. Once again the ideals over 2 are principal.
3 could be ramified, and it is. (t2)3 is 3 times the unit 2t2+4t1. This is another ufd.