## The Value of a Finite Continued Fraction

Theorem (The Value of a Finite Continued Fraction)
Let
$[ a_1,a_2,...,a_{n-1},a_n ]$
be a finite continued fraction. Define the numerators
$p_1, \; p_2,..., \; p_{n-1}, \; p_n$
and the denominators
$q_1, \; q_2,..., \; q_{n-1}, \; q_n$
of the convergents by
$p_1=a_1, \; p_2=a_1a_2+1, \; p_k=a_kp_{k-1}+p_{k-2}, \; 1 \le 3 k \le n$

$q_1=1, \; q_2=a_2, \; q_k=a_kq_{k-1}+q_{k-2}, \; 1 \le 3 k \le n$

Then the value of the finite continued fraction is
$\frac{p_n}{q_n}$
.
Proof
Proof is by induction. Let
$P(k)$
be the statement that the value of
$[ a_1,a_2,...,a_{k-1},a_k ]$
is
$\frac{p_k}{q_k}$
, with
$p_k, \; q_k$
as defined above.
Then
$P(1)$
is true since
$[ a_1 ] = \frac{a_1}{1}= \frac{p_1}{q_1}$
.
$[ a_1, a_2 ] =a_1 + \frac{1}{a_2} = \frac{a_1a_2+1}{a_2}= \frac{p_2}{q_2}$
so
$P(2)$
is true.
Suppose then that
$P(k)$
is true for all integers up to and including
$k$
. Consider
$[ a_1,a_2,...,a_{k-1},a_k, a_{k+1} ]$
. The numerators of the convergents are
$p_1, \; p_2,..., \; p_{k-1}, \; p_k, \; p_{k+1}$
and the denominators are
$q_1, \; q_2,..., \; q_{k-1}, \; q_k, \; q_{k+1}$
.
By The Second Continued Fraction Identity,
$[ a_1,a_2,...,a_k,a_{k+1} ]= [ a_1,a_2,...,a_k+\frac{1}{a_{k+1}} ]$
.
The first
$k$
numerators of the convergents of this continued fraction are
$p_1, \; p_2,..., p_{k-1}, \; p'_k=a_k+\frac{1}{a_{k+1}}p_{k-1}+p_{k-2}$
.
The first
$k$
denominators are
$q_1, \; q_2,..., q_{k-1}, \; q'_k=a_k+\frac{1}{a_{k+1}}q_{k-1}+q_{k-2}$
.
The kth convergent is
$\frac{p_k}{q_k}$
.
\begin{aligned} \left[ a_1,a_2,...,a_k,a_{k+1} \right] &= \frac{p'_k}{q'_k} \\ &= \frac{(a_k+\frac{1}{a_{k+1}})p_{k-1}+p_{k-2}}{(a_k+\frac{1}{a_{k+1}})q_{k-1}+q_{k-2}} \\ &= \frac{a_{k+1}(a_kp_{k-1}+p_{k-2})+p_k}{a_{k+1}(a_kq_{k-1}+q_{k-2})+q_k} \\ &= \frac{a_{k+1}p_k+p_{k-1}}{a_{k+1}q_k+q_{k-1}}\\ &= \frac{p_{k+1}}{q_{k+1}} \end{aligned}