13.1   Approximation with Continued Fractions

13.1.1   Introduction

As we saw in the Prelab, continued fractions provide a good means for approximating real numbers by rational numbers. There are a number of ways of looking at continued fractions, and the applet below provides a means for computing each one.

The applet takes two arguments as input: the first is the real number we want to approximate, and the second is the number of terms to use from that real number's continued fraction expansion. For example, to see the first 12 quotients of the continued fraction expansion for pi = 3.1415926..., we just click on "Quotients" below:

Your browser does not support java.

Recall that the convergents are the fractions we get when we chop off the continued fraction expansion at each step. To see these fractions, we just click on "Fracs". You can also see decimal approximations for the convergents by clicking on "Values". Give it a try.

Your browser does not support java.

Clicking on "Errors" shows how close the convergents come to the original input value by subtracting off the input value from each convergent.

Your browser does not support java.

As you can see, the error values do appear to be headed for 0.

Exercise 1

Compute some continued fraction quotients for the number e from calculus, and report any patterns that you observe. (Just type "e" into the applet for e.)

Note: You need only report the pattern in the quotients, not prove that the pattern continues.

13.1.2   Identifying Rationals from Decimal Approximations

Suppose we had a decimal approximation of an unknown rational number, and we wanted to recover the original rational number that produced the decimal approximation. One approach would be to use the fact that the digits of the decimal approximation of a rational number are ultimately periodic. If we have enough decimal places, we can identify the repeating part and figure out the original rational number from there.

For example, if we had the repeating decimal


we could let x = 0.121212..., multiply by 100, and then subtract x:

100xx = 12.121212... – 0.121212... = 12.

Thus we see that x = 12/99 = 4/33.

The above method works fine if we have enough of the decimal expansion to spot the repeating part. But suppose we don't have enough decimal places available to discern any repetition. For example, 0.46017699115044247787 is the first 20 decimal places of a rational number with a moderately small denominator. Can you guess the number?

A good approach is to look at the convergents from the continued fraction expansion of our number, because they will be rational numbers which give good approximations to the value. Let's start with the "Quotients" from the continued fraction expansion:

Your browser does not support java.

The sixth quotient (remember that we start numbering with 0) is huge compared to the others. That means that the fifth quotient of 2 was almost exactly right -- our next best approximation for that quotient was

2 + (1/12825445684237526).

It looks like our rational number is [0, 2, 5, 1, 3, 2]. We can compute this convergent directly, but it is also helpful to look at all of the "Fracs":

Your browser does not support java.

We can see here the effect of the large quotient. Keep in mind that our value is only an approximation to the rational number. On the basis of the above output, it looks like our number is 52/113. We can check our guess by computing a decimal approximation of 52/113. Rather than examining just this one value, let's look at approximations for the previous list of convergents. If our guess of 52/113 is correct, then the sixth entry in the list should be the first one that is correct. Click on "Values" below:

Your browser does not support java.

Exercise 2

The first 20 decimal places of a rational number are


The denominator of this number is less than 1010. Find the original rational number. The applet below has been primed for your use.

Your browser does not support java.

Section 13.1 | Section 13.2 | Section 13.3 | Section 13.4

Chapter 13 | DNT Table of Contents

Copyright © 2001 by W. H. Freeman and Company