Continued fraction

From Academic Kids

In mathematics, a continued fraction is an expression such as

<math>x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3+\,\cdots}}} <math>

where a0 is some integer and all the other numbers an are positive integers. Longer expressions are defined analogously. If the numerators are allowed to differ from unity, the resulting expression is a generalized continued fraction. For clarity, non-generalized continued fractions are also called simple continued fractions.



Continued fractions are motivated by a desire to have a "mathematically pure" representation for the real numbers. The most well-known representation, of course, is the decimal expansion. In this representation, the number π, for example, is represented by the sequence of integers {3, 1, 4, 1, 5, 9, 2, ...}. We say that the sequence of integers {ai} represents the real number r if

<math>r = \sum_{i=0}^\infty a_i 10^{-i}<math>

and each ai (except possibly a0, which may be any integer) is an element of {0, 1, 2, ..., 9}.

This representation has some problems, however. One problem is the appearance of the arbitrary constant 10 in the formula above. Why 10? This is because of a biological accident, not because of anything related to mathematics. 10 is used because it is the "standard" base of our number system, in octal we'd use 8 or binary; 2. Another problem is that many simple numbers lack finite representations in this system. For example, the number 1/3 is represented by the infinite sequence {0, 3, 3, 3, 3, ....}.

Continued fraction notation is a representation for the real numbers that evades both these problems. Let us consider how we might describe a number like 415/93, which is around 4.4624. This is approximately 4. Actually it is a little bit more than 4, about 4 + 1/2. But the 2 in the denominator is not correct; the correct denominator is a little bit more than 2, about 2 + 1/6, so 415/93 is approximately 4 + 1/(2 + 1/6). But the 6 in the denominator is not correct; the correct denominator is a little bit more than 6, actually 6+1/7. So 415/93 is actually 4+1/(2+1/(6+1/7)). This is exact.

By dropping the redundant parts of the expression 4+1/(2+1/(6+1/7)), we get the abbreviated notation [4; 2, 6, 7].

The continued fraction representation of real numbers can be defined in this way. It has several desirable properties:

  • The continued fraction representation for a number is finite if and only if the number is rational.
  • Continued fraction representations for "simple" rational numbers are short.
  • The continued fraction representation of an irrational number is unique.
  • The continued fraction representation of a rational number is almost unique: there are exactly two representations for every rational number, which are exactly the same except that one ends with ...a, 1] and the other ends with ...a+1].
  • Truncating the continued fraction representation of a number x early yields a rational approximation for x which is in a certain sense the "best possible" rational approximation (see theorem 5, corollary 1 below for a formal statement).

This last property is extremely important, and is not true of the conventional decimal representation. Truncating the decimal representation of a number yields a rational approximation of that number, but not usually a very good approximation. For example, truncating 1/7 = 0.142857... at various places yields approximations such as 142/1000, 14/100, and 1/10. But clearly the best rational approximation is "1/7" itself. Truncating the decimal representation of π yields approximations such as 31415/10000 and 314/100. The continued fraction representation of π begins [3; 7, 15, 1, 292, ...]. Truncating this representation yields the excellent rational approximations 3, 22/7, 333/106, 355/113, ... The denominators of 314/100 and 333/106 are almost the same, but the error in the approximation 314/100 is nineteen times as large as the error in 333/106. As an approximation to π, [3; 7, 15, 1] is accurate to better than one part per million.

Calculating continued fraction representations

Consider a real number r. Let i be the integer part and f the fractional part of r. Then the continued fraction representation of r is [i; ...], where "..." is the continued fraction representation of 1/f. It is customary to replace the first comma by a semicolon.

To calculate a continued fraction representation of a number r, write down the integer part of r. Subtract this integer part from r. If the difference is 0, stop; otherwise find the reciprocal of the difference and repeat. The procedure will halt if and only if r was rational.

Find the continued fraction for 3.245
<math>3\,<math> <math>3.245 - 3\,<math> <math>= 0.245\,<math> <math>1 / 0.245\,<math> <math>= 4.082\,<math>
<math>4\,<math> <math>4.082 - 4\,<math> <math>= 0.082\,<math> <math>1 / 0.082\,<math> <math>= 12.250\,<math>
<math>12\,<math> <math>12.250 - 12\,<math> <math>= 0.250\,<math> <math>1 / 0.250\,<math> <math>= 4.000\,<math>
<math>4\,<math> <math>4.000 - 4\,<math> <math>= 0.000\,<math> STOP
continued fraction form for 3.245 is [3; 4, 12, 4]
<math>3.245 = 3 + \cfrac{1}{4 + \cfrac{1}{12 + \cfrac{1}{4}}} <math>

