# Gauss's continued fraction

In complex analysis, Gauss's continued fraction is a particular class of continued fractions derived from hypergeometric functions. It was one of the first analytic continued fractions known to mathematics, and it can be used to represent several important elementary functions, as well as some of the more complicated transcendental functions.

## History

Lambert published several examples of continued fractions in this form in 1768, and both Euler and Lagrange investigated similar constructions, but it was Carl Friedrich Gauss who utilized the algebra described in the next section to deduce the general form of this continued fraction, in 1813.
Although Gauss gave the form of this continued fraction, he did not give a proof of its convergence properties. Bernhard Riemann and L.W. Thomé obtained partial results, but the final word on the region in which this continued fraction converges was not given until 1901, by Edward Burr Van Vleck.

## Derivation

Let $f_{0},f_{1},f_{2},\dots$ be a sequence of analytic functions that obey the three-term recurrence relation
    $f_{i-1}=f_{i}+k_{i}\,z\,f_{i+1}$
for all $i>0$, where the $k_{i}$ are constants.
Then
    ${\frac {f_{i-1}}{f_{i}}}=1+k_{i}z{\frac {f_{i+1}}{f_{i}}},{\text{ and so }}{\frac {f_{i}}{f_{i-1}}}={\frac {1}{1+k_{i}z{\frac {f_{i+1}}{f_{i}}}}}$
Setting $g_{i}=f_{i}/f_{i-1},$
    $g_{i}={\frac {1}{1+k_{i}zg_{i+1}}},$
So
    $g_{1}={\frac {f_{1}}{f_{0}}}={\cfrac {1}{1+k_{1}zg_{2}}}={\cfrac {1}{1+{\cfrac {k_{1}z}{1+k_{2}zg_{3}}}}}={\cfrac {1}{1+{\cfrac {k_{1}z}{1+{\cfrac {k_{2}z}{1+k_{3}zg_{4}}}}}}}=\cdots .\$
Repeating this ad infinitum produces the continued fraction expression
    ${\frac {f_{1}}{f_{0}}}={\cfrac {1}{1+{\cfrac {k_{1}z}{1+{\cfrac {k_{2}z}{1+{\cfrac {k_{3}z}{1+\ddots }}}}}}}}$
In Gauss's continued fraction, the functions $f_{i}$ are hypergeometric functions of the form $_{0}F_{1}$, $_{1}F_{1}$, and $_{2}F_{1}$, and the equations $f_{i-1}-f_{i}=k_{i}zf_{i+1}$ arise as identities between functions where the parameters differ by integer amounts. These identities can be proven in several ways, for example by expanding out the series and comparing coefficients, or by taking the derivative in several ways and eliminating it from the equations generated.

### The series $_0$F$_1$

The simplest case involves
    $\,_{0}F_{1}(a;z)=1+{\frac {1}{a\,1!}}z+{\frac {1}{a(a+1)\,2!}}z^{2}+{\frac {1}{a(a+1)(a+2)\,3!}}z^{3}+\cdots .$
Starting with the identity
    $\,_{0}F_{1}(a-1;z)-\,_{0}F_{1}(a;z)={\frac {z}{a(a-1)}}\,_{0}F_{1}(a+1;z),$
we may take
    $f_{i}=_{0}F_{1}(a+i;z),\,k_{i}={\tfrac {1}{(a+i)(a+i-1)}},$
giving
    ${\frac {\,_{0}F_{1}(a+1;z)}{\,_{0}F_{1}(a;z)}}={\cfrac {1}{1+{\cfrac {{\frac {1}{a(a+1)}}z}{1+{\cfrac {{\frac {1}{(a+1)(a+2)}}z}{1+{\cfrac {{\frac {1}{(a+2)(a+3)}}z}{1+\ddots }}}}}}}}$
