TITLE: Limit of a sequence of integrals involving continued fractions
QUESTION [16 upvotes]: The following question was asked in a calculus exam in UNI, a Peruvian university. It is meant to be for freshman calculus students.

Find $\lim_{n \to \infty} A_n $ if 
$$ A_1 = \int\limits_0^1 \frac{dx}{1 + \sqrt{x} }, \; \; \; A_2 =
 \int\limits_0^1 \frac{dx}{1 + \frac{1}{1+\sqrt{x}} }, \; \; \; A_3 =
 \int\limits_0^1 \frac{dx}{1 + \frac{1}{1+\frac{1}{1+\sqrt{x}}} },
 ...$$

First of all, I think this is a hard question for a midterm exam, but anyway, notice that we can calculate $A_1$ by making $t=\sqrt{x}$
$$ A_1 = \int\limits_0^1 \frac{2 t dt }{1+t} = 2 \int\limits_0^1 dt - 2 \int\limits_0^1 \frac{dt}{1+t}=2-2(\ln2)=2-\ln2^2 $$
Now, as for $A_2$ I would do $t = \frac{1}{1+\sqrt{x}}$ which gives $d t = \frac{ dx}{2 \sqrt{x} (1+\sqrt{x})^2} = \frac{t^2 dx}{2 (t-1)}$ thus upon sustituticion we get 
$$ A_2 = - \int\limits_1^{1/2} \frac{2 (t-1) }{t^2(1+t) } dt $$
which can easily solved by partial fractions or so. But, apparently this is not the way this problem is meant to be solved as this exam contained 4 questions to be solved in an hour. What is the trick, if any, that can be used to solve this problem without doing the unellegant  partial fractions?

REPLY [2 votes]: $\sqrt{x}$
is a McGuffin.
More generally,
let
$f_1 =  \frac{1}{1 + g(x) }
$
where
$g'(x) > 0,
g(0) = 0
$,
$f_n(x)
 =\frac{1}{1+f_{n-1}(x)}
$,
and
$A_n = \int_0^1 f_n(x) dx
$.
Then
$f_n(x)
\to \dfrac{\sqrt{5}-1}{2}
$.
Note:
I doubt that any of this
is original,
but this was all done
just now by me.
Proof.
$\begin{array}\\
f_n(x)
&=\frac{1}{1+\frac{1}{1+f_{n-2}(x)}}\\
&=\frac{1+f_{n-2}(x)}{1+f_{n-2}(x)+1}\\
&=\frac{1+f_{n-2}(x)}{2+f_{n-2}(x)}\\
\end{array}
$
Therefore,
if $f_{n-2}(x) > 0$
then
$\frac12 < f_n(x)
\lt 1$.
Similarly,
if $f_{n-1}(x) > 0$
then
$0 < f_n(x)
\lt 1$.
$\begin{array}\\
f_n(x)-f_{n-2}(x)
&=\dfrac{1+f_{n-2}(x)}{2+f_{n-2}(x)}-f_{n-2}(x)\\
&=\dfrac{1+f_{n-2}(x)-f_{n-2}(x)(2+f_{n-2}(x))}{2+f_{n-2}(x)}\\
&=\dfrac{1-f_{n-2}(x)-f_{n-2}^2(x)}{2+f_{n-2}(x)}\\
\end{array}
$
$\begin{array}\\
f_n(x)+f_n^2(x)
&=\dfrac{1+f_{n-2}(x)}{2+f_{n-2}(x)}+(\dfrac{1+f_{n-2}(x)}{2+f_{n-2}(x)})^2\\
&=\dfrac{(1+f_{n-2}(x))(2+f_{n-2}(x))}{(2+f_{n-2}(x))^2}+\dfrac{1+2f_{n-2}(x)+f_{n-2}^2(x)}{(2+f_{n-2}(x))^2}\\
&=\dfrac{2+3f_{n-2}(x)+f_{n-2}^2(x)+1+2f_{n-2}(x)+f_{n-2}^2(x)}{(2+f_{n-2}(x))^2}\\
&=\dfrac{3+5f_{n-2}(x)+2f_{n-2}^2(x)}{(2+f_{n-2}(x))^2}\\
\text{so}\\
1-f_n(x)-f_n^2(x)
&=\dfrac{4+4f_{n-2}(x)+f_{n-2}^2(x)-(3+5f_{n-2}(x)+2f_{n-2}^2(x))}{(2+f_{n-2}(x))^2}\\
&=\dfrac{1-f_{n-2}(x)-f_{n-2}^2(x)}{(2+f_{n-2}(x))^2}\\
\end{array}
$
Therefore
$1-f_n(x)-f_n^2(x)$
has the same sign as
$1-f_{n-2}(x)-f_{n-2}^2(x)$.
Also,
$|1-f_n(x)-f_n^2(x)|
\lt \frac14|1-f_{n-2}(x)-f_{n-2}^2(x)|
$
so
$|1-f_n(x)-f_n^2(x)|
\to 0$.
Let
$p(x) = 1-x-x^2$
and
$x_0 = \frac{\sqrt{5}-1}{2}
$
so
$p(x_0) = 0$,
$p'(x) < 0$ for $x \ge 0$.
Since
$f_n(x) > 0$,
$f_n(x)
\to x_0$.