Note: The number 3.245 can also be represented by the continued fraction expansion [3; 4, 12, 3, 1]; refer to Finite continued fractions below.

Notations for continued fractions

One can abbreviate a continued fraction as

<math>x = [a_0; a_1, a_2, a_3] \;<math>

or in the notation of Pringsheim

<math>x = a_0 + \frac{1 \mid}{\mid a_1} + \frac{1 \mid}{\mid a_2} + \frac{1 \mid}{\mid a_3} <math>

or another seldom used notation, similar to the above

<math>x = a_0 +
 {1 \over a_1 + } {1 \over a_2 +} {1 \over a_3 +}. <math>

One may also define infinite continued fractions as limits:

<math>[a_{0}; a_{1}, a_{2}, a_{3}, \,\ldots ] = \lim_{n \to \infty} [a_{0}; a_{1}, a_{2}, \,\ldots, a_{n}]. <math>

This limit exists for any choice of positive integers a1, a2, a3 ...

Finite continued fractions

For finite continued fractions, note that

<math>[a_{0}; a_{1}, a_{2}, a_{3}, \,\ldots ,a_{n}, 1]=[a_{0}; a_{1}, a_{2}, a_{3}, \,\ldots, a_{n} + 1]. \;<math>

So, for every finite continued fraction, there is another finite continued fraction that represents the same number, for instance

<math> [2; 3, 1] = [2; 4] = 9/4 = 2.25. \;<math>

Every finite continued fraction is rational, and every rational number can be represented in precisely two different ways as a finite continued fraction. In one representation the final term in the continued fraction is 1. The other representation is one element shorter, and the final term must be greater than 1 unless there is only one element.

Infinite continued fractions

Every infinite continued fraction is irrational, and every irrational number can be represented in precisely one way as an infinite continued fraction.

An infinite continued fraction representation for an irrational numbers is mainly useful because its initial segments provide excellent rational approximations to the number. These rational numbers are called the convergents of the continued fraction. Even-numbered convergents are smaller than the original number, while odd-numbered ones are bigger.

For a continued fraction <math>[a_0;a_1,a_2,\ldots]<math>, the first three convergents are


\frac{a_0}{1},\qquad \frac{a_0a_1+1}{a_1},\qquad \frac{ a_2(a_0a_1+1)+a_0}{a_2a_1+1},\qquad \frac{a_3(a_2(a_0a_1+1)+a_0)+(a_0a_1+1)}{a_3(a_2a_1+1)+a_1}. <math>

In words, the numerator of the third convergent is formed by multiplying the numerator of the second convergent by the third quotient, and adding the numerator of the first convergent. The denominators are formed similarly.

If successive convergents are found, with numerators <math>h_1,h_2,\ldots<math> and denominators <math>k_1,k_2,\ldots<math> then the relevant recursive relation is:

<math> h_n=a_nh_{n-1}+h_{n-2},\qquad k_n=a_nk_{n-1}+k_{n-2}.<math>

The successive convergents are given by the formula


\frac{h_n}{k_n}= \frac{a_nh_{n-1}+h_{n-2}}{a_nk_{n-1}+k_{n-2}}. <math>

Some useful theorems

If a0, a1, a2, ... is an infinite sequence of positive integers, define the sequences <math>h_n<math> and <math>k_n<math> recursively:

<math>h_{n}=a_ih_{n-1}+h_{n-2}<math> <math>h_{-1}=1<math> <math>h_{-2}=0<math>
<math>k_{n}=a_nk_{n-1}+k_{n-2}<math> <math>k_{-1}=0<math> <math>k_{-2}=1<math>

Theorem 1

For any positive <math>x\in\mathbb{R}<math>


\left[a_0, a_1, \,\dots, a_{n-1}, x \right]= \frac{x h_{n-1}+h_{n-2}}

    {x k_{n-1}+k_{n-2}}.<math>

Theorem 2

The convergents of [a0, a1, a2, ...] are given by


\left[a_0, a_1, \,\dots, a_n\right]= \frac{h_n}


Theorem 3

If the nth convergent to a continued fraction is <math>h_n/k_n<math>, then


k_nh_{n-1}-k_{n-1}h_n=(-1)^n. <math>

