Monday, November 28, 2005

Continued Fractions: Basic Properties

Today's blog is a continuation of the discussion about the famous math problem known as Pell's Equation.

In today's blog, I will show proofs for two properties of Continued Fractions (for those not familiar with Continued Fractions, start here):
  • All rational numbers can be represented as a finite continued fraction.
  • All irrational numbers that are solutions to a quadratic equation are periodic (that is, they repeat the same pattern of integers over and over again after a certain point)
For the irrational numbers, I mean any irrational number that is a solution to a quadratic equation that is of this form:
ax2 + bx + c = 0

where a,b,c are integers.

For a periodic continued fraction which a period of size j and where the period begins before i, then: ai = ai+j.

The proofs outlined in today's blog are based on work done by Harold M. Stark in his book An Introduction to Number Theory.

Theorem 1: A continued fraction is finite if and only if it is a rational number.

(1) We know that if a continued fraction is finite, then it is representable as a rational number. (See Lemma 2, here)

(2) So, all we need to prove is that a rational number is representable as a finite continued fraction.

(3) For any rational number, there are two integers, let's call them c,d0 such that the rational number is representable by a/b. [Definition of a rational number]

(4) To generate a continued fraction, we need to generate a set of integers a0 through an.

(5) Let's set a0 = floor(c/d0).

A floor is a function that returns the minium integer that is less than or equal to a certain rational value. For example, the floor of (3/4) is 0. The floor of (5/2) is 2 and the floor of (-8) is -8. Finally, the floor of (-8.1) is -9.

(6) If a0 = c/d0, then we are done and the continued fraction is [a0]. Going forward, we will assume that a0 is less than but not equal to c/d0.

(7) Subtracting the original number by the a0 results in a rational number which we can call β0:

c/d0 = a0 + β0

We note that β0 is ≥ 0 and less than 1 by our assumption in #6. When it is 0 we are done.

(8) Now, from #7, we know that d0 * β0 is an integer since:

c = d0 * a0 + d0*β0

And therefore:

d0 * β0 = c - d0*a0

Which is an integer since c is an integer and d0 is an integer and a0 is an integer.

(9) So, we know there exists an integer d1 = d0 * β0.

We also note that this integer has the following properties:

(a) d1 ≥ 0.