or
    ${\frac {\,_{0}F_{1}(a+1;z)}{a\,_{0}F_{1}(a;z)}}={\cfrac {1}{a+{\cfrac {z}{(a+1)+{\cfrac {z}{(a+2)+{\cfrac {z}{(a+3)+\ddots }}}}}}}}.$
This expansion converges to the meromorphic function defined by the ratio of the two convergent series (provided, of course, that a is neither zero nor a negative integer).

### The series $_1$F$_1$

The next case involves
    $_{1}F_{1}(a;b;z)=1+{\frac {a}{b\,1!}}z+{\frac {a(a+1)}{b(b+1)\,2!}}z^{2}+{\frac {a(a+1)(a+2)}{b(b+1)(b+2)\,3!}}z^{3}+\cdots$
for which the two identities
    $\,_{1}F_{1}(a;b-1;z)-\,_{1}F_{1}(a+1;b;z)={\frac {(a-b+1)z}{b(b-1)}}\,_{1}F_{1}(a+1;b+1;z)$
    $\,_{1}F_{1}(a;b-1;z)-\,_{1}F_{1}(a;b;z)={\frac {az}{b(b-1)}}\,_{1}F_{1}(a+1;b+1;z)$
are used alternately.
Let
    $f_{0}(z)=\,_{1}F_{1}(a;b;z),$
    $f_{1}(z)=\,_{1}F_{1}(a+1;b+1;z),$
    $f_{2}(z)=\,_{1}F_{1}(a+1;b+2;z),$
    $f_{3}(z)=\,_{1}F_{1}(a+2;b+3;z),$
    $f_{4}(z)=\,_{1}F_{1}(a+2;b+4;z),$
etc.
This gives $f_{i-1}-f_{i}=k_{i}zf_{i+1}$ where $k_{1}={\tfrac {a-b}{b(b+1)}},k_{2}={\tfrac {a+1}{(b+1)(b+2)}},k_{3}={\tfrac {a-b-1}{(b+2)(b+3)}},k_{4}={\tfrac {a+2}{(b+3)(b+4)}}$, producing
    ${\frac {_{1}F_{1}(a+1;b+1;z)}{_{1}F_{1}(a;b;z)}}={\cfrac {1}{1+{\cfrac {{\frac {a-b}{b(b+1)}}z}{1+{\cfrac {{\frac {a+1}{(b+1)(b+2)}}z}{1+{\cfrac {{\frac {a-b-1}{(b+2)(b+3)}}z}{1+{\cfrac {{\frac {a+2}{(b+3)(b+4)}}z}{1+\ddots }}}}}}}}}}$
or
    ${\frac {_{1}F_{1}(a+1;b+1;z)}{b_{1}F_{1}(a;b;z)}}={\cfrac {1}{b+{\cfrac {(a-b)z}{(b+1)+{\cfrac {(a+1)z}{(b+2)+{\cfrac {(a-b-1)z}{(b+3)+{\cfrac {(a+2)z}{(b+4)+\ddots }}}}}}}}}}$
Similarly
    ${\frac {_{1}F_{1}(a;b+1;z)}{_{1}F_{1}(a;b;z)}}={\cfrac {1}{1+{\cfrac {{\frac {a}{b(b+1)}}z}{1+{\cfrac {{\frac {a-b-1}{(b+1)(b+2)}}z}{1+{\cfrac {{\frac {a+1}{(b+2)(b+3)}}z}{1+{\cfrac {{\frac {a-b-2}{(b+3)(b+4)}}z}{1+\ddots }}}}}}}}}}$
or
    ${\frac {_{1}F_{1}(a;b+1;z)}{b_{1}F_{1}(a;b;z)}}={\cfrac {1}{b+{\cfrac {az}{(b+1)+{\cfrac {(a-b-1)z}{(b+2)+{\cfrac {(a+1)z}{(b+3)+{\cfrac {(a-b-2)z}{(b+4)+\ddots }}}}}}}}}}$
