Rational Approximation by Continued Fractions


The first lemma says that the denominators of convergents of continued fractions increase.

Lemma. Let $a_0$ , $a_1$ , $a_2$ , ... be a sequence of integers, where $a_k > 0$ for $k \ge 1$ . Define

$$p_0 = a_0, \quad q_0 = 1$$

$$p_1 = a_1a_0 + 1, \quad q_1 = a_1$$

$$p_k = a_kp_{k-1} + p_{k-2}, \quad q_k = a_kq_{k-1} + q_{k-2}, \qquad k \ge 2.$$

Then $q_{k+1} > q_k$ for $k > 0$ .

Proof. Let $k > 0$ . Note that $q_{k-1}$ is a positive integer. So

$$q_{k+1} = a_{k+1}q_k + q_{k-1} > a_{k+1}q_k \ge 1\cdot q_k = q_k,$$

where $a_{k+1} \ge
   1$ because the a's are positive integers from $a_1$ on.

The convergents of a continued fraction oscillate around the limiting value, and the convergents are always fractions in lowest terms. In fact, the convergents are the best rational approximations to the value of the continued fraction. I'll state the precise result without proof.

Theorem. Let x be irrational, and let $c_k = \dfrac{p_k}{q_k}$ be the k-th convergent in the continued fraction expansion of x. Suppose $p, q \in \integer$ , $q > 0$ , and

$$|qx - p| < |q_kx - p_k|.$$

Then $q \ge
   q_{k+1}$ .

Here's what the result means. Draw the line through the origin in the t-y plane with slope x. Plot the points $(p,q)$ and $(p_k,q_k)$ .

The hypothesis $|qx
   - p| < |q_kx - p_k|$ says that the vertical distance from $(q,p)$ to $y = xt$ is less than the vertical distance from $(q_k,p_k)$ to $y = xt$ .

$$\hbox{\epsfysize=2.5in \epsffile{approximation-by-rationals1.eps}}$$

The conclusion says that $q \ge q_{k+1}$ . In fact, since $q_{k+1} >
   q_k$ , $q > q_k$ : The denominator of $\dfrac{p}{q}$ is bigger than that of $\dfrac{p_k}{q_k}$ .

In other words, the only way the point $(p,q)$ can be closer to the line is if its y-coordinate is bigger.

I can restate the theorem in the form of a corollary in which you can see the fractions in question approximating x.

Corollary. Let x be irrational, and let $c_k = \dfrac{p_k}{q_k}$ be the k-th convergent in the continued fraction expansion of x. Suppose $p, q \in \integer$ , $q > 0$ , and

$$\left|x - \dfrac{p}{q}\right| < \left|x - \dfrac{p_k}{q_k}\right|.$$

Then $q > q_k$ .

Proof. Given the hypotheses of the corollary, suppose on the contrary that $q \le q_k$ . Since

$$\left|x - \dfrac{p}{q}\right| < \left|x - \dfrac{p_k}{q_k}\right|,$$

I can multiply the two inequalities to get

$$\left|qx - p\right| < \left|q_kx - p_k\right|.$$

Apply the theorem to obtain $q \ge q_{k+1}$ . But then $q_k \ge q \ge q_{k+1}$ , which contradicts the fact that the q's increase.

Therefore, $q >
   q_k$ .


This result says that the only way a rational number $\dfrac{p}{q}$ can approximate a continued fraction better than a convergent $\dfrac{p_k}{q_k}$ is if the fraction has a bigger denominator than the convergent.


Example. Here are the convergents for the continued fraction expansion for $\pi$ :

