How to interpret $\left(\begin{smallmatrix}p_n & p_{n-1}\\ q_n & q_{n-1}\end{smallmatrix}\right)$? We know that \begin{equation*}
a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cfrac{1}{\ddots+\cfrac{1}{a_n}}}}}=[a_0,a_1, \cdots, a_n]
\end{equation*}
If $\frac{p_n}{q_n}=[a_0,a_1, \cdots, a_n]$.

How to prove that $$
    \begin{pmatrix}
    p_n & p_{n-1} \\
    q_n & q_{n-1} \\
    \end{pmatrix}=\begin{pmatrix}
    a_0 &1 \\
    1 & 0 \\
    \end{pmatrix}\begin{pmatrix}
    a_1 &1 \\
    1 & 0 \\
    \end{pmatrix}\cdots\begin{pmatrix}
    a_n &1 \\
    1 & 0 \\
    \end{pmatrix}
$$.

I am getting the answer while checking with $n=0,1,2,3$. I think that it could be done by induction but after assuming $k=n-1$ when I am going to prove $k=n$ the calculation is getting messy. Please help me out in proving this.

Consider the canonical map from $GL_2(\mathbb{R})$, the group of invertible $2 \times 2$ matrices, to the group $PGL_1(\mathbb{R})$, the group of projective linear transformations $\mathbb{P}^1_{\mathbb{R}} \to \mathbb{P}^1_{\mathbb{R}}$:
$$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \mapsto \left(x \mapsto \frac{ax+b}{cx+d}\right). $$
Then each matrix $\begin{pmatrix} a_i & 1 \\ 1 & 0 \end{pmatrix}$ corresponds to the transformation $x \mapsto a_i + \frac{1}{x}$.  Therefore, their product corresponds to the composition
$$ x \mapsto a_0 + \frac{1}{a_1 + \frac{1}{\ddots + \frac{1}{a_n + \frac{1}{x}}}}. $$
Suppose the matrix product is $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$.
Then the function above would be equal to $\frac{ax+b}{cx+d}$.  Now, if we substitute $x := 0$, we get
$$ \frac{b}{d} = a_0 + \frac{1}{a_1 + \frac{1}{\ddots + \frac{1}{a_{n-1}}}} = \frac{p_{n-1}}{q_{n-1}}. $$
On the other hand, if we substitute $x := \infty$, we get
$$ \frac{a}{c} = a_0 + \frac{1}{a_1 + \frac{1}{\ddots + \frac{1}{a_n}}} = \frac{p_n}{q_n}. $$
But also, since determinants are multiplicative, we see that the matrix product has determinant $ad - bc = \prod_{i=0}^n (a_i \cdot 0 - 1 \cdot 1) = (-1)^{n+1}$.  It follows that $a$ and $c$ are relatively prime, as are $b$ and $d$.  Since we also know that $a,b,c,d$ are all nonnegative integers, the desired result follows.

Another way to view what this argument is doing, in a more elementary way: first calculate that if
$$ \begin{pmatrix} a_i & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} a \\ b \end{pmatrix} = \begin{pmatrix} c \\ d \end{pmatrix}, $$
then $\frac{c}{d} = a_i + \frac{1}{\frac{a}{b}}$.
Now, if we start multiplying
$$ \begin{pmatrix} a_0 & 1 \\ 1 & 0 \end{pmatrix} \cdots \begin{pmatrix} a_{n-1} & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} a_n & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} $$
from the right to the left, then the first product results in $\begin{pmatrix} 1 \\ 0 \end{pmatrix}$; the second product results in $\begin{pmatrix} a_{n-1} \\ 1 \end{pmatrix}$; the third product results in a vector whose entries have ratio $a_{n-2} + \frac{1}{a_{n-1}}$; and so on.  Therefore, the overall product results in a vector whose entries have ratio $\frac{p_{n-1}}{q_{n-1}}$.  Similarly, if we replace $\begin{pmatrix} 0 \\ 1 \end{pmatrix}$ above with $\begin{pmatrix} 1 \\ 0 \end{pmatrix}$, then the first product results in $\begin{pmatrix} a_n \\ 1 \end{pmatrix}$; the second product results in a vector whose entries have ratio $a_{n-1} + \frac{1}{a_n}$; and so on.  Therefore, the overall product results in a vector whose entries have ratio $\frac{p_n}{q_n}$.
However, these are just the columns of the product matrix.  Now, as above, we consider determinants to show that the columns have entries which are relatively prime nonnegative integers, so that the product matrix must be of the desired form.