We know that it is not negative since we can assume d0 is positive (if both c,d0 are negative, we can assume that they are both positive. If c is positive and d0 is negative, we can assume that c is negative and d0 is positive.

(b) d1 is less than d0

We know it is less than d0 since β0 is less than 1 and since d1 = d0 * β0

(10) From #9, we note that β0 = d1/d0

(11) Now, a1 = floor(1/β0) = floor(d1/d0)

Now if this is an integer (for example, 1/(1/2) = 2), then we are done and the continued fraction is [a0,a1]. So, let's assume that we are not done.

(12) So, then, there exists rational value β1 that is equal to the difference between 1/β0 and a1 which is greater than 0 so that:

d1/d0 = a1 + β1

This is the same form as step #7 and the same principles apply. We can derive a d2 that is a positive integer less than d1 and so on.

(13) Because di is an integer that continually gets smaller, we know that eventually it will equal 0.

(14) When di = 0 we are done and so we have proven that our sequence will eventually end.

QED

Lemma 1: If a continued fraction is periodic, then it represents a quadratic number.

(1) A quadratic number is any real number that satisfies the quadratic equation:
ax2 + bx + c = 0 where a,b,c are integers.

For example, √2 is a quadratic number since it satisfies the equation (a=1,b=0,c=-2) where:
x2 - 2 = 0

(2) Let α be a real number that is represented by a periodic continued fraction that repeats a am with a period of k.

So α = [ a0, a1, ..., am-1, αm]

And

αm = [ am, am+1, ..., am+k-1, am, am+1, ...]

And

αm = [ am, am+1, ..., am+k-1, αm]

(3) So, applying Lemma 1 from a previous blog, we get:
αm = (αmpm + pm-1)/(αmqm + qm-1)

(4) And multiplying (αmqm + qm-1) to both sides gives us:

(αm)2*qm + αm*qm-1 = (αmpm + pm-1)

And:
(αm)2*qm + αm*qm-1 - αmpm - pm-1 = 0

And:
(αm)2*qm + (αm)(qm-1 - pm) - pm-1= 0

(5) Applying lemma 1 from a previous blog to the first equation in #2 gives us:
α = (αm*pm-1 + pm-2)/(αm*qm-1 + qm-2)

(6) So,

α*(αm*qm-1 + qm-2) = (αm*pm-1 + pm-2)

and

α*αm*qm-1 + α*qm-2 - αm*pm-1 - pm-2 = 0

and

αm(α*qm-1 - pm-1) = pm-2 - α*qm-2

and

αm = (pm-2 - α*qm-2)/(α*qm-1 - pm-1)

(7) Now inserting (#6) into (#4) gives us:

[ ([pm-2 - α*qm-2)/(α*qm-1 - pm-1)]2*qm +
[(pm-2 - α*qm-2)/(α*qm-1 - pm-1)](qm-1 - pm) - pm-1 = 0

And multiplying (α*qm-1 - pm-1)2 to both sides give us:
(pm-2 - α*qm-2)2*qm +
(pm-2 - α*qm-2)(α*qm-1 - pm-1)(qm-1 - pm) - (α*qm-1 - pm-1)2(pm-1) = 0

(8) And solving for all the values above gives us a quadratic equation of the form:
α2a + αb + c = 0

QED

Lemma 2: If α is a quadratic number, and [a0, a1, ... , an-1, αn] is a continued fraction representation where ai are integers and αn is a real number, then αn is also a quadratic number.

(1) Since α is a quadratic number, there exists integers a,b, and c such that:
a(α)2 + b(α) + c = 0. [Definition of a quadratic number]

(2) From Lemma 1 in a previous blog, we know that:
α = (αn * pn-1 + pn-2)/(αn* qn-1 + qn-2)

(3) Inserting (1) into (2) and then multiplying everything out and then regrouping around (αn)2, αn, and any integer gives us three values An, Bn, Cn such that:
An(αn)2 + Bn(αn) + Cn = 0.

where

An = a(pn-1)2 + bpn-1qn-1 + c(qn-1)2

Bn = 2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2

Cn = a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 = An-1


(4) By definition, this means that αn is a quadratic number.

QED

Corollary 2.1: (Bn)2 - 4AnCn = b2 - 4ac

where:

An = a(pn-1)2 + bpn-1qn-1 + c(qn-1)2

Bn = 2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2

Cn = a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 = An-1

(1) From Lemma 2 above:

(Bn)2 - 4AnCn =

= (
2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) - 4*[a(pn-1)2 + bpn-1qn-1 + c(qn-1)2][a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 = An-1] =

= (
2apn-1pn-2 )(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) +
(
bpn-1qn-2)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) +
(
bpn-2qn-1)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) +
(
2cqn-1qn-2)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) -
(4
a(pn-1)2)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ] -
(4
bpn-1qn-1)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ] -
(4
c(qn-1)2)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ]

(2) Multipyling each term, we get:

(i) (2apn-1pn-2 )(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) =

4a2(pn-1)2(pn-2)2 +
2ab(pn-1)2(pn-2)(qn-2) +
2ab(pn-1)(pn-2)2(qn-1) +
4ac(pn-1)(pn-2)(qn-1)(qn-2)


(ii) (bpn-1qn-2)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) =

2ab(pn-1)2(pn-2)(qn-2) +
b2(pn-1)2(qn-2)2 +
b2(pn-1)(pn-2)(qn-1)(qn-2) +
2bc(pn-1)(qn-1)(qn-2)2


(iii) (bpn-2qn-1)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) =

2ab(pn-1)(pn-2)2(qn-1) +
b2(pn-1)(pn-2)(qn-1)(qn-2) +
b2(pn-2)2(qn-1)2 +
2bc(pn-2)(
qn-1)2(qn-2)

(iv) (2cqn-1qn-2)(2apn-1pn-2 + bpn-1qn-2 + bpn-2qn-1 + 2cqn-1qn-2) =

4ac(
pn-1)(pn-2)(qn-1)(qn-2) +
2bc(
pn-1)(qn-1)(qn-2)2 +
2bc(
pn-2)(qn-1)2(qn-2) +
4c2(
qn-1)2(qn-2)2


(v) -(4a(pn-1)2)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ] =

-4a2(pn-1)2(pn-2)2 + -4ab(pn-1)2(pn-2)(qn-2) + -4ac(pn-1)2(qn-2)2