Since $_{1}F_{1}(0;b;z)=1$, setting a to 0 and replacing b + 1 with b in the first continued fraction gives a simplified special case:
    $_{1}F_{1}(1;b;z)={\cfrac {1}{1+{\cfrac {-z}{b+{\cfrac {z}{(b+1)+{\cfrac {-bz}{(b+2)+{\cfrac {2z}{(b+3)+{\cfrac {-(b+1)z}{(b+4)+\ddots }}}}}}}}}}}}$

### The series $_2$F$_1$

The final case involves
    $_{2}F_{1}(a,b;c;z)=1+{\frac {ab}{c\,1!}}z+{\frac {a(a+1)b(b+1)}{c(c+1)\,2!}}z^{2}+{\frac {a(a+1)(a+2)b(b+1)(b+2)}{c(c+1)(c+2)\,3!}}z^{3}+\cdots .\,$
Again, two identities are used alternately.
    $\,_{2}F_{1}(a,b;c-1;z)-\,_{2}F_{1}(a+1,b;c;z)={\frac {(a-c+1)bz}{c(c-1)}}\,_{2}F_{1}(a+1,b+1;c+1;z),$
    $\,_{2}F_{1}(a,b;c-1;z)-\,_{2}F_{1}(a,b+1;c;z)={\frac {(b-c+1)az}{c(c-1)}}\,_{2}F_{1}(a+1,b+1;c+1;z).$
These are essentially the same identity with a and b interchanged.
Let
    $f_{0}(z)=\,_{2}F_{1}(a,b;c;z),$
    $f_{1}(z)=\,_{2}F_{1}(a+1,b;c+1;z),$
    $f_{2}(z)=\,_{2}F_{1}(a+1,b+1;c+2;z),$
    $f_{3}(z)=\,_{2}F_{1}(a+2,b+1;c+3;z),$
    $f_{4}(z)=\,_{2}F_{1}(a+2,b+2;c+4;z),$
etc.
This gives $f_{i-1}-f_{i}=k_{i}zf_{i+1}$ where $k_{1}={\tfrac {(a-c)b}{c(c+1)}},k_{2}={\tfrac {(b-c-1)(a+1)}{(c+1)(c+2)}},k_{3}={\tfrac {(a-c-1)(b+1)}{(c+2)(c+3)}},k_{4}={\tfrac {(b-c-2)(a+2)}{(c+3)(c+4)}}$, producing
    ${\frac {_{2}F_{1}(a+1,b;c+1;z)}{_{2}F_{1}(a,b;c;z)}}={\cfrac {1}{1+{\cfrac {{\frac {(a-c)b}{c(c+1)}}z}{1+{\cfrac {{\frac {(b-c-1)(a+1)}{(c+1)(c+2)}}z}{1+{\cfrac {{\frac {(a-c-1)(b+1)}{(c+2)(c+3)}}z}{1+{\cfrac {{\frac {(b-c-2)(a+2)}{(c+3)(c+4)}}z}{1+\ddots }}}}}}}}}}$
or
    ${\frac {_{2}F_{1}(a+1,b;c+1;z)}{c_{2}F_{1}(a,b;c;z)}}={\cfrac {1}{c+{\cfrac {(a-c)bz}{(c+1)+{\cfrac {(b-c-1)(a+1)z}{(c+2)+{\cfrac {(a-c-1)(b+1)z}{(c+3)+{\cfrac {(b-c-2)(a+2)z}{(c+4)+\ddots }}}}}}}}}}$
Since $_{2}F_{1}(0,b;c;z)=1$, setting a to 0 and replacing c + 1 with c gives a simplified special case of the continued fraction:
    $_{2}F_{1}(1,b;c;z)={\cfrac {1}{1+{\cfrac {-bz}{c+{\cfrac {(b-c)z}{(c+1)+{\cfrac {-c(b+1)z}{(c+2)+{\cfrac {2(b-c-1)z}{(c+3)+{\cfrac {-(c+1)(b+2)z}{(c+4)+\ddots }}}}}}}}}}}}$