$$\vbox{\offinterlineskip \halign{& \vrule # & \strut \hfil \quad # \quad \hfil \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & $a_k$ & & $p_k$ & & $q_k$ & & $c_k$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & 3 & & 3 & & 1 & & 3 & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & 7 & & 22 & & 7 & & $\dfrac{22}{7}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & 15 & & 333 & & 106 & & $\dfrac{333}{106}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & 1 & & 355 & & 113 & & $\dfrac{355}{113}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & \cr & 292 & & 103993 & & 33102 & & $\dfrac{103993}{33102}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} }}$$

$\dfrac{355}{113}
   \approx 3.141592920$ , which is in error in the seventh place. The theorem says that a fraction $\dfrac{p}{q}$ can be closer to $\pi$ than $\dfrac{355}{113}$ only if $q > 113$ .


The next result is sort of a converse to the previous two results. It says that if a rational number approximates an irrational number x "sufficiently well", then the rational number must be a convergent in the continued fraction expansion for x.

Theorem. Let x be irrational, and let $\dfrac{p}{q}$ be a rational number in lowest terms with $q > 0$ . Suppose that

$$\left|x - \dfrac{p}{q}\right| < \dfrac{1}{2q^2}.$$

Then $\dfrac{p}{q}$ is a convergent in the continued fraction expansion for x.

Proof. Since $q_k \ge k$ for $k \ge 0$ , the q's form a strictly increasing sequence of positive integers. Therefore, for some k,

$$q_k \le q < q_{k+1}.$$

Since $q < q_{k+1}$ , the contrapositive of the preceding theorem gives

$$|q_kx - p_k| \le |qx - p| = q\left|x - \dfrac{p}{q}\right| < q\cdot \dfrac{1}{2q^2} = \dfrac{1}{2q}.$$

Hence,

$$\left|x - \dfrac{p_k}{q_k}\right| < \dfrac{1}{2qq_k}.$$

Now assume toward a contradiction that $\dfrac{p}{q}$ is not a convergent in the continued fraction expansion for x. In particular, $\dfrac{p}{q} \ne
   \dfrac{p_k}{q_k}$ , so $qp_k \ne pq_k$ , and hence $|qp_k - pq_k|$ is a positive integer.

Since $|qp_k - pq_k|
   \ge 1$ ,

$$\dfrac{1}{qq_k} \le \dfrac{|qp_k - pq_k|}{qq_k} = \left|\dfrac{p_k}{q_k} - \dfrac{p}{q}\right| = \left|\dfrac{p_k}{q_k} - x + x - \dfrac{p}{q}\right| \le \left|\dfrac{p_k}{q_k} - x\right| + \left|x - \dfrac{p}{q}\right| < \dfrac{1}{2qq_k} + \dfrac{1}{2q^2}.$$

(The second inequality comes from the Triangle Inequality: $|a + b| \le |a| + |b|$ .)

Subtracting $\dfrac{1}{2qq_k}$ from both sides, I get

$$\dfrac{1}{2qq_k} < \dfrac{1}{2q^2}, \quad\hbox{so}\quad q < q_k.$$

But I assumed $q_k
   \le q$ , so this is a contradiction.

Therefore, $\dfrac{p}{q}$ is a convergent in the continued fraction expansion for x.


Example. Show that $\dfrac{355}{113}$ is the best rational approximation to $\pi$ by a fraction having a denominator less than 1000.

Suppose that $\dfrac{p}{q}$ is a fraction in lowest terms that is a better approximation to $\pi$ than $\dfrac{355}{113}$ , and that $q < 1000$ .

Since $\dfrac{p}{q}$ is a fraction is a better approximation to $\pi$ than $\dfrac{355}{113}$ ,

$$\left|\pi - \dfrac{p}{q}\right| < \left|\pi - \dfrac{355}{113}\right|.$$

Since $q < 1000$ ,

$$2q^2 < 2000000, \quad\hbox{so}\quad \dfrac{1}{2q^2} > \dfrac{1}{2000000} = 5 \times 10^{-7}.$$

But

$$\left|\pi - \dfrac{355}{113}\right| = 2.66764 \ldots \times 10^{-7}.$$

Thus,

$$\dfrac{1}{2q^2} > 5 \times 10^{-7} > \left|\pi - \dfrac{355}{113}\right| > \left|\pi - \dfrac{p}{q}\right|.$$

The hypotheses of the theorem are satisfied, so $\dfrac{p}{q}$ must be a convergent in the continued fraction expansion of $\pi$ .

But the other convergents with denominators less than 1000 --- 3, $\dfrac{22}{7}$ , $\dfrac{333}{106}$ --- with denominators less than 1000 are poorer approximations to $\pi$ than $\dfrac{355}{113}$ .

Hence, $\dfrac{355}{113}$ is the best rational approximation to $\pi$ by a fraction having a denominator less than 1000.


Example. (a) Compute the first 6 convergents $c_0$ , ... $c_5$ of the continued fraction for $11^{1/3}$ .

(b) Show that $\dfrac{278}{125}$ is the best rational approximation to $11^{1/3}$ having denominator less than 155.

(a)

$$\vbox{\offinterlineskip \halign{& \vrule # & \strut \hfil \quad # \quad \hfil \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & x & & a & & p & & q & & c & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 2.223980090569315 & & 2 & & 2 & & 1 & & 2 & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 4.46468254146245 & & 4 & & 9 & & 4 & & $\dfrac{9}{4}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 2.152006823524719 & & 2 & & 20 & & 9 & & $\dfrac{20}{9}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 6.578652042139306 & & 6 & & 129 & & 58 & & $\dfrac{129}{58}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 1.728154274376962 & & 1 & & 149 & & 67 & & $\dfrac{149}{67}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 1.373335342782462 & & 1 & & 278 & & 125 & & $\dfrac{278}{125}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr & 2.6785570114363653 & & 2 & & 705 & & 317 & & $\dfrac{705}{317}$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} }}\quad\halmos $$

(b) Suppose that $\dfrac{p}{q}$ is a fraction in lowest terms which is a better approximation to $11^{1/3}$ than $\dfrac{278}{125}$ , and also that $q < 155$ .

Since $\dfrac{p}{q}$ is a better approximation to $11^{1/3}$ than $\dfrac{278}{125}$ ,

$$\left|11^{1/3} - \dfrac{p}{q}\right| < \left|11^{1/3} - \dfrac{278}{125}\right| = 1.99094 \ldots \times 10^{-5}.$$

Since $q < 155$ ,

$$\eqalign{ q & < 155 \cr q^2 & < 24025 \cr 2 q^2 & < 48050 \cr \noalign{\vskip2pt} \dfrac{1}{2 q^2} & > \dfrac{1}{48050} = 2.08116 \ldots \times 10^{-5} \cr}$$

So I have

$$\dfrac{1}{2 q^2} > 2.08116 \ldots \times 10^{-5} > 1.99094 \ldots \times 10^{-5} > \left|11^{1/3} - \dfrac{p}{q}\right|.$$

(The inequalities are approximate, but there is enough room between $2.08116 \ldots
   \times 10^{-5}$ and $1.99094 \ldots \times
   10^{-5}$ that there is no problem.)

By the approximation theorem, $\dfrac{p}{q}$ is a convergent for $11^{1/3}$ . But no convergent with $q < 155$ is a better approximation than $\dfrac{278}{125}$ .

This contradiction shows that $\dfrac{278}{125}$ is the best rational approximation to $11^{1/3}$ having denominator less than 155.



Contact information

Bruce Ikenaga's Home Page

Copyright 2017 by Bruce Ikenaga