<s>[INST] Sequence of fractions that converges to $\sqrt{n}$ Begin with any two positive integers $a,b$. Let
$$s_1 = \frac{a}{b}$$
and recursively we define $s_{i+1}$ from $s_i$ as follows: If ${s_i}$ is the fraction $\frac{a'}{b'}$, then set
$$s_{i+1} = \frac{a'+2b'}{a'+b'}$$
(Notice that the actual value of the $s_{i+1}$ does not depend on the exact way we choose to represent $s_i$ in fractions)
How do we show that $s_i \to \sqrt{2}$ as $i\to \infty$?
In general, sending $\frac{a'}{b'}$ to $\frac{a'+nb'}{a'+b'}$ supposedly leads to $s_i \to \sqrt{n}$. How might we prove this?
 [/INST] Let $t_i$ denote the top part of the fraction and $\ell_i$ the bottom part. Then $t_0 = a$, $\ell_0 = b$ and
$$
\begin{pmatrix} t_{i+1} \\ \ell_{i+1} \end{pmatrix} = \begin{pmatrix} 1 & n \\ 1 & 1 \end{pmatrix}\begin{pmatrix} t_{i} \\ \ell_{i} \end{pmatrix}.
$$
You can then diagonalize the middle matrix
$$
\begin{pmatrix} 1 & n \\ 1 & 1 \end{pmatrix} = P^{-1}DP.
$$
It then follows that 
\begin{align}
\begin{pmatrix} t_{i} \\ \ell_{i} \end{pmatrix} &= P^{-1}D^iP\begin{pmatrix} t_{0} \\ \ell_{0} \end{pmatrix} = P^{-1}\begin{pmatrix} d_{1}^{i} & 0 \\ 0 & d_{2}^{i} \end{pmatrix}P\begin{pmatrix} a \\ b \end{pmatrix}.
\end{align}
</s>