(vi) -(4bpn-1qn-1)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ] =

-4ab(pn-1)(pn-2)2(qn-1) +
-4b2(pn-1)(pn-2)(qn-1)(qn-2) +
-4bc(pn-1)(qn-1)(qn-2)2


(vii) -(4c(qn-1)2)[a(pn-2)2 + bpn-2qn-2 + c(qn-2)2 ] =

-4ac(pn-2)2(qn-1)2 +
-4bc(pn-2)(qn-1)2(qn-2) +
-4c2(qn-1)2(qn-2)2


(3) We can see that many of these terms line up and cancel out:

= [ 4a2(pn-1)2(pn-2)2 - 4a2(pn-1)2(pn-2)2 ]+ { from 2.i and 2.v }

[ 2ab(pn-1)2pn-2qn-2 + 2ab(pn-1)2pn-2qn-2 - 4ab(pn-1)2pn-2qn-2 ] + { from 2.i, 2.ii, and 2.iv }

[ 2ab(pn-1)(pn-2)2(qn-1) + 2ab(pn-1)(pn-2)2(qn-1) - 4ab(pn-1)(pn-2)2(qn-1) ]+ { from 2.i, 2.iii, and 2.vi }

[ 2bcpn-1(qn-1)2qn-2 + 2bcpn-1(qn-1)2qn-2 - 4bcpn-1(qn-1)2qn-2 ] + { from 2.iii, 2.iv, and 2.vii }

[ 2bcpn-2qn-1(qn-2)2 +2bcpn-2qn-1(qn-2)2 - 4bcpn-2qn-1(qn-2)2 ] + { from 2.ii, 2.iv, and 2.vi }

( 4c2(qn-1)2(qn-2)2 - 4c2(qn-1)2(qn-2)2 ) + { from 2.iv and 2.vii }

( b2pn-1pn-2qn-1qn-2 + b2pn-1pn-2qn-1qn-2 - 4b2pn-1pn-2qn-1qn-2 ) + { from 2.ii, 2.iii, and 2.vi }

(4acpn-1pn-2qn-1qn-2 + 4acpn-1pn-2qn-1qn-2) + { from 2.i and 2.iv }

[b2(pn-1)2(qn-2)2 + b2(pn-2)2(qn-1)2 ] + { from 2.ii and 2.iii }

[-4ac(pn-2)2(qn-1)2 +-4ac(pn-1)2(qn-2)2 ] { from 2.v and 2.vii }

= -2b2pn-1pn-2qn-1qn-2 + 8acpn-1pn-2qn-1qn-2 +
b2(pn-1)2(qn-2)2 +
b2(pn-2)2(qn-1)2 +
-4ac(pn-2)2(qn-1)2 +
-4ac(pn-1)2(qn-2)2 =

= b2[(pn-1)2(qn-2)2 + (pn-2)2(qn-1)2 - 2pn-1pn-2qn-1qn-2] - 4ac[(pn-1)2(qn-2)2 + (pn-2)2(qn-1)2 - 2pn-1pn-2qn-1qn-2] =

= (b2 - 4ac)[(pn-1)2(qn-2)2 + (pn-2)2(qn-1)2 - 2pn-1pn-2qn-1qn-2] =

= (b2 - 4ac)(pn-1qn-2 - pn-2qn-1)2

(4) Applying Lemma 2 from a previous blog, we get:

(b2 - 4ac)(pn-1qn-2 - pn-2qn-1)2= (b2 - 4ac)(-1)2 =
= b2 - 4ac.

QED

Corollary 2.2: An, Bn, Cn can only span over a finite set of integers.

(1) Let λn = pnqn - α(qn)2

(2) Rearranging values gives us:
pn = λn/qn - αqn

(3) We note that absolute(λn) is less than 1 since:

(a) We know that α - pn/qn is less than 1/qn2 and greater than -1/qn2. [From Theorem 2, here]

(b) Multiplying (qn)2 to all sides give us that:

α*(qn)2 - pnqn is between -1 and 1.

(c) Multiplying -1 to all sides give us that:

pnqn - α(qn)2 is between -1 and 1.

(d) This proves that λn is between -1 and 1 or rather absolute(λn) is less than 1.

(4) Inserting #2 into the formula for An in Lemma 2 gives us:

