I am working on my senior thesis and have encountered, unexpectedly, a finite continued fraction that I would be interested in resolving. I already know the answer (by an informed guess based on where the problem came from) but I was hoping that there was a less magic solution.
Unfortunately, my web searches turned up very little on continued fractions of the finite variety, so I was hoping that someone might be able to help me or at least point me toward some theory.
Anyway, the problem is probably about as simple as one could hope for in this area: given an indeterminate $\lambda$, what are the roots of $$\lambda + \frac{1}{\lambda+\frac{1}{\lambda+\frac{1}{\cdots\,\lambda}}}$$ where there are $n$-many $\lambda$s in the expression?
EDIT: Some combinatorial considerations show that the numerator of this expression is $$\sum_k \binom{n-k}{k}\lambda^{n-2k}.$$
I know that the roots of this are all the numbers of the form $2i\cos\frac{k\pi}{n+1}$ for $1\leq k\leq n$, but only because of that magic guess from above.
Here is the outline of a method with no magic guesses. I deliberately omit some computationals details here, but I can be more specific if you ask.
In your context it is natural to consider the sequence defined by $u_1=\lambda, \ u_{n+1}=f(u_n)$ where $f(z)=\lambda+\frac{1}{z}$. Then, what you are looking for is solutions to the equation $u_{n}=0$. Now the map $f$ is homographic, and may be viewed as the action of a particular $2\times 2$ matrix (namely $A=\left(\begin{array}{cc} \lambda & 1 \\ 1 & 0\end{array}\right)$) on $\mathbb C$.
To find a nice expression for $A^n$, one naturally looks for the eigenvalues of $A$, $\alpha$ and $\beta$. We now have three variables : $\lambda,\alpha$ and $\beta$ but luckily they can all be expressed in terms of $\alpha$ : $\beta=-\frac{1}{\alpha},\lambda=\alpha-\frac{1}{\alpha}$.
The standard change of basis computation technique shows that $A^n$ is of the form
$$A^{n-1}=\left(\begin{array}{c|c} c_1=\alpha^{n+1}+(-\frac{1}{\alpha})^{n-1} & c_2=\alpha^{n}+(-\frac{1}{\alpha})^{n-2} \\\hline\\ \ldots & \ldots \end{array}\right)$$
So $u_{n}$ can be written as a fraction whose numerator is $c_1\lambda+c_2=\alpha^{n+2}+(\frac{-1}{\alpha})^n$. This is zero iff $\alpha^{2(n+1)}=(-1)^n$, which implies that $\alpha$ is always a $4(n+1)$-th root of unity (and a $2(n+1)$-th root of unity when $n$ is even). It is easy to recover your cosines from here.