## Convergence properties

In this section, the cases where one or more of the parameters is a negative integer are excluded, since in these cases either the hypergeometric series are undefined or that they are polynomials so the continued fraction terminates. Other trivial exceptions are excluded as well.
In the cases $_{0}F_{1}$ and $_{1}F_{1}$, the series converge everywhere so the fraction on the left hand side is a meromorphic function. The continued fractions on the right hand side will converge uniformly on any closed and bounded set that contains no poles of this function.
In the case $_{2}F_{1}$, the radius of convergence of the series is 1 and the fraction on the left hand side is a meromorphic function within this circle. The continued fractions on the right hand side will converge to the function everywhere inside this circle.
Outside the circle, the continued fraction represents the analytic continuation of the function to the complex plane with the positive real axis, from +1 to the point at infinity removed. In most cases +1 is a branch point and the line from +1 to positive infinity is a branch cut for this function. The continued fraction converges to a meromorphic function on this domain, and it converges uniformly on any closed and bounded subset of this domain that does not contain any poles.

## Applications
### The series $_0$F$_1$

We have
    $\cosh(z)=\,_{0}F_{1}({\tfrac {1}{2}};{\tfrac {z^{2}}{4}}),$
    $\sinh(z)=z\,_{0}F_{1}({\tfrac {3}{2}};{\tfrac {z^{2}}{4}}),$
so
    $\tanh(z)={\frac {z\,_{0}F_{1}({\tfrac {3}{2}};{\tfrac {z^{2}}{4}})}{\,_{0}F_{1}({\tfrac {1}{2}};{\tfrac {z^{2}}{4}})}}={\cfrac {z/2}{{\tfrac {1}{2}}+{\cfrac {\tfrac {z^{2}}{4}}{{\tfrac {3}{2}}+{\cfrac {\tfrac {z^{2}}{4}}{{\tfrac {5}{2}}+{\cfrac {\tfrac {z^{2}}{4}}{{\tfrac {7}{2}}+\ddots }}}}}}}}={\cfrac {z}{1+{\cfrac {z^{2}}{3+{\cfrac {z^{2}}{5+{\cfrac {z^{2}}{7+\ddots }}}}}}}}.$
This particular expansion is known as Lambert's continued fraction and dates back to 1768.
It easily follows that
    $\tan(z)={\cfrac {z}{1-{\cfrac {z^{2}}{3-{\cfrac {z^{2}}{5-{\cfrac {z^{2}}{7-\ddots }}}}}}}}.$
The expansion of tanh can be used to prove that e$^n$ is irrational for every non-zero integer n (which is alas not enough to prove that e is transcendental). The expansion of tan was used by both Lambert and Legendre to prove that π is irrational.
The Bessel function $J_{\nu }$ can be written
    $J_{\nu }(z)={\frac {({\tfrac {1}{2}}z)^{\nu }}{\Gamma (\nu +1)}}\,_{0}F_{1}(\nu +1;-{\frac {z^{2}}{4}}),$
from which it follows
    ${\frac {J_{\nu }(z)}{J_{\nu -1}(z)}}={\cfrac {z}{2\nu -{\cfrac {z^{2}}{2(\nu +1)-{\cfrac {z^{2}}{2(\nu +2)-{\cfrac {z^{2}}{2(\nu +3)-\ddots }}}}}}}}.$
These formulas are also valid for every complex z.

### The series $_1$F$_1$

Since $e^{z}=_{1}F_{1}(1;1;z)$, $1/e^{z}=e^{-z}$
    $e^{z}={\cfrac {1}{1+{\cfrac {-z}{1+{\cfrac {z}{2+{\cfrac {-z}{3+{\cfrac {2z}{4+{\cfrac {-2z}{5+\ddots }}}}}}}}}}}}$
    $e^{z}=1+{\cfrac {z}{1+{\cfrac {-z}{2+{\cfrac {z}{3+{\cfrac {-2z}{4+{\cfrac {2z}{5+\ddots }}}}}}}}}}.$