An = a( λn-1/qn-1 + αqn-1)2 + b( λn-1/qn-1 + αqn-1)an-1 + c(qn-1)2

Working this through and rearranging values gives us:

(qn-1)2(aα2 + bα + c) + 2aαλn-1 + a(λn-1)2/(qn-1)2 + bλn-1

Since we know that aα2 + bα + c = 0 (since α is a quadratic number based on a,b,c), we get:

An = 2aαλn-1 + a(λn-1)2/(qn-1)2 + bλn-1

Since absolute(λan-1) is less than 1, this tells us that:

absolute(An) is less than 2*absolute(aα) + absolute(a) + absolute(b).

To understand the details for why this is true, there are three cases to consider:

Case I: a,b positive

In this case An is less than 2*absolute(aα) + absolute(a) + absolute(b).

Case II: a,b negative

In this case, the absolute values result in values the same as in Case I. In this case An = -absolute(An).

Case III: a,b: one is negative, one is positive

In this case, An will be greater than -absolute(An) and less than absolute(An) so, then:
absolute(An) is less than 2*absolute(aα) + absolute(a) + absolute(b)

Since Cn = An-1, we know that:

absolute(Cn) is less than 2*absolute(aα) + absolute(a) + absolute(b)

Finally, since (Bn)2 = 4AnCn + b2-4ac, we know that:

(Bn)2 ≤ 4[ 2*absolute(aα) + absolute(a) + absolute(b)]2 + absolute(b2-4ac)

(5) The important idea from all this is that there are only a finite number integers that An, Bn, and Cn can equal, that is, only those integers which make up the ranges in #4.

QED

Theorem 2: A continued fraction is periodic if and only if it represents an irrational quadratic number.

(1) In Lemma 1, it was shown that a periodic continued fraction is a quadratic irrational number.

(2) Now, I will show that all quadratic irrational numbers are representable as periodic continued fractions.

(3) Let α be a quadratic number (that is, an irrational that is a solution to a quadratic equation)

(4) We know that there are an infinite number of values ai and αi that make it up (from Theorem 1 above, otherwise it would not be irrational)

(5) But at each point, there are only a finite number of values An, Bn, Cn that describe the equation that αi solves.

(6) This means that it is inevitable that a specific combination An, Bn, Cn repeats and continues to repeat.

(7) For each specific combination of An, Bn, Cn, there are two possible real values that satisfy the equation. (This observation comes from the solution to the quadratic equation, found here)

(8) So, eventually, some αi repeats.

QED

Lemma 3: If a value is representeable by a finite continued fraction with an odd number of elements, then it is representable by an even number of elements and likewise if it is representable by an even number of elements, it can be represented by an odd number of elements.

(1) Let [a0, a1, ..., an] be a finite continued fraction of n elements.

(2) Now, if an ≥ 2, then:
[ a0, a1, ..., an] = [ a0, a1, ..., an-1,1 ]

(3) Otherwise, if an = 1, then:
[ a0, a1, an-1,1 ] = [a0, a1, ... , an-1 + 1 ]

QED

Sunday, November 27, 2005

Continued Fractions: The Approximation Algorithm

Today's blog continues the discussion on Pell's Equation. Before jumping into the solution to Pell's Equation, it is necessary to review some fundamental properties of Continued Fractions. I will later show how these properties of continued fractions can be used to solve Pell's Equation. For those who are not familiar with Continued Fractions, start here.

One of the most important ideas in dealing with Continued Fractions is the Continued Fraction Approximation Algorithm. This is an algorithm that can be used to convert a real number into a series of integers which make up the continued fraction.

The algorithm itself is made up of two equations which I will label pn and qn. Later, I will show that any finite continued fraction which represents an approximation of a real number is equal to a ratio of these two equations.

All of the ideas presented in today's blog are based on Harold M. Stark's Introduction to Number Theory.

Lemma 1: If [a0, a1, ... an, α] is a continued fraction where all values ai are integers and α is any real number, then there exists series pn and qn where:
[a0, a1, ... an, α ] = (α * pn + pn-1)/(α * qn + qn-1)

(1) Let [a0,a1, ...an, α] be a continued fraction such that:
[a0,a1,...an, α ] = a0 + 1/[a1 + 1/(a2 + ... + 1/α)]

