Suppose first that a simple continued fraction is eventually periodic. Its periodic tail is fixed by the Möbius transformation represented by the continued-fraction matrix of one full period:
Thus
The infinite tail is not rational, since a rational simple continued fraction terminates. Hence is a quadratic irrational, and the finite initial block expresses the original number as another rational Möbius transform of . Therefore every eventually periodic simple continued fraction represents a quadratic irrational.
For the purely periodic fraction ,
so . Positivity selects
Apply the continued-fraction algorithm to :
The complete quotient then repeats, giving
The convergents through one term before the final are
The last of these satisfies the Pell equation
so a positive solution is
Write the continued fraction as and define its convergents by
Induction using these recurrences gives
In particular, consecutive convergents have coprime numerator and denominator. The standard best-approximation consequence of the same determinant identity is that, for and ,
Dividing by gives
The contrapositive proves that any strictly better approximation has .
For , the continued-fraction algorithm gives
and the remainder then repeats. Hence
The convergent supplies a solution of the Pell equation:
First suppose for every complex embedding. The coefficients of the monic polynomial
are rational algebraic integers and hence integers. They are uniformly bounded in , because each is an elementary symmetric sum of numbers of modulus one. Only finitely many such integer polynomials can occur, so only finitely many algebraic integers occur. Two powers coincide; since , this gives . Thus is a root of unity. This is Kronecker theorem on algebraic integers in the unit disk.
The second printed assertion is literally false for . For the intended statement with , use the Minkowski embedding: algebraic integers of form a lattice, so only finitely many have all conjugates of modulus at most . A nonzero algebraic integer with every conjugate of modulus at most one has
so every conjugate has modulus one and the first part applies. Consequently every non-root in that finite box has . Choose no larger than the least of these finitely many maxima, taking if there are no non-roots. Then every nonzero satisfying for all is a root of unity.
Dirichlet unit theorem states that for signature ,
and the logarithmic embedding of number field units maps the free part to a full lattice in the hyperplane where the weighted coordinate sum is zero.
For a real quadratic field, the roots of unity are and the logarithms of positive units form a nonzero discrete subgroup . Its smallest positive element is for a unit . Given any positive unit , choose so that ; minimality forces the quotient to be . Applying signs and inverses shows
Since , the ring of integers of a quadratic field is . A unit satisfies the Pell equation . The element
has norm . To prove it is the smallest unit above one without invoking the continued-fraction algorithm, suppose . Replacing by its inverse or negative if needed makes , and the conjugate relation implies , so . For , the numbers are respectively
Only the last list contains a square, namely , which yields the endpoint itself. Hence no smaller unit exists and