With some manipulation, this can be used to prove the simple continued fraction representation of e,
    $e=2+{\cfrac {1}{1+{\cfrac {1}{2+{\cfrac {1}{1+{\cfrac {1}{1+{\cfrac {1}{4+\ddots }}}}}}}}}}$
The error function erf (z), given by
    $\operatorname {erf} (z)={\frac {2}{\sqrt {\pi }}}\int _{0}^{z}e^{-t^{2}}\,dt,$
can also be computed in terms of Kummer's hypergeometric function:
    $\operatorname {erf} (z)={\frac {2z}{\sqrt {\pi }}}e^{-z^{2}}\,_{1}F_{1}(1;{\scriptstyle {\frac {3}{2}}};z^{2}).$
By applying the continued fraction of Gauss, a useful expansion valid for every complex number z can be obtained:
    ${\frac {\sqrt {\pi }}{2}}e^{z^{2}}\operatorname {erf} (z)={\cfrac {z}{1-{\cfrac {z^{2}}{{\frac {3}{2}}+{\cfrac {z^{2}}{{\frac {5}{2}}-{\cfrac {{\frac {3}{2}}z^{2}}{{\frac {7}{2}}+{\cfrac {2z^{2}}{{\frac {9}{2}}-{\cfrac {{\frac {5}{2}}z^{2}}{{\frac {11}{2}}+{\cfrac {3z^{2}}{{\frac {13}{2}}-{\cfrac {{\frac {7}{2}}z^{2}}{{\frac {15}{2}}+-\ddots }}}}}}}}}}}}}}}}.$
A similar argument can be made to derive continued fraction expansions for the Fresnel integrals, for the Dawson function, and for the incomplete gamma function. A simpler version of the argument yields two useful continued fraction expansions of the exponential function.

### The series $_2$F$_1$

From
    $(1-z)^{-b}=_{1}F_{0}(b;;z)=\,_{2}F_{1}(1,b;1;z),$
    $(1-z)^{-b}={\cfrac {1}{1+{\cfrac {-bz}{1+{\cfrac {(b-1)z}{2+{\cfrac {-(b+1)z}{3+{\cfrac {2(b-2)z}{4+\ddots }}}}}}}}}}$
It is easily shown that the Taylor series expansion of arctan z in a neighborhood of zero is given by
    $\arctan z=zF({\scriptstyle {\frac {1}{2}}},1;{\scriptstyle {\frac {3}{2}}};-z^{2}).$
The continued fraction of Gauss can be applied to this identity, yielding the expansion
    $\arctan z={\cfrac {z}{1+{\cfrac {(1z)^{2}}{3+{\cfrac {(2z)^{2}}{5+{\cfrac {(3z)^{2}}{7+{\cfrac {(4z)^{2}}{9+\ddots }}}}}}}}}},$
which converges to the principal branch of the inverse tangent function on the cut complex plane, with the cut extending along the imaginary axis from i to the point at infinity, and from −i to the point at infinity.
This particular continued fraction converges fairly quickly when z = 1, giving the value π/4 to seven decimal places by the ninth convergent. The corresponding series
    ${\frac {\pi }{4}}={\cfrac {1}{1+{\cfrac {1^{2}}{2+{\cfrac {3^{2}}{2+{\cfrac {5^{2}}{2+\ddots }}}}}}}}=1-{\frac {1}{3}}+{\frac {1}{5}}-{\frac {1}{7}}\pm \cdots$
converges much more slowly, with more than a million terms needed to yield seven decimal places of accuracy.
Variations of this argument can be used to produce continued fraction expansions for the natural logarithm, the arcsin function, and the generalized binomial series.