In this section I'll consider continued fractions for quadratic
irrationals of the form
, where d is a positive integer
which is not a perfect square. Let's recall some earlier results
we'll need.
We have an algorithm for constructing the continued fraction for a
quadratic irrational. Suppose a quadratic irrational has been written
in the form
, where:
(a)
and
.
(b)
.
(c) d is a positive integer which is not a perfect square.
Set
Then for
, define (in order)
The continued fraction for x is
, and it is known to be
periodic.
In the case of
where d is a
positive integer which is not a perfect square, I may take
and
.
The main result establishes the form of the continued fraction for
. To state it, I
need a definition.
Definition. A sequence of numbers
is
palindromic if
for
.
The empty sequence is considered to be palindromic.
For example, the following sequences are palindromic:
Theorem. Let d be a positive integer which is not a perfect square.
(a) The continued fraction for
has the form
(b) The sequence
is palindromic.
To illustrate, here is the continued fraction for
:
Note that
, and
is palindromic.
Likewise,
Note that
and
is palindromic.
The proof of the theorem will use two theorems of Galois on purely periodic continued fractions which we proved earlier:
Proof. (a) Step 1.
We'll show: The continued fraction for
is purely periodic.
Recall that
denotes the
greatest integer function.
Since d is a positive integer and is not a perfect square,
and
The conjugate is
. Since
is not an integer,
The first of these two inequalities gives
. The second of
these two inequalities gives
All together, the conjugate satisfies
We showed above that
, so the
hypotheses of the first of Galois's theorems is satisfied. Hence,
is purely periodic.
This completes the proof of Step 1.
Step 2. We'll show: The continued fraction for
has the form
Suppose the period of the continued fraction for
is n. We write
Then
Thus,
Note that this is purely periodic, as we knew from Step 1. Moreover,
it shows that if the period for the continued fraction for
is n, the same is true for the
continued fraction for
.
Subtract
from both sides
to obtain
That is, the repeating part is
. The
continued fraction has the form claimed.
Note that the infinite continued fraction for an irrational number is
unique. So
, ...,
are the same a's we'd have
obtained if we'd computed the continued fraction for
using the standard algorithm.
This completes the proof of part (a).
(b) By the proof of (a), the continued fraction for
is purely periodic.
So suppose that
I showed in the proof of (a) that
Since
is
purely periodic, the second theorem of Galois shows that
is purely periodic, and
But
Hence,
Equating the terms in two expressions for
, I obtain the equations
This shows that the sequence
is palindromic.
The following refinement of the Theorem will be used in our discussion of the Fermat-Pell equation. We refer to the algorithm for the continued fraction of a quadratic irrational --- "the quadratic irrational algorithm", for short --- described at the beginning of this section.
Proposition. Let d be a positive integer which is not a perfect square. Suppose the quadratic irrational algorithm is applied to:
(1)
, producing
sequences
,
,
, and
.
(2)
,
producing sequences
,
,
, and
.
Then:
(a)
for
.
(b)
for
.
(c)
for
.
(d)
for
, and
.
Proof. In the proof of part (a) of the preceding theorem, we showed that
Comparing terms, we see that (d) follows immediately.
In applying the quadratic irrational algorithm as in (1) and (2), we start with
In particular, we have
.
In addition,
Thus,
,
, and
.
Suppose inductively that for some
,
Then
By induction,
for
,
for
, and
for
. This proves (a), (b), and
(c).
Here's an example which illustrates the result. Here are the first
few values of m, s, x, and a for
:
And here are the corresponding values of m, s, x, and a for
:
You can see that the m's, x's, and a's agree beginning with the second line (index 1), and the s's agree from the start (index 0).
Proposition. Let d be a positive integer which
is not a perfect square, and suppose
has period n:
Suppose the quadratic irrational algorithm is applied to
, generating sequences
,
, and
. Then:
(a)
is purely periodic
with period n.
(b)
.
Proof. (a) We saw in the derivation of the
quadratic irrational algorithm that the
's produced by the algorithm are
the same as the
's in the general continued
fraction algorithm --- that is,
in the quadratic irrational
algorithm is the
partial quotient of
. The
's are purely periodic with period
n:
But
Comparing the two expansions, we see that
On the other hand, if the
's repeat in n steps, then
shows that the a's repeat in n
steps as well. So the a's and x's have the same period, and
is purely periodic with period n.
(b) Suppose on the contrary that
where
. Then
Thus,
Hence,
But then
has
period
, contradicting our
assumption that the period is n.
Note that by periodicity,
if
.
The next result will be used in our discussion of the Fermat-Pell equation.
Theorem. Let d be a positive integer which is
not a perfect square. Suppose the period of
is n, so
If the quadratic irrational algorithm is applied to
, generating sequences
,
,
, then:
(a)
if and only if
for
.
(b)
for all i.
Proof. (a) The continued fraction for
is purely periodic with
period n. Consequently, if the quadratic irrational algorithm is
applied for
generating sequences
,
,
, then
for
.
In our discussion of the quadratic irrational algorithm, we showed
that
if and only if
. Hence,
for
. But the second-to-the-last
proposition above shows that
for
. Therefore,
for
.
Conversely, suppose
. Then
If
, we're done. Otherwise,
, so again by the
second-to-the-last proposition above,
Since
is generated from
, an
earlier result shows that the sequence
is purely periodic. By Galois's
theorem, the conjugate of
satisfies
Thus,
. It
follows that
Therefore,
by the preceding
result.
(b) Suppose on the contrary that
. Then
(since
) and
Since
, I have
But
is purely periodic,
so our results on purely periodic continued fractions give
The first inequality gives
, while the second
inequality gives
. Together, these give
, a
contradiction. Therefore,
for all i.
It isn't true in general that for period n we have
. For instance, here's a
quadratic irrational with period 3:
We have:
We don't have
and we don't have
,
, and so on.
Copyright 2026 by Bruce Ikenaga