continued fractions project 5.11.15
TRANSCRIPT
Math 390 Project Skills
Continued Fractions
Group 2C
Abstract
Within this report we will show the basic properties of continued fractions and how to convert numbers into
continued fractions. We will also introduce the notion of infinite continued fractions and see if and where they
converge. Finally we will see how continued fractions are related to other well known areas of mathematics such
as quadratic irrationals and Pell’s equation.
1 Introduction
So what are continued fractions? Even though they have been around for centruries, the foundations for continued
fractions were only laid in the late 17th century. To put it simply, they are just another way of representing a
real number, rational or irrational, in terms of a sequence of integers. Arising naturally, we shall see the intriguing
secrets they possess coming from trying to solve the famous Pell equation.
The name continued fraction first came about in 1653. Now used to describe the representation of the reals, English
mathematician John Wallis in his Arithmetica infinitorum talked about the idea of continued fractions. Since then
they have grown predominantly in the field of number theory as an alternative way of representing numbers. We
begin with the basics of what actually are continued fractions, and some fundamental features. Our results shall
then take us to Diophantine equations, in particular Pell’s equation, and see what interesting features we can find
along the way.
As you already know, there are many ways of representing numbers; for example decimals, series and fractions.
Each of the systems have unique qualities making them interesting to examine. Take the fractions for example,
then we notice that15
11= 1.36363636 . . .
But we could also express this fraction as 1 411 . We could take this one step further and get
14
11= 1 +
4
11= 1 +
1114
= 1 +1
2 + 34
;
since we can express 114 as 2 + 3
4 . Now we begin to see a glimpse of a new number representation, continued
fractions. What would happen if we continue in this way? And what results would we find? We shall explore these
questions and more in this report.
1
2 Continued fractions
Definition 2.0.1. Continued fractions are all expressions of the form
x = a0 +b0
a1 +b1
a2 + . . .
,
where ai and bi can either be real or complex numbers, for all i, and a0 ≥ 0.
For now we will only address finite continued fractions but will introduce the notion of infinite continued fractions
later.
Definition 2.0.2. A simple continued fraction is the specific case where bi = 1 for all i;
x = a0 +1
a1 +1
a2 + . . .
,
where ai are integers, for all i and a0 ≥ 0. [3]
We can define a finite continued fraction [a0; a1, a2, . . . , an] as follows [11],
[a0; a1, a2, . . . , an] = a0 +1
a1 +1
a2 +1
. . .+1
an
.
Let’s take another look at our first example of the fraction 1511 . We saw that 15
11 = 1 +1
2 + 34
. We proceed in a
similar fashion as before
15
11= 1 +
1
2 +3
4
= 1 +1
2 +143
= 1 +1
2 +1
1 + 13
= [1; 2, 1, 3]
using the notation defined above.
Note, if
x = a0 +b0
a1 +b1
a2 + . . .
,
then a0 is bxc, where bxc is the floor function.
Also observe that none of the ai = 0, with the exception of a0 if x < 1.
2
We can go further with the fraction 1511 by saying:
[1; 2, 1, 3] = 1 +1
2 +1
1 + 13
= 1 +1
2 +1
1 +1
2 + 11
= [1; 2, 1, 2, 1].
Taking a closer look at the last fraction of any finite continued fraction [4] we can see that
1
an=
1
(an − 1) + 1=
1
(an − 1) +1
1
;
so we can end on a 1, i.e [. . . , an] = [. . . , an − 1, 1].
This means the representation of a number as a finite continued fraction need not be unique. We shall not prove
this here but the finite continued fraction form is unique up to the last two terms and there are only two possible
ways of expressing a finite continued fraction: [a0; a1, a2, . . . , an] or [a0; a1, a2, . . . , an − 1, 1].
As we have witnessed, transforming a rational number into the continued fraction form is not difficult. It simply
boils down to breaking up a fraction into an integer part and another fraction, and that’s all there is to it.
3 Euclidian Algorithm
An easier and simpler method lies with the famous mathematician Euclid at around 300 BC, in his book Euclid’s
Elements. The algorithm he described is one of the oldest currently in common use. Principally, it is used to find
the highest common factor of two numbers. But here we shall see another side of the process.
Theorem 3.0.3. (Division with remainder) Given a ∈ Z and d ∈ N, there exist unique q, r ∈ Z such that a = qd+r
and 0 ≤ r < d.
Theorem 3.0.4. (Euclidean Algorithm) Let a and b be integers, b 6= 0 and |a| > |b|, with {r1, . . . , rn−1} ∈ N and
{q1, . . . , qn} ∈ Z. Then the following chain of divisions yields the highest common factor of a and b,
a = bq1 + r1, 0 ≤ r1 < b
b = r1q2 + r2, 0 ≤ r2 < r1
r1 = r2q3 + r3, 0 ≤ r3 < r2...
......
rn−3 = rn−2qn−1 + rn−1, 0 ≤ rn−1 < rn−2
rn−2 = rn−1qn + 0.
Suppose we have a rational number x say, and we wish it to be written as a continued fraction. By the definition
of being rational, we can write x = ab , where a and b are integers. Now we apply the algorithm described above.
From the first line we see thata
b= q1 +
r1b,
3
by dividing through by b. We can rearrange this to get
a
b= q1 +
1br1
.
In the same way
b
r1= q2 +
r2r1
⇒ b
r1= q2 +
1r1r2
.
Generally, we haveab = q1 + r1
b ,
br1
= q2 + r2r1,
r1r2
= q3 + r3r2,
......
rn−3
rn−2= qn−1 + rn−1
rn−2,
rn−2
rn−1= qn + 0.
Hence we have the continued fraction of a rational number which is formed from successive divisions. Note that
the terms of our continued fraction are exactly the quotients from the division.
x =a
b= q0 +
1
q1 +1
q2 +1
. . .+1
qn
= [q0; q1, q2, . . . , qn].
Take the fraction 317 . By the Euclidean algorithm we have
317 = 4 + 3
7 ,
73 = 2 + 1
3 ,
31 = 3 + 0
1 .
And so we have that 317 = [4; 2, 3].
Since the Euclidean algorithm is a finite process, it must eventually terminate when ri = 0. Therefore all rational
numbers can be expressed as finite continued fractions. Furthermore, by the uniqueness property of the Euclidean
algorithm, all of the quotients, and hence the continued fraction expression is unique up to the last two terms.
We have formalised the notion of generating continued fractions. Now we shall discuss the idea of a limit for
continued fractions in the cases of both rationals and irrationals.
4
4 Convergence
The idea of convergence appears in a diverse range of topics within mathematics. It is fundamental in order for
us to build a better understanding of these unique type of number. We shall now address the notion of infinite
continued fractions [5]. This may raise questions of convergence and whether infinite continued fractions have a
meaning [12]. We summarise our concerns in the following theorems, the proofs of which are quite involved, and
so we do not give them here.
Definition 4.0.5. The value of the infinite continued fraction [a0; a1, a2, . . .] is
limk→∞
ck .
Theorem 4.0.6. An infinite continued fraction converges and defines a real number. There is a one-to-one
correspondence between
• all continued fractions [a0; a1, a2, . . .] with an integer a0 and positive integers ak for k > 0 (and the last term
an > 1 in the case of finite continued fractions); and
• real numbers.
It is important to state this theorem. It covers all areas of uncertainty regarding the fundamentals of continued
fractions. Not only does it clarify the notion of the continued fraction, but also addresses underlying uncertainties
regarding uniqueness and convergence of all continued fractions, both finite and infinite. To secure our foundations
upon this subject we shall state here, without proof, the following results.
Theorem 4.0.7. The continued fraction expansion of a real number is finite if and only if the real number is
rational.
Proof. This is a result of the Euclidean algorithm using the division with remainder theorem.
Theorem 4.0.8. The continued fraction expansion of a real number is infinite if and only if the real number is
irrational.
Now we have a sure footing on the topic of continued fractions we can move on to some more interesting properties.
Definition 4.0.9. We define the kth convergent of a continued fraction [a0; a1, a2, . . .] as the value of [a0, a1, a2, . . . , ak]
which is denoted ck.
For example take the number π, then π = [3; 7, 15, 1, 292, 1, 1, 1 . . .]. Then π can be roughly estimated as π ≈[3; 7, 15, 1, 292], [8]. Therefore [3; 7, 15, 1, 292] is the 5th convergent of π.
5
So to get better approximations of our number x say, we take parts of the continued fraction of larger sizes until
we are close enough to x. Going back to our example of π then [3; 7, 15, 1, 292, 1, 1, 1] is a better approximation
than [3; 7, 15, 1, 292]. Hence with each successive convergent we get closer to the number we want to find.
Figure 1: kth convergence of a continued fraction.
From the above figure, we can also see that ck gets smaller for odd values of k and bigger for even values. We may
say c0 < c2 < c4 < . . . < c5 < c3 < c1.
We can express ck as a fraction pkqk
. This means we now have two sequences of real numbers (pk) and (qk), which
together can be used to find the partial sum of an irrational expression.
For example, take√
2. Then we see that√
2 = [1; 2, 2, 2, 2, . . .]. So the convergents are
k 1 2 3 4 5 6 7 8 9
ck32
75
1712
4129
9970
239169
577408
1393985
33632378
pk 3 7 17 41 99 239 577 1393 3363
qk 2 5 12 29 70 169 408 985 2378
We see both the sequences (pk) and (qk) are divergent for our example of an irrational number. However the ratio
of pkqk
converges to√
2. There are more intriguing features of the sequences (pk) and (qk), left for the interested
reader to find.
We have now addressed the key issue of uniqueness and convergence of our sequences of numbers. Although we
have only briefly talked about this topic, all continued fractions do converge to real numbers, and later we will see
that the above expansion of√
2 is in fact true.
6
5 Quadratic Irrationals
Upon initial observation the topic of quadratic irrationals may seem an usual appearance in this report. We shall
soon see how continued fractions can be used to solve monic quadratic equations.
Consider the quadratic equation
x2 − ax− b = 0 ; a, b ∈ Z .
By rearranging and dividing through by x, we can rewrite this as
x = a+b
x.
Now, if we reconstitute in for x on the right hand side, we have an infinite continued fraction
x = a+b
a+b
a+ . . .
.
This means that all monic quadratics can be solved using continued fractions. This is assuming that the solution
is in fact real. If it is complex, then it cannot be represented by a continued fraction. This is because, for our
purposes, a continued fraction can only represent a real number.
Definition 5.0.10. If the function f(x) = ax2 + bx + c = 0 can be solved by the irrational number α, then α is
known as a quadratic irrational; where a, b, c ∈ Z, a 6= 0.
From this definition, it follows from a general quadratic equation that
α =−b±
√d
2a,
where d = b2 − 4ac. Because α is irrational, d cannot be a perfect square and since α is real d > 0.
Definition 5.0.11. Suppose we have the quadratic irrational α = −b+√d
2a and its conjugate α′ = −b−√d
2a . Then α
is said to be reduced if α > 1 and −1α′ > 1.
Rearranging the second inequality from this definition we have the following two conditions for α to a reduced
quadratic irrational:
• α > 1
• −1 < α′ < 0
Consider the quadratic f(x) = 16x2−16x−3. Suppose we have f(α) = 0 for some α. Solving the quadratics yields
α = 2±√7
4 . Notice that 2+√7
4 > 1 and −1 < 2−√7
4 < 0, and so we see α is a reduced quadratic irrational. However,
if we look at the quadratic g(x) = x2 + x − 1. Then g has roots −1±√5
2 which doesn’t satisfy either inequality to
be a reduced quadratic irrational.
7
Definition 5.0.12. A continued fraction is periodic if the sequence ak, ak+1, . . . , ak+n eventually repeats. i.e
[a0, a1, . . . , ak−1, ak, . . . , ak+n, ak, . . . , ak+n, ak, . . . , ak+n, . . .],
This is often abbreviated as
[a0, a1, ..., ak−1, ak, ..., ak+n]
Definition 5.0.13. A continued fraction is purely periodic if a0 = a0+n, a1 = a1+n, a2 = a2+n · · · ak− = ak+n,
i.e
[a0, ..., an]
For example we have the continued fraction of√
2 = [1; 2] which is periodic and the continued fraction of the golden
ratio, [1; 1, 1, 1, . . .] = [1], is purely periodic.
Theorem 5.0.14. An irrational number α is a quadratic irrational if and only if the continued fraction form of α
is periodic.
The proof of this theorem involves recursive relations for the sequences pk and qk and a little algebraic manipulation.
This has been left to the interested reader.
The result means that all real solutions to quadratic equations can be expressed as continued fractions with the
periodic property. It can be deduced that all irrational numbers of the form√d must also be periodic continued
fractions, since√d = b+ 2aα. This brings us onto the next section, square roots.
6 Square roots
So far we have discussed the convergence of rational and irrational numbers. We shall now move on to looking
at square roots of positive integers. For example, let’s begin with a square root√
2. To write this as a continued
fraction, we first notice that 1 <√
2 < 2, so we start with rewriting√
2 as
√2 = 1 +
1
x
for some x > 1. So to find the continued fraction of√
2 we need to find x. Rearranging the equation, we have that
x =1√
2− 1=√
2 + 1.
This means that
x =√
2 + 1 = 1 +1
x+ 1 = 2 +
1
x.
By substituting 2 + 1x wherever we see x, we now have our continued fraction for x:
x = 2 +1
x= 2 +
1
2 +1
x
= . . .
Hence the continued fraction of√
2 is [1; 2].
8
Now we shall take a look at the continued fraction of some other integers d.
d Periodic Continued Fraction of√d Continued Fraction of
√d
2 [1; 2] [1; 2, 2, 2, 2, 2, 2, 2, . . .]
8 [2; 1, 4] [2; 1, 4, 1, 4, 1, 4, . . .]
19 [4; 2, 1, 3, 1, 2, 8] [4; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, . . .]
23 [4; 1, 3, 1, 8] [4; 1, 3, 1, 8, 1, 3, 1, 8, . . .]
45 [6; 1, 2, 2, 2, 1, 12] [6; 1, 2, 2, 2, 1, 12, 1, 2, 2, 2, 1, 12, . . .]
53 [7; 3, 1, 1, 3, 14] [7; 3, 1, 1, 3, 14, 3, 1, 1, 3, 14, . . .]
It is evident that square roots of integers have a periodic continued fraction representation. However, we often
write square roots of numbers in decimal form. In decimal form, there is no sequence visible in the nth decimal
place of the square root. Instead, the continued fraction form gives an interesting repeating pattern.
Moreover, you may notice that the final term of the period is double the first term. We shall see this is always the
case by our next two theorems.
Theorem 6.0.15. Suppose we have a positive non- square integer d. Then the continued fraction of√d is periodic
with√d = [a0; a1, a2, ..., an−1, 2a0] .
Proof. Take b√dc = a0. It follows that
√d + a0 > 1 and −1 < −
√d + a0 < 0. This means a0 +
√d is a
reduced quadratic irrational. By theorem 5.0.14, that the continued fraction form of√d + a0 is purely periodic,
giving us√d + a0 = [2a0; a1, a2, ..., an−1, an]. Equivalently,
√d + a0 = [2a0; a1, a2, ..., an−1, an, 2a0], which implies
√d = [a0; a1, a2, ..., an−1, 2a0].
Theorem 6.0.16. Apart for the term 2a1, the periodic part of the continued fraction of√d is symmetrical.
We shall omit the proof to the second theorem here. The proof to this theorem can be found in notes by Alexandra
Ioana Gliga [2] on Continued Fractions of the Square Root of Prime Numbers. The proof is relatively straight
forward using ideas from this section and the previous one on the periodicity of continued fractions.
9
7 Pell’s equation
As early as 400 BC in India and Greece, mathematicians studied Pell’s equation. This is because of the link between
Pell’s equation and the irrational number√
2. Despite Pell’s equation being named after the English mathematician
John Pell, the credit should have been given to Viscount William Brouncker. The mistaken identity was made by
Leonard Euler [9]. Unfortunately for Brouncker, the name Pell’s equation stuck.
We begin with first defining the equation. Pell’s equation is a particular form of a diophantine equation [7] [10].
These are equations of two or more variables with integer solutions.
Definition 7.0.17. Suppose d is a positive integer. Then for some x, y ∈ Z,
x2 − dy2 = ±1
is known as Pell’s equation.
We call the equation x2 − dy2 = −1 the negative Pell equation [14].
Let us first concentrate on the positive Pell equation; i.e. x2 − dy2 = 1.
Through observation, we can almost immediately see that if (x, y) is a solution, then so too are (−x,−y) and
(±x,∓y). So if we have one solution then we must have at least 3 other solutions, unless either x or y is equal to
zero.
We can separate the positive Pell equation into two cases. One where d is a perfect square, and one where it is not.
Suppose first that d is a perfect square. Then d = m2, for some integer m. Hence we have
x2 − dy2 = x2 −m2y2 = (x+my)(x−my) = 1.
Which, in turn, implies that either
x+my = x−my = 1
or
x+my = x−my = −1
Solving these equations simultaneously yields x = ±1 and y = 0. It is worth noting that this result is independent
of our initial choice of d. This solution is known as the trivial solution and always solves the equation.
Now we turn to the possibility that d is non-square. We begin with looking the graph of Pell’s equation with
differing values of d to get a visual interpretation of Pell’s equation.
From the graph in Figure 2 we see that increasing the value of d causes the graph to stretch parallel to the x axis.
This is of course expected as changing the value of d is a simple transformation. We also notice that the graph
is symmetrical in both the x and y axes, which should have been clear with the presence of the squares in Pell’s
equation.
10
Figure 2: This is graph shows Pell’s equations with different values of d. The red plot is d = 1 , giving x2−y2 = 1 .
The green plot is d = 2 , so x2 − 2y2 = 1 . The final blue plot is d = 16 , a square number, giving x2 − 16y2 = 1 .
The dots on curves are integer solutions of that curve.
Close to the origin, we see that all of our graphs curve into the points (±1, 0), the trivial solutions. However, if
we just focus on the higher values of x and y, we see that the curves are almost straight lines. This suggests the
presence of asymptotes. Our asymptote looks to be of linear form, i.e. y = ax + b for some real a and b. Setting
this equal to to the equation of the positive Pell equation we find that y = ± 1√d
√x2 − 1. Because
√x2 − 1→ x as
x→∞, the equations of the asymptotes are y = ± 1√dx.
Now we shall take a look at the integer solutions to the Pell equation x2 − dy2 = 1. As we can see from the graph
above, we have that two of the curves have integer solutions, which are marked on our graph. From the equation
x2− 2y2 = 1, it need not be true that each curve can have a maximum of one integer solution. There could indeed
be more integer solutions to the equations with higher x and y values. In the case that d = 1, we have the curve
x2 − y2 = 1. No integer solutions are marked on the graph, but could there be any integer solutions with higher x
and y values? It turns out that the equation does not have an integer solution other than the trivial one. This is
because the difference between two square integers is at least 3, i.e. 22 − 12. This difference increases with higher
x ad y values.
We have looked at x2 − dy2 = 1, now we consider the negative Pell’s equation x2 − dy2 = −1.
We see a similar story in Figure 3, on the next page, as to our first graph Figure 2. With larger values of d we
again have a stretch in the x axis. We have the same symmetry properties.
However there are some noticeable differences. One being in Figure 3, the graph doesn’t touch the horizontal axis.
This is because when we have y = 0, it follows that x2 = −1. Since no such real number exists, the graph could
not possibly touch the x axis.
Furthermore, we do not have a trivial solution to our Pell equation x2 − dy2 = −1. Rather than the graph curving
to the points (±1, 0), they do not approach one particular point. Examining this further, we have when x = 0 that
dy2 = 1, which yields the results y = ± 1√d. So rather than approaching one point independent to d, it approaches
some variable point depending on the initial choice of d. We see as we increase the value of d then this point
approaches the origin from both sides. But we do know that this point lies somewhere within the interval [-1,1],
11
Figure 3: This graph shows Pell’s equations with the same values of d as the graph above Figure 2, however this
time using x2 − dy2 = −1 . Again, the red plot is d = 1 . The green plot is d = 2 . The final blue plot is when
d = 16 , a square number.
since d > 1.
Again looking at the higher values of x and y, we find that the shape of the graph is almost linear. In a similar
way as before we find that we have the equation of the asymptotes are y = ± 1√dx. This is identical to the positive
Pell equation. This may be an indication of a link between the positive and negative Pell equations. This brings
us to our next theorems.
Theorem 7.0.18. Suppose we have a solution (x, y) = (x0, y0) to the Pell equation x2−dy2 = 1, then all solutions
(x, y) to the positive Pell equation are
x+ y√d = (x0 + y0
√d)n.
We also have a similar result for the negative Pell equation.
Theorem 7.0.19. Suppose we have a solution (x, y) = (x0, y0) to the negative Pell equation x2 − dy2 = −1, then
all solutions (x, y) to the positive Pell equation are
x+ y√d = (x0 + y0
√d)n,
for all odd integers n ≥ 1
The proof to this theorem is similar to the one above. We shall leave these to the interested reader. Our next
theorem provides us with the link between continued fractions and Pell’s equation.
Theorem 7.0.20. Suppose x and y are integer solutions to Pell’s equation x2 − dy2 = 1. Then xy is convergent to
√d.
Proof. If x and y are solutions to Pell’s equation, we have x2−dy2 = 1, which implies (x+dy)(x−dy) = 1. Notice
12
we have that
x− y√d =
1
x+ y√d> 0 ,
so it follows x > y√d. Now consider
|√d− x
y| = x− y
√d
y=
1
y(x− y√d)
<1
y(y√d− y
√d)
=1
2y2√d<
1
2y2.
Hence xy is convergent to
√d.
Now we come to the issue of the existence of a solution.
Theorem 7.0.21. Suppose we have a non-square number d, then the equation x2 − dy2 = 1 has a non trivial
solution.
This means that Pell’s equations always have positive integer solutions regardless of our choice of d. We shall omit
the proof for length reasons. This was first proved by Lagrange in 1768. 100 years earlier Fermat claimed to have
a proof and challenged other mathematicians in Europe to prove it [1].
Let us now look if a similar result holds for the negative Pell equation x2 − dy2 = −1. Unfortunately, a full and
comprehensive set of solutions to the negative Pell equation is not yet known. However, some interesting results
have surfaced upon our pursuit of the final missing piece. Most notably x2− dy2 = −1 is solvable if and only if the
period length of the continued fraction for√d is odd. We shall come to this result later. Other results include:
• If d = 3p for some integer p then Pell’s equation doesn’t have a solution.
• In 1785, Legendre proved that if d is a prime and is congruent to 1 mod 4 then the negative Pell equation is
solvable.
• The negative Pell equation x2 − dy2 = 1 is solvable if and only if there exist a primitive Pythagorean triple
(A,B,C such that A2+B2 = C2) with A and B co prime; so by the Euclidean algorithm there exists a, b ∈ Z,
d = a2 + b2 and |aA− bB| = 1. [6]
• Numbers d for which x2 − dy2 = −1 is solvable are :
1, 2, 5, 10, 13, 17, 26, 29, 37, 41, 50, 53, 58, 61, 65, 73, 74, 82, 85, 89, 97, 101 . . . [13]
To illustrate the point of not all negative Pell equations having solutions, let’s look at an example. Take the negative
Pell equation x2 − 3y2 = −1. We shall show this has no solution. To do this we use an argument by contradiction
using modular arithmetic. So suppose an integer solution exists for some x and y satisfying x2 − 3y2 = −1. Then
we can reduce both sides by mod 3 to get x2 = −1 mod 3. This congruence has no solution: the only squares mod
3 are 0 and 1. Thus x2 − 3y2 = −1 has no solutions.
Let’s take a look at the continued fraction of a non-square number, for example√
153. We can see that
√153 = [12; 2, 1, 2, 2, 2, 1, 2, 24]
The first few convergents are
k 1 2 3 4 5 6 7 8 9 10 11 12
ck = pkqk
12 252
373
998
23519
56946
80465
2177176
530524289
1082818754
16133313043
43094734840
13
We see that pkqk
converges to√d, in this case
√153 . Therefore pk
qk≈√d for large enough k. Rearranging this to
get p2k − dq2k, we would expect this to be fairly close to 0 for large enough k.
k pk qk p2k − dq2k1 12 1 −9
2 25 2 13
3 37 3 −8
4 99 8 9
5 235 19 −8
6 569 46 13
7 804 65 −9
8 2177 176 1
9 53052 4289 −9
10 108281 8754 13
11 161333 13043 −8
12 430947 34840 9
However, as the table above shows, this need not be the case. We see that the final column isn’t close nor converging
to zero. In fact, we do see a repeating pattern occurring through the increasing values of k.
From the table, we observe that the number one appears in the final column. This is when k = 8, which coincides
with the length of the period of the continued fraction of√
153. This reflects that 2177− 153· 176 = 1. Therefore
we can say the convergent 2177176 to
√153 is a solution (2177, 176) to the Pell equation x2 − 153y2 = 1. Furthermore
we see that
[12; 2, 1, 2, 2, 2, 1, 2] =2177
176.
This is further evidence towards the link between the convergences of the continued fraction of√d and solutions
to the Pell equation x2 − dy2 = 1.
We see that with d = 153 the solution to the Pell equation was the continued fraction of√
153 with only one period
and removing the last entry of the period. This leads us to believe that a similar method could be used to find the
solution to Pell’s equation for an arbitrary value of d.
√d Continued Fraction of
√d Length of Period(k) [a0; a1, . . . , ak−1] = pk−1
qk−1p2k−1 − dq2k−1√
153 [12; 2, 1, 2, 2, 2, 1, 2, 24] 8 [12; 2, 1, 2, 2, 2, 1, 2] = 2177176 1
√73 [8; 1, 1, 5, 5, 1, 1, 16] 7 [8; 1, 1, 5, 5, 1, 1] = 1068
125 −1√
220 [14; 1, 4, 1, 28] 4 [14; 1, 4, 1] = 896 1
√111 [10; 1, 1, 6, 1, 1, 20] 6 [10; 1, 1, 6, 1, 1] = 295
28 1√
137 [11; 1, 2, 2, 1, 1, 2, 2, 1, 22] 9 [11; 1, 2, 2, 1, 1, 2, 2, 1] = 1744149 −1
From the table, it appears that there is a link between the convergences of a continued fraction of√d and solutions
14
to the Pell equation. However, some of the results are solutions to Pell’s equation equalling -1 rather than 1. This
is due to the length of the period of the continued fraction of√d. If the length is odd, then we have solutions to
x2 − dy2 = −1, and if it is even we have solutions to x2 − dy2 = 1. Our results can be summarised by the next
theorem.
Definition 7.0.22. The solution to x2 − dy2 = ±1 in positive integers for which x+ y√d is smallest is called the
fundamental solution of this equation.
Theorem 7.0.23. Let the continued fraction of√d = [a0; a1, a2, ..., ak1, ak] and let pk−1
qk−1= [a0; a1, a2, . . . , ak−1].
Then the smallest solution in positive integers to Pell’s equation x2 − dy2 = 1 is given by
(x1, y1) =
(pk−1, qk−1) if k is even
(p2k−1 + q2k−1d, 2pk−1qk−1) if k is odd
We conclude our exploration of the world of continued fractions by solving the seemingly innocent Pell equation
x2 − 29y2 = 1.
With some calculation, we see that the continued fraction of√
29 = [5; 2, 1, 1, 2, 10]. Through observation we see
that the length of the period k is 5, which is odd. Thus by the above theorem we have that the fundamental
solution is
(x1, y1) = (p24 + q24d, 2p4q4) = (702 + 29 ∗ 132, 2 ∗ 70 ∗ 13) = (9801, 1820).
Substituting this into our Pell equation, we see that this is a solution. Now, if we wanted to find all other solutions,
by theorem 7.0.18 we simply raise the fundamental solution to a power. So our solution set is (xn, yn) such that
xn is the integer part of (9801 + 1820√
29)n and yn the coefficient of√
29.
The next smallest solution is (192119201, 35675640).
8 Conclusion
In this project, we have seen a new way of representing real numbers in terms of a sequence of positive integers.
In continued fraction form, rationals are finite continued fractions, irrationals are infinite, and square roots are
periodic. Square roots in particular possess some interesting properties that are not seen in decimal form, such
as their symmetrical periodic nature. This brings us to Pell’s equation, within this chapter we have seen several
results. Most notably that the continued fraction of√d solves the positive Pell equation. Also we have seen that
if one solution does exist, other than the trivial one, we have infinitely many solutions. Otherwise we simply have
the trivial case. With regards to the negative Pell equation, we know that if the length of the continued fraction
is odd, then we have a solution, but there is no simple solution if the length is even.
15
References
[1] Keith Conrad. Pell’s equation i. Pell’s Equation I, 2012. http://www.math.uconn.edu/ kconrad/blurbs/u-
gradnumthy/pelleqn1.pdf.
[2] Alexandra Ioana Gliga. On continued fractions of the square root of prime num-
bers. On Continued Fractions of the Square Root of Prime Numbers, 2006.
http://web.math.princeton.edu/mathlab/jr02fall/Periodicity/alexajp.pdf.
[3] Pavel Guerzhoy. A short introduction to continued fractions. A Short Introduction To Contiuned Fractions,
2010. http://www.math.hawaii.edu/ pavel/contfrac.pdf.
[4] Bruce Ikenaga. Continued fractions. Continued Fractions, 2008.
http://www.millersville.edu/ bikenaga/number-theory/continued-fractions/continued-fractions.html.
[5] Bruce Ikenaga. Infinite continued fractions. Infinite Continued Fractions, 2010.
http://www.millersville.edu/ bikenaga/number-theory/infinite-continued-fractions/infinite-continued-
fractions.html.
[6] Keith Matthews. Primitive Pythagorean triples and the Negative Pell Equation. Number Theory Web, 2010.
[7] Anitha Srinivasan Richard A. Mollin. A note on the negative pell equation. International Journal of Algebra,
2010. http://people.ucalgary.ca/ ramollin/notenegpelleq.pdf.
[8] Joseph H. Silverman. A Friendly Introduction to Number Theory. Pearson Education Inc., fourth edition,
2012. http://www.math.brown.edu/ jhs/frintonlinechapters.pdf.
[9] John Stillwell. Elements of Number Theory. Springer, 2003.
[10] Dorin Andrica Titu Andreescu. Quadratic Diophantine Equations. Springer, 2015.
[11] Adam Van Tuvl. Continued fractions ...an introduction. Continued Fractions ...an Introduction, 1998.
http://archives.math.utk.edu/articles/atuyl/confrac/intro.html.
[12] Binghamton University. Introduction to continued fractions. Introduction to Continued Fractions.
http://www.math.binghamton.edu/dikran/478/Ch7.pdf.
[13] Wikipedia. The negative pell equation. Pell’s Equation, 2015. https://en.wikipedia.org/wiki/Pell
[14] Seung Hyun Yang. Continued fractions and pell’s equation. Continued Fractions and Pell’s Equation, 2008.
http://www.math.uchicago.edu/ may/VIGRE/VIGRE2008/REUPapers/Yang.pdf.
16