In mathematics, a continued fraction is an expression obtained through an iterative process of representing a number as the sum of its integer part and the reciprocal of another number, then writing this other number as the sum of its integer part and another reciprocal, and so on. In a finite continued fraction (or terminated continued fraction), the iteration/
recursion
Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematic ...
is terminated 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 are called the
coefficient
In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series, or an expression; it is usually a number, but may be any expression (including variables such as , and ). When the coefficients are themselves ...
s or terms of the continued fraction.
It is generally assumed that the numerator of all of the fractions is 1. If arbitrary values and/or functions are used in place of one or more of the numerators or the integers in the denominators, the resulting expression is a generalized continued fraction. When it is necessary to distinguish the first form from generalized continued fractions, the former may be called a simple or regular continued fraction, or said to be in canonical form.
Continued fractions have a number of remarkable properties related to the
Euclidean algorithm
In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an ...
for integers or
real number
In mathematics, a real number is a number that can be used to measurement, measure a ''continuous'' one-dimensional quantity such as a distance, time, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small var ...
s. Every
rational number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ra ...
has two closely related expressions as a finite continued fraction, whose coefficients can be determined by applying the Euclidean algorithm to . The numerical value of an infinite continued fraction is
irrational
Irrationality is cognition, thinking, talking, or acting without inclusion of rationality. It is more specifically described as an action or opinion given through inadequate use of reason, or through emotional distress or cognitive deficiency. ...
; it is defined from its infinite sequence of integers as the
limit
Limit or Limits may refer to:
Arts and media
* ''Limit'' (manga), a manga by Keiko Suenobu
* ''Limit'' (film), a South Korean film
* Limit (music), a way to characterize harmony
* "Limit" (song), a 2016 single by Luna Sea
* "Limits", a 2019 ...
of a sequence of values for finite continued fractions. Each finite continued fraction of the sequence is obtained by using a finite
prefix
A prefix is an affix which is placed before the stem of a word. Adding it to the beginning of one word changes it into another word. For example, when the prefix ''un-'' is added to the word ''happy'', it creates the word ''unhappy''. Particu ...
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''.
The term ''continued fraction'' may also refer to representations of
rational function
In mathematics, a rational function is any function that can be defined by a rational fraction, which is an algebraic fraction such that both the numerator and the denominator are polynomials. The coefficients of the polynomials need not be ...
rational number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ra ...
, which is around 4.4624. As a first
approximation
An approximation is anything that is intentionally similar but not exactly equal to something else.
Etymology and usage
The word ''approximation'' is derived from Latin ''approximatus'', from ''proximus'' meaning ''very near'' and the prefix '' ...
, start with 4, which is the integer part; . The fractional part is the reciprocal of which is about 2.1628. Use the integer part, 2, as an approximation for the reciprocal to obtain a second approximation of .
The remaining fractional part, , is the reciprocal of , and is around 6.1429. Use 6 as an approximation for this to obtain as an approximation for and , about 4.4615, as the third approximation; . Finally, the fractional part, , is the reciprocal of 7, so its approximation in this scheme, 7, is exact () and produces the exact expression for .
The expression is called the continued fraction representation of . This can be represented by the abbreviated notation = ; 2, 6, 7 (It is customary to replace only the ''first'' comma by a semicolon.) Some older textbooks use all commas in the -tuple, for example, , 2, 6, 7
If the starting number is rational, then this process exactly parallels the
Euclidean algorithm
In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an ...
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
Irrationality is cognition, thinking, talking, or acting without inclusion of rationality. It is more specifically described as an action or opinion given through inadequate use of reason, or through emotional distress or cognitive deficiency. ...
, 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:
* . The pattern repeats indefinitely with a period of 6.
* . The pattern repeats indefinitely with a period of 3 except that 2 is added to one of the terms in each cycle.
* . No pattern has ever been found in this representation.
* . The
golden ratio
In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Expressed algebraically, for quantities a and b with a > b > 0,
where the Greek letter phi ( ...
, the irrational number that is the "most difficult" to approximate rationally. See: A property of the golden ratio φ.
* . 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
In mathematics, a real number is a number that can be used to measurement, measure a ''continuous'' one-dimensional quantity such as a distance, time, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small var ...
than other representations such as
decimal representation
A decimal representation of a non-negative real number is its expression as a sequence of symbols consisting of decimal digits traditionally written with a single separator:
r = b_k b_\ldots b_0.a_1a_2\ldots
Here is the decimal separator, ...
s, 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 , or infinite with a repeating cycle, for example
* Every rational number has an essentially unique simple continued fraction representation. Each rational can be represented in exactly two ways, since . 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 is the
golden ratio
In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Expressed algebraically, for quantities a and b with a > b > 0,
where the Greek letter phi ( ...
, and the repeating continued fraction is the
square root of 2
The square root of 2 (approximately 1.4142) is a positive real number that, when multiplied by itself, equals the number 2. It may be written in mathematics as \sqrt or 2^, and is an algebraic number. Technically, it should be called the princi ...
. In contrast, the decimal representations of quadratic irrationals are apparently
random
In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. Individual rando ...
. 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".
Basic formula
A ( generalized) continued fraction is an expression of the form
:
where ''ai'' and ''bi'' can be any complex numbers.
When ''bi'' = 1 for all ''i'' the expression is called a ''simple'' continued fraction.
When the expression contains finitely many terms, it is called a ''finite'' continued fraction.
When the expression contains infinitely many terms, it is called an ''infinite'' continued fraction.
When the terms eventually repeat from some point onwards, the expression is called a periodic continued fraction.
Thus, all of the following illustrate valid finite simple continued fractions:
For simple continued fractions of the form
the term can be calculated using the following recursive formula:
where and
From which it can be understood that the sequence stops if .
Calculating continued fraction representations
Consider a real number .
Let be the integer part of and let
be the
fractional part
The fractional part or decimal part of a non‐negative real number x is the excess beyond that number's integer part. If the latter is defined as the largest integer not greater than , called floor of or \lfloor x\rfloor, its fractional part ca ...
of .
Then the continued fraction representation of is