(2) Let pn be a sequence based on a0 ... an such that:
p0 = a0
p1 = a0*a1 + 1
pn+2 = (pn+1)(an+2) + pn

For example, p2 = (p1)(a2) + p0 = (a0a1 + 1)(a2) + a0

(3) Let qn be a sequence based on a0 ... an such that:
q0 = 1
q1 = a1
qn+2 = (qn+1)(an+2) + qn

For example, q2 = (q1)(a2) + q0 = (a1)(a2) + 1

(4) So, consider the case where n = 1, then we have:
[a0, a1, α] = a0 + 1/[(a1 + 1/α)] = a0 + 1/[(a1α + 1)/α] = a0 + α/(a1α + 1) =
[a0(a1α + 1) + α]/(a1α + 1) = [α(a0a1 + 1) + a0]/(a1α + 1)

(5) Now, applying the definition given above for pn and qn gives us:
[a0,a1,α] = (α*p1 + p0)/(α*q1 + q0)

(6) So that, for n=1, we have:
[a0, a1, α] = (α*p1 + p0)/(α*q1 + q0)

(7) Let's assume that this is true up to some value n so that:
[a0, a1, ..., an, α] = (α*pn + pn-1)/(α*qn + qn-1)

(8) Now, we know that: [a0, a1, ..., an, an+1, α] = [a0, a1, ..., an, an+1 + 1/α] by the definition of continued fractions.

(9) So by our assumption in #7:
[a0, a1, ..., an, an+1 + 1/α] = [(an+1 + 1/α)*pn + pn-1]/[(an+1 + 1/α)*qn + qn-1]=
(an+1*pn + pn/α + pn-1)/(an+1*qn + qn/α + qn-1)

(10) Now, multiplying the above by α/α gives us:
(an+1*pn + pn/α + pn-1)/(an+1*qn + qn/α + qn-1) =
=(α*an+1*pn + pn + α*pn-1)/(α*an+1*qn + qn + α*qn-1) =
=[α(an+1pn + pn-1) + pn]/[α(an+1qn + qn-1) + qn]

(11) And finally, applying the series pn and qn gives us:
[α(an+1pn + pn-1) + pn]/[α(an+1qn + qn-1) + qn] = (αpn+1 + pn)/(αqn+1 + qn)

(12) Applying the principle of induction, we are done.

QED

Theorem 1: The Continued Fraction Approximation Algorithm

For any given finite continued fraction [ a0, a1, ... an ] where all ai are integers, using Lemma 1 to compute pn and qn we find that:
[ a0, a1, ... an ] = pn / qn

(1) Let's define pn, qn using the series in Lemma 1.

(2) For case n=1, we have:
[a0, a1] = a0 + 1/a1 = (a0*a1 + 1)/a1 [By definition of Continued Fractions]
= p1/q1 [By definition of pn and qn in Lemma 1]

(3) Assume that this is true up to some value n so that [a0, a1, ... an] = pn/qn

(4) Applying Lemma 1, gives us:
[a0, a1, ..., an, an+1] = [(an+1)pn + pn-1]/(an+1)qn + qn-1 = pn+1/qn+1

(5) By the Principle of Induction, we are done.

QED

Now, consider this interesting lemma:

Lemma 2: pn*qn-1 - pn-1*qn = (-1)n-1

(1) Let's start with the Case: n = 1

pn*qn-1 - pn-1*qn = p1* q0 - p0*q1

From Lemma 1 above,

p0 = a0
p1 = a0*a1 + 1
p2 = p1a2 + p0 = (a0a1 + 1)a2 + a0 = a0a1a2 + a2 + a0

q0 = 1
q1 = a1
q2 = q1a2 + q0 = a1a2 + 1

p1q0 = (a0*a1 + 1)*1 = a0*a1+1

p0*q1 = a0*a1

So:
p1*q0 - p0q1 = a0*a1 + 1 - a0*a1 = 1

(2) So let's assume that this is true up to n-1 so that we can assume:

pn-1*qn-2 - pn-2*qn-1 = (-1)n-2

(3) From Lemma 1, step #2 and step #3, we know that:

pn = pn-1*an + pn-2

and

qn = qn-1*an + qn-2

(4) So,

pn*qn-1 - pn-1*qn = (pn-1*an + pn-2)(qn-1) - (pn-1)(qn-1an + qn-2)

