Lably
Skip to content

Simple continued fraction

Number represented as a0+1/(a1+1/...)

  • 24 min read
  • 14 chapters

Related on Lably

Through Continued fraction, Fraction and Sequence

Typically, such a continued fraction is obtained through a recursive process which starts by representing a number as the sum of its integer part and its fractional part. The integer is recorded and the reciprocal of the fractional part is then recursively represented by another continued fraction. In the finite case, the recursion is stopped after finitely many steps by using an integer in lieu of another continued fraction. In contrast, an infinite continued fraction is an infinite expression. In either case, all integers in the sequence, other than the first, must be positive. The integers ai are called the coefficients or terms of the continued fraction.

Simple continued fractions have a number of remarkable properties related to the Euclidean algorithm for integers or real numbers. Every rational number ⁠p/q⁠ has two closely related expressions as a finite continued fraction, whose coefficients ai can be determined by applying the Euclidean algorithm to (p,q). The numerical value of an infinite continued fraction is irrational; it is defined from its infinite sequence of integers as the limit of a sequence of values for finite continued fractions. Each finite continued fraction of the sequence is obtained by using a finite prefix of the infinite continued fraction's defining sequence of integers. Moreover, every irrational number α is the value of a unique infinite regular continued fraction, whose coefficients can be found using the non-terminating version of the Euclidean algorithm applied to the incommensurable values α and 1. This way of expressing real numbers (rational and irrational) is called their continued fraction representation.

Motivation and notation

Consider, for example, the rational number ⁠415/93⁠, which is around 4.4624. As a first approximation, start with 4, which is the integer part; ⁠415/93⁠ = 4 + ⁠43/93⁠. The fractional part is the reciprocal of ⁠93/43⁠ which is about 2.1628. Use the integer part, 2, as an approximation for the reciprocal to obtain a second approximation of 4 + ⁠1/2⁠ = 4.5. Now, ⁠93/43⁠ = 2 + ⁠7/43⁠; the remaining fractional part, ⁠7/43⁠, is the reciprocal of ⁠43/7⁠, and ⁠43/7⁠ is around 6.1429. Use 6 as an approximation for this to obtain 2 + ⁠1/6⁠ as an approximation for ⁠93/43⁠ and 4 + ⁠1/2 + ⁠1/6⁠⁠, about 4.4615, as the third approximation. Further, ⁠43/7⁠ = 6 + ⁠1/7⁠. Finally, the fractional part, ⁠1/7⁠, is the reciprocal of 7, so its approximation in this scheme, 7, is exact (⁠7/1⁠ = 7 + ⁠0/1⁠) and produces the exact expression 4+12+16+17 for ⁠415/93⁠.

That expression is called the continued fraction representation of ⁠415/93⁠. This can be represented by the abbreviated notation ⁠415/93⁠ = [4; 2, 6, 7]. It is customary to place a semicolon after the first number to indicate that it is the whole part. Some older textbooks use all commas in the (n + 1)-tuple, for example, [4, 2, 6, 7].

If the starting number is rational, then this process exactly parallels the Euclidean algorithm applied to the numerator and denominator of the number. In particular, it must terminate and produce a finite continued fraction representation of the number. The sequence of integers that occur in this representation is the sequence of successive quotients computed by the Euclidean algorithm. If the starting number is irrational, then the process continues indefinitely. This produces a sequence of approximations, all of which are rational numbers, and these converge to the starting number as a limit. This is the (infinite) continued fraction representation of the number. Examples of continued fraction representations of irrational numbers are:

  • √19 = [4;2,1,3,1,2,8,2,1,3,1,2,8,...] (sequence A010124 in the OEIS). The pattern repeats indefinitely with a period of 6.
  • e = [2;1,2,1,1,4,1,1,6,1,1,8,...] (sequence A003417 in the OEIS). The pattern repeats indefinitely with a period of 3 except that 2 is added to one of the terms in each cycle.
  • π = [3;7,15,1,292,1,1,1,2,1,3,1,...] (sequence A001203 in the OEIS). No pattern has ever been found in this representation.
  • φ = [1;1,1,1,1,1,1,1,1,1,1,1,...] (sequence A000012 in the OEIS). The golden ratio, the irrational number that is the "most difficult" to approximate rationally .
  • γ = [0;1,1,2,1,2,1,4,3,13,5,1,...] (sequence A002852 in the OEIS). The Euler–Mascheroni constant, which is expected but not known to be irrational, and whose continued fraction has no apparent pattern.

Continued fractions are, in some ways, more "mathematically natural" representations of a real number than other representations such as decimal representations, and they have several desirable properties:

  • The continued fraction representation for a real number is finite if and only if it is a rational number. In contrast, the decimal representation of a rational number may be finite, for example ⁠137/1600⁠ = 0.085625, or infinite with a repeating cycle, for example ⁠4/27⁠ = 0.148148148148...
  • Every rational number has an essentially unique simple continued fraction representation. Each rational can be represented in exactly two ways, since [a0;a1,... an−1,an] = [a0;a1,... an−1,(an−1),1]. Usually the first, shorter one is chosen as the canonical representation.
  • The simple continued fraction representation of an irrational number is unique. (However, additional representations are possible when using generalized continued fractions; see below.)
  • The real numbers whose continued fraction eventually repeats are precisely the quadratic irrationals. For example, the repeating continued fraction [1;1,1,1,...] is the golden ratio, and the repeating continued fraction [1;2,2,2,...] is the square root of 2. In contrast, the decimal representations of quadratic irrationals are apparently random. The square roots of all (positive) integers that are not perfect squares are quadratic irrationals, and hence are unique periodic continued fractions.
  • The successive approximations generated in finding the continued fraction representation of a number, that is, by truncating the continued fraction representation, are in a certain sense (described below) the "best possible".

Sign in to keep reading

13 more chapters are free with a Lably account.

More in Topics in mathematics