Corollary 1: Each convergent is in its lowest terms (for if <math>h_n<math> and <math>k_n<math> had a common divisor it would divide <math>h_nq_{n-1}-q_nh_{n-1}<math>, which is impossible).

Corollary 2: The difference between successive convergents is a fraction whose numerator is unity:


\left|\frac{h_n}{k_n}-\frac{h_{n-1}}{k_{n-1}} \right|= \left|\frac{h_nk_{n-1}-k_nh_{n-1}}{k_nk_{n-1}}\right|= \frac{1}{k_nk_{n-1}}. <math>

Corollary 3: The matrix


h_n & h_{n-1} \\ k_n & k_{n-1} \end{bmatrix}<math> has determinant plus or minus one, and thus belongs to the group of 2x2 unimodular matrices <math>S^*L(2,\mathbb{Z})<math>.

Theorem 4

Each convergent is nearer to the nth convergent than any of the preceding convergents. In symbols, if the rth convergent is considered to <math>[a_0;a_1,a_2,\ldots a_n]=x<math>, then


\left|[a_0; a_1, a_2, \ldots a_r]-x\right|> \left|[a_0; a_1, a_2, \ldots a_s]-x\right|<math> for all <math>r

Corollary 1: the odd convergents continually increase, but are always less than <math>x.<math>

Corollary 2: the even convergents continually decrease, but are always greater than <math>x.<math>

Theorem 5


\frac{1}{k_n(k_{n+1}+k_n)}< \left|x-\frac{h_n}{k_n}\right|< \frac{1}{k_nk_{n+1}}. <math>

Corollary 1: any convergent is nearer to the continued fraction than any other fraction whose denominator is less than that of the convergent

Corollary 2: any convergent which immediately precedes a large quotient is a near approximation to the continued fraction.


If <math>\frac{h_{n-1}}{k_{n-1}}<math> and <math>\frac{h_n}{k_n}<math> are successive convergents, then any fraction of the form

<math>\frac{h_{n-1} + ah_n}{k_{n-1}+ak_n}<math>

where <math>a<math> is a nonnegative integer and the numerators and denominators are between the <math>n<math> and <math>n+1<math> terms inclusive are called semiconvergents or secondary convergents. Often the term is taken to mean that being a semiconvergent excludes the possibility of being a convergent, rather than that a convergent is a kind of semiconvergent.

The semiconvergents to the continued fraction expansion of a real number <math>x<math> include all the rational approximations which are better than any approximation with a smaller denominator. Another useful property is that consecutive semiconvergents a/b and c/d are such that <math>ad-bc = \pm 1<math>.

The continued fraction expansion of π

For example, to calculate the convergents of pi, we set a0 = [π] = 3 (where [x] denotes the largest integer ≤ x), define u1 = 1/(π - 3) ≈ 113/16 = 7.0625 and a1 = [u1] = 7, u2 = 1/(u1 - 7) ≈ 31993/2000 = 15.9965 and a2 = [u2] = 15, u3 = 1/(u2 - 15) ≈ 1003/1000 = 1.003. Continuing like this, one can determine the infinite continued fraction of π as [3; 7, 15, 1, 292, 1, 1, ...]. The third convergent of π is [3; 7, 15, 1] = 355/113 = 3.14159292035... which is fairly close to the true value of π.

Let us suppose that the quotients found are, as above, [3; 7, 15, 1]. The following is a rule by which we can write down at once the convergent fractions which result from these quotients without developing the continued fraction.

The first quotient, supposed divided by unity, will give the first fraction, which will be too small, namely, 3/1. Then, multiplying the numerator and denominator of this fraction by the second quotient and adding unity to the numerator, we shall have the second fraction, 22/7, which will be too large. Multiplying in like manner the numerator and denominator of this fraction by the third quotient, and adding to the numerator the numerator of the preceding fraction, and to the denominator the denominator of the preceding fraction, we shall have the third fraction, which will be too small. Thus, the third quotient being 15, we have for our numerator (22 · 15 = 330) + 3 = 333, and for our denominator, (7 · 15 = 105) + 1 = 106. The third convergent, therefore, is 333/106. We proceed in the same manner for the fourth convergent. The fourth quotient being 1, we say 333 times 1 is 333, and this plus 22, the numerator of the fraction preceding, is 355; similarly, 106 times 1 is 106, and this plus 7 is 113.

In this manner, by employing the four quotients [3; 7, 15, 1], we obtain the four fractions:

<math>\frac{3}{1}, \frac{22}{7}, \frac{333}{106}, \frac{355}{113}, \,\ldots<math>

These convergents are alternately smaller and larger than the true value of π, and approach nearer and nearer to π. The difference between a given convergent and π is less than the reciprocal of the product of the denominators of that convergent and the next convergent. For example, the fraction 22/7 is greater than π, but 22/7 - π is less than 1/(7x106), that is 1/742 (in fact, 22/7 - π is just less than 1/790).

The demonstration of the foregoing properties is deduced from the fact that if we seek the difference between one of the convergent fractions and the next adjacent to it we shall obtain a fraction of which the numerator is always unity and the denominator the product of the two denominators. Thus the difference between 22/7 and 3/1 is 1/7, in excess; between 333/106 and 22/7, 1/742, in deficit; between 355/113 and 333/106, 1/11978, in excess; and so on. The result being, that by employing this series of differences we can express in another and very simple manner the fractions with which we are here concerned, by means of a second series of fractions of which the numerators are all unity and the denominators successively be the product of every two adjacent denominators. Instead of the fractions written above, we have thus the series:

<math>\frac{3}{1}+\frac{1}{1 \cdot 7}-\frac{1}{7 \cdot 106}+\frac{1}{106 \cdot 113} \cdots <math>

The first term, as we see, is the first fraction; the first and second together give the second fraction, 22/7; the first, the second and the third give the third fraction 333/106, and so on with the rest; the result being that the series entire is equivalent to the original value.

Other continued fraction expansions

While one cannot discern any pattern in the infinite continued fraction expansion of π, this is not true for e, the base of the natural logarithm: e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, ...].

The numbers with periodic continued fraction expansion are precisely the solutions of quadratic equations with integer coefficients. For example, the golden ratio φ = [1; 1, 1, 1, 1, 1, ...] and √ 2 = [1; 2, 2, 2, 2, ...].

However, most irrational numbers do not have any periodic or regular behavior in their continued fraction expansion. Nevertheless Khinchin proved that for almost all real numbers x, the ai (for i = 1,2,3...) have an astonishing property: their geometric mean is a constant (known as Khinchin's constant, K ≈ 2.6854520010...) independent of the value of x. Paul Lvy showed that the nth root of the denominator of the nth convergent of the continued fraction expansion of almost all real numbers approaches an asymptotic limit, which is known as Lvy's constant.

Pell's equation

Continued fractions play an essential role in the solution of Pell's equation. For example, <math>p^2 - 2q^2 = \pm1<math> if and only if <math>p/q<math> is a convergent of <math>\sqrt2<math>.

Continued fractions and chaos

Continued fractions also play a role in the study of chaos, where they tie together the Farey fractions which are seen in the Mandelbrot set with the Minkowski question mark function and the modular group Gamma.

The backwards shift operator for continued fractions is the map <math>h(x)=1/x - \lfloor 1/x \rfloor,<math> called the Gauss map, which lops off digits of a continued fraction expansion: <math>h([0;a_1,a_2,a_3,...]) = [0;a_2,a_3,...]<math>. The transfer operator of this map is called the Gauss-Kuzmin-Wirsing operator. The distribution of the digits in continued fractions is given by the zero'th eigenvector of this operator, and is called the Gauss-Kuzmin distribution.

See also

External links


es:Fraccin continua fr:Fraction continue ko:연분수 ja:連分数 pl:Ułamek łańcuchowy ru:Цепная дробь zh:連分数 nl:kettingbreuk


Academic Kids Menu

  • Art and Cultures
    • Art (
    • Architecture (
    • Cultures (
    • Music (
    • Musical Instruments (
  • Biographies (
  • Clipart (
  • Geography (
    • Countries of the World (
    • Maps (
    • Flags (
    • Continents (
  • History (
    • Ancient Civilizations (
    • Industrial Revolution (
    • Middle Ages (
    • Prehistory (
    • Renaissance (
    • Timelines (
    • United States (
    • Wars (
    • World History (
  • Human Body (
  • Mathematics (
  • Reference (
  • Science (
    • Animals (
    • Aviation (
    • Dinosaurs (
    • Earth (
    • Inventions (
    • Physical Science (
    • Plants (
    • Scientists (
  • Social Studies (
    • Anthropology (
    • Economics (
    • Government (
    • Religion (
    • Holidays (
  • Space and Astronomy
    • Solar System (
    • Planets (
  • Sports (
  • Timelines (
  • Weather (
  • US States (


  • Home Page (
  • Contact Us (

  • Clip Art (
Personal tools