# Continued fraction

In mathematics, a **continued fraction** is an expression such as

*a*

_{0}is some integer and all the other numbers

*a*

_{n}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.

## Motivation

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, ...}.
Notationally, we say that the sequence of integers
{*a*_{i}} represents the real number *r* if

*a*

_{i}(except possibly

*a*

_{0}, 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. 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's 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,\n7].

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).

## Calculating continued fraction representations

## Notations for continued fractions

One can abbreviate a continued fraction as

or in the notation of Pringsheim

*infinite continued fractions*as limits:

*a*

_{1},

*a*

_{2},

*a*

_{3}...

## Finite continued fractions

For finite continued fractions, note that

So, for every finite continued fraction, there is another finite continued fraction that represents the same number, for instance## 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 , the first three convergents are

If successive convergents are found, with numerators and denominators then the relevant recursive relation is:

The successive convergents are given by the formula

## Some Useful Theorems

If *a*_{0}, *a*_{1}, *a*_{2}, ... is an infinite sequence of positive integers, define the sequences and recursively:

### Theorem 1

For any positive

### Theorem 2

The convergents of [*a*

_{0},

*a*

_{1},

*a*

_{2}, ...] are given by

### Theorem 3

If the nth convergent to a continued fraction is , then

**Corollary 1:**Each convergent is in its lowest terms (for if and had a common divisor it would divide , which is impossible).

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

### Theorem 4

Each convergent is nearer to the n-th convergent than any of the preceding convergents. In symbols, if the rth convergent is considered to , then
**Corollary 1:** the odd convergents continually increase, but are always less than

**Corollary 2:** the even convergents continually decrease, but are always greater than .

### Theorem 5

**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.

## The continued fraction expansion of π

For example, to calculate the convergents of pi, we set *a*_{0} = [π] = 3 (where [*x*] denotes the largest integer ≤ *x*), define *u*_{1} = 1/(π - 3) ≈ 113/16 = 7.0625 and *a*_{1} = [*u*_{1}] = 7, *u*_{2} = 1/(*u*_{1} - 7) ≈ 31993/2000 = 15.9965 and *a*_{2} = [*u*_{2}] = 15, *u*_{3} = 1/(*u*_{2} - 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:

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:

## 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 *a*_{i} (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*.

**See also:**

## External links

## References

A. Ya. Khinchin; *Continued Fractions*; University of Chicago Press.