\section{}



\definition{}
A \textit{finite continued fraction} is an expression of the form
\[
a_0 + \cfrac{1}{a_1+\cfrac{1}{a_2 + \cfrac{1}{a_3 + ... + \cfrac{1}{a_{k-1} + \cfrac{1}{a_k}}}}}
\]
where $a_0, a_1, ..., a_k$ are all in $\mathbb{Z}^+_0$.
We'll denote this as $[a_0, a_1, ..., a_k]$.





\problem{}<num2cf>
Write each of the following as a continued fraction. \par
\hint{Solve for one $a_n$ at a time.}
\begin{itemize}
	\item $5/12$
	\item $5/3$
	\item $33/23$
	\item $37/31$
\end{itemize}


\vfill


\problem{}
Write each of the following continued fractions as a regular fraction in lowest terms: \par
\begin{itemize}
	\item $[2,3,2]$
	\item $[1,4,6,4]$
	\item $[2,3,2,3]$
	\item $[9,12,21,2]$
\end{itemize}


\vfill
\pagebreak

\problem{}<euclid>
Let $\frac{p}{q}$ be a positive rational number in lowest terms.
Perform the Euclidean algorithm to obtain the following sequence:
\begin{align*}
    p \ &= \ q_0 q + r_1 \\
    q \ &= \ q_1 r_1 + r_2 \\
    r_1 \ &= \ q_2 r_2 + r_3 \\
    &\vdots \\
    r_{k-1} \ &= \ q_k r_k + 1 \\
    r_k \ &= \ q_{k+1}
\end{align*}
We know that we will eventually get $1$ as the remainder because $p$ and $q$ are relatively prime. \par
Show that $p/q = [q_0, q_1, ..., q_{k+1}]$.


\vfill


\problem{}
Repeat \ref{num2cf} using the method outlined in \ref{euclid}.


\vfill
\pagebreak







\definition{}
An \textit{infinite continued fraction} is an expression of the form
\[
a_0 + \cfrac{1}{a_1+\cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4 + ...}}}}
\]
where $a_0, a_1, a_2, ...$ are in $\mathbb{Z}^+_0$.
To prove that this expression actually makes sense and equals a finite number
is beyond the scope of this worksheet, so we assume it for now.
This is denoted $[a_0, a_1, a_2, ...]$.






\problem{}<irrational>
Using a calculator, compute the first five terms of the
continued fraction expansion of the following numbers.
Do you see any patterns?

\begin{itemize}
	\item $\sqrt{2}$
	\item $\pi \approx 3.14159...$
	\item $\sqrt{5}$
	\item $e \approx 2.71828...$
\end{itemize}


\vfill




\problem{}
Show that an $\alpha \in \mathbb{R}^+$ can be written as a finite
continued fraction if and only if $\alpha$ is rational. \par
\hint{For one of the directions, use \ref{euclid}}



\vfill
\pagebreak


\definition{}
The continued fraction $[a_0, a_1, a_2, ...]$ is \textit{periodic} if it ends in a repeating sequence of digits. \par
A few examples are below. We denote the repeating sequence with a line.
\begin{itemize}
	\item $[1,2,2,2,...] = [1, \overline{2}]$ is periodic.
	\item $[1,2,3,4,5,...]$ is not periodic.
	\item $[1,3,7,6,4,3,4,3,4,3,...] = [1,3,7,6,\overline{4,3}]$ is periodic.
	\item $[1,2,4,8,16, ...]$ is not periodic.
\end{itemize}





\problem{}
\begin{itemize}
	\item Show that $\sqrt{2} = [1, \overline{2}]$.
	\item Show that $\sqrt{5} = [1, \overline{4}]$.
\end{itemize}
\hint{use the same strategy as \ref{irrational} but without a calculator.}


\vfill



\problem{Challenge I}
Express the following continued fractions in the form $\frac{a+\sqrt{b}}{c}$ where $a$, $b$, and $c$ are integers: \par
\begin{itemize}
	\item $[~\overline{1}~]$
	\item $[~\overline{2,5}~]$
	\item $[~1, 3, \overline{2,3}~]$
\end{itemize}



\vfill




\problem{Challenge II}
Let $\alpha = [~a_0,~ ...,~ a_r,~ \overline{a_{r+1},~ ...,~ a_{r+p}}~]$ be any periodic continued fraction. \par
Prove that $\alpha$ is of the form $\frac{a+\sqrt{b}}{c}$ for some integers $a,b,c$ where $b$ is not a perfect square.



\vfill



\problem{Challenge III}
Prove that any number of the form $\frac{a+\sqrt{b}}{c}$ where $a,b,c$ are integers
and $b$ is not a perfect square can be written as a periodic continued fraction.



%\begin{rmk}
%Numbers of the form $\frac{a+\sqrt{b}}{c}$ where $a,b,c$ are integers and $b$ is not a perfect square are the ``simplest'' irrational numbers in the following sense.  A number is rational if and only if it is the solution to a degree $1$ polynomial equation, $ax+b = 0$.  Similarly, a number is of the form $\frac{a+\sqrt{b}}{c}$ if it is the solution to a degree $2$ polynomial equation, $ax^2 + bx + c = 0$ (Bonus exercise: prove this).  Such numbers are called \textit{quadratic} irrational numbers or \textit{degree 2} irrational numbers.
%\end{rmk}





%\begin{rmk}
%Notice that the results of this worksheet provide a very clean characterization of continued fraction expansions:
%\begin{itemize}
%\item $\alpha$ is a rational number if and only if it has a finite continued fraction expansion.
%\item $\alpha$ is a degree $2$ irrational number if and only if it has an infinite periodic continued fraction expansion.
%\end{itemize}
%\end{rmk}


\vfill
\pagebreak