= pn-1*an*qn-1 + pn-2qn-1 - pn-1*an*qn-1 - pn-1qn-2 =
= pn-2qn-1 - pn-1qn-2 =
= (-1)(pn-1qn-2 - pn-2qn-1) =
= (-1)(-1)n-2 [From step #2 above]
= (-1)
n-1

(4) By the Principle of Induction we are done.

QED

Lemma 3: If α is a positive real number and α = [a0, a1 ... an-1, αn ], then a0 ≥ 0 and all other ai ≥ 1, and αn ≥ 1.

(1) a0 = floor(α) which clearly ≥ 0.

(2) In case n = 1, α1 = 1/(α - a0).

In this case, a0 is less than α (since we are assuming that αn is a nonzero real number).

So, clearly α1 must also be a positive number greater than 1 (since the difference between α and a0 is less than 1)

(3) In case n=2, a1 = floor(α1) is ≥ 1 by the reasoning in step #2. With α1 ≥ 1 and a1 ≥ 1, we know that α2 = 1/(α1 - a1) must also be a positive number ≥ 1.

(4) Let's assume that this is true up to n-1.

(5) At this point, we have a value αn that is a positive real number ≥ 1.

(6) So, an = floor(αn) which means that an ≥ 1.

(7) Finally, αn+1 = 1/(αn - an) which means that it too will be a positive real number ≥ 1.

(8) By the principle of induction we are done.

QED

Corollary 3.1: If α is a negative real number, and α = [a0, a1 ... an-1, αn ], then a0 ≤ 0 and all other ai ≤ -1, and αn ≤ 1.

(1) The reasoning here is the same as Lemma 3 except that we use a ceiling function instead of a floor function where ceiling (-5.6) = -5. In this case, the ai is higher than the αi value and the subtraction is still a negative number.

(2) In this way, we can use the same reasoning as Lemma 3 and we get the result that the answer is the same as in Lemma 3 except that we multiply -1 to all the ai values and also the αn value.

QED

Lemma 4: For a positive real number, if n is greater than 0, then qn+1 is greater than qn

(1) For case n=1:

q1 = a1
q2 = q1a2 + q0 = a1*a2 + 1

Since a1, a2 are both ≥ 1, we know that:
a1 ≤ a1*a2

And therefore:
a1 is less than a1*a2 + 1

(2) Let's assume that this is true up to n so that qn+1 is greater than qn

(3) So, qn+2 = qn+1*an+2 + qn

(4) We know that q1 = a1 which means that q1 ≥ 1. [From Lemma 3]

(5) So qn is greater than 1 (by our assumption in #2)

(6) We also know that an+2 is ≥ 1 which gives us:
qn+1 ≤ qn+1*an+2

(7) And finally, applying #5
qn+1 is less than qn+1*an+2 + 1 ≤ qn+1*an+2 + qn = qn+2

(8) By the Principle of Induction, we are done.

QED

Corollary 4.1 For a positive real number where n is greater than 0, qn ≥ n.

(1) Let's start with n=1

q1 = a1 which is ≥ 1.

(2) Let's assume that this is true up to n+1 so that qn+1 ≥ n+1.

(3) qn+2 = qn+1an + qn

(4) Now qn+2 is greater than qn+1 which means that:
qn+2 ≥ qn+1 + 1 ≥ n + 1 + 1 ≥ n + 2.

(5) By the Principle of Induction, we are done.

QED

Corollary 4.2: We can also see for all values of n ≥ 2, pn, pn+1 is greater than pn.

(1) We see that this is true for n=2:

p1 = a0a1 + 1.
p2 = p1a2 + a0.
p3 = p2a3 + p1

Since a0 is ≥ 0 (see above), we see that p1 is ≥ 1.
Now a3 is ≥ 1 so p2 * a3 is at least equal to p2 but since p1 is ≥ 1, we know that p3 must be greater.

(2) Now, we assume it is true for all values up to n.

(3) pn+1 = pnan+1 + pn-1

Since p1 ≥ 1, from (1), we know that p3 is ≥ 1 and all values of n greater than 3 is greater than 1.

So, we know that pn+1 is greater than pn by at least pn-1 which is ≥ 1.

(4) We have now proven that pn+1 is greater than pn for all values of n ≥ 2.

QED

Theorem 2: For a positive irrational number, we can use the approximation algorithm to generate an approximation of any degree of accuracy. In other words:

absolute(α - pn/qn) is less than 1/(qnqn+1) which is less than 1/(qn)2 which is ≤ 1/n2

(1) From Lemma 1, we know that:
α = (αn+1pn + pn-1)/(αn+1qn + qn-1)

(2) Subtracting both sides by pn/qn gives us:
α - pn/qn = (αn+1pn + pn-1)/(αn+1qn + qn-1) - pn/qn =
[qn(αn+1pn + pn-1) - pn(αn+1qn + qn-1)]/[qn(αn+1qn + qn-1)] =
= (qnαn+1pn - qnαn+1pn + pn-1qn - pnqn-1)/[qn(αn+1qn +qn-1) ] =
= (pn-1qn - pnqn-1)/[qn(αn+1qn + qn-1)] =
= (-1)n/[qn(αn+1qn + qn-1)]

(3) We know that for positive irrational numbers, an is less than αn which means that:

1/[qn(an+1qn + qn-1)] is greater than 1/[qn(αn+1qn + qn-1)]

Likewise,

-1/[qn(an+1qn + qn-1)] is less than 1/[qn(αn+1qn + qn-1)]

(4) Now, we need to consider two cases to complete the proof:

Case I: n is even

In this case:

α - pn/qn is less than 1/[qn(an+1qn + qn-1)] = 1/(qnqn+1)

We also know that α - pn is greater than 0 which means that it is also greater than -1/(qn)2

Since qn+1 is greater than qn, we also know that:

α - pn/qn is less than 1/(qnqn) = 1/(qn)2

Putting all this together gives us,

absolute(α - pn / qn) is less than 1/(qn)2

Case II: n is odd

In this case:

α - pn/qn is greater than -1/[qn(an+1qn + qn-1)] = -1/(qnqn+1)

We also know that α - pn is less than 0 which means that it is also less than 1/(qn)2

Since qn+1 is greater than qn, we also know that:

α - pn/qn is greater than -1/(qnqn) = -1/(qn)2

Putting all this together gives us,

absolute(α - pn / qn) is less than 1/(qn)2

(5) Now, since q1 ≥ 1 and qn+1 is greater than qn for n ≥ 1, we know that:

qn ≥ n and:

1/(qn)2 is less than 1/n2

QED

Lemma 5: Let Cn = pn/qn, then:
(a) Cn - Cn-1 = [(-1)n-1]/(qnqn-1)
(b) Cn - Cn-2 = [an(-1)n]/(qnqn-2)

(1) pnqn-1 - qnpn-1 = (-1)n-1. [From Lemma 2 above]

(2) Dividing both sides by qnqn-1 gives us (a).

(3) Cn - Cn-2 = pn/qn - pn-2/qn-2 = (pnqn-2 - pn-2qn)/(qnqn-2)

(4) pnqn-2 - pn-2qn = (anpn-1 + pn-2)qn-2 - pn-2(anqn-1 + qn-2) =
= an(pn-1qn-2 - pn-2qn-1) = ak(-1)n-2


(5) Combining #3 and #4 gives us (b).

QED

Corollary 5.1 C1 is greater than C3 is greater than C5 ... and C0 is less than C2 is less than C4 ...

(1) From Lemma 5(b), we know that Cn is less than Cn-2 if n is odd and Cn is greater than Cn-2 if n is even.

QED

Corollary 5.2 Consecutive Cn lie above or below the exact value of the continued fraction.

(1) From Lemma 5, we know that they will alternate. For odd values of n, Cn will be greater than Cn-1 and for even values of n, Cn will be less than Cn-1.

(2) By Theorem 2, we see that each Cn is a value closer to the exact value of the continued fraction.

(3) Finally, from Theorem 2, step #2, we see that α - pn/qn is alternately above and below the main value. If n is even, then α is above and if it is odd, then α is below.

QED

Lemma 6: For any value n ≥ 1, gcd(pn,qn) = 1.

(1) Assume that f divides both pn and qn

(2) By Lemma 2 above, pnqn-1 - pn-1qn = (-1)n-1

(3) So f divides both implies that f divides (-1)n-1

(4) But the only way this is true is if f = 1.

(5) Which proves that the only common factor they can have is 1.

QED