Is there a pattern to the roots of continued-fraction equations with depth $n$?

I've found what looks like the start of a pattern, but I don't have the tools or background to know if one really exists here. Does anyone know how to analyze this mathematical behavior and continue the pattern?

Consider the continued fraction $f_n(x) = [0; x, x, x, ...]$, a zero followed by $n$ $x$s. This represents the continued fraction

$$f_n(x) = 0 + \frac{1}{x + \frac{1}{x + \frac{1}{x + ...}}}$$

with $n$ layers of depth. Thus

  • for $n = 0$ we have $f_0(x) = 0$,
  • for $n = 1$ we have $f_1(x) = 0 + \frac{1}{x} = \frac{1}{x}$,
  • for $n = 2$ we have $f_2(x) = 0 + \frac{1}{x + \frac{1}{x}} = \frac{x}{x^2 + 1}$,
  • for $n = 3$ we have $f_3(x) = 0 + \frac{1}{x + \frac{1}{x + \frac{1}{x}}} = \frac{x^2 + 1}{x^3 + 2 x}$,

and so on.

If we include a single complex point at infinity and claim that $\frac{1}{∞}$ is zero, $f_n(x)$ has $n$ roots, all of which lie on the imaginary axis. All roots are symmetrical about the real axis. These roots seem to follow patterns related to the Beraha Constants, $B(n) = 2 + 2 \cos\left(\frac{2 π}{n}\right)$, at least for the first several $n$s.

The sets of roots for $n$ from 1 to 10, in terms of $B(n)$ where I can figure out the connection, are as follows:

  • $n$ = 1: ∞
  • $n$ = 2: ∞, $ i \sqrt{B( 2)}$
  • $n$ = 3: ∞, $±i \sqrt{B( 3)}$
  • $n$ = 4: ∞, $±i \sqrt{B( 4)}$, $ i (B( 4) - 2)$
  • $n$ = 5: ∞, $±i \sqrt{B( 5)}$, $±i (B( 5) - 2)$
  • $n$ = 6: ∞, $±i \sqrt{B( 6)}$, $±i (B( 6) - 2)$, 0
  • $n$ = 7: ∞, $±i \sqrt{B( 7)}$, $±i (B( 7) - 2)$, $±i \frac{1}{1 + 2 \cos\left(\frac{2 π}{7}\right)}$
  • $n$ = 8: ∞, $±i \sqrt{B( 8)}$, $±i (B( 8) - 2)$, $±i \sqrt{2 - \sqrt{2}}$, 0
  • $n$ = 9: ∞, $±i \sqrt{B( 9)}$, $±i (B( 9) - 2)$, $±i, ±2 i \sin\left(\frac{π}{18}\right)$
  • $n$ = 10: ∞, $±i \sqrt{B(10)}$, $±i (B(10) - 2)$, $±i \sqrt{\frac{5 - \sqrt{5}}{2}}$, $±i \sqrt{\frac{3 - \sqrt{5}}{2}}$, 0

The first set of roots for each value of $n$ greater than 1 has a magnitude of $\sqrt{B(n)}$. The second set for $n$ greater than 3 has a magnitude of $B(n) - 2$. The third set for $n$ greater than 5 and the fourth set for $n$ greater than 7 seem to be following a similar structure, starting at zero and then rising towards an upper limit with a shallower slope each time, but I haven't been able to figure out a relation to the Beraha Constants for them, and I haven't been able to see any meta-pattern in the relations with only two instances of such a a relation to build off of.

So my question is this: is there a pattern to the roots beyond $\sqrt{B(n)}$ and $B(n) - 2$? Some way to know the roots of $f_n(x)$ for arbitrary values of $n$ without needing to calculate a continued fraction dozens of layers deep (equivalent to a function of degree $n$, which quickly becomes unmanageable)?

At minimum I'd like an equation $g(B(n))$ that gives the values $0$, $\frac{1}{1 + 2 \cos\left(\frac{2 π}{7}\right)}$, $\sqrt{2 - \sqrt{2}}$, $1$, and $\sqrt{\frac{5 - \sqrt{5}}{2}}$ for $n$ from 6 to 10, and an equation $h(B(n))$ that gives the values $0$, $2 \sin\left(\frac{π}{18}\right)$, and $\sqrt{\frac{3 - \sqrt{5}}{2}}$ for $n$ from 8 to 10, plus an explanation of how they can be derived, since I haven't been able to figure that out myself. Ideally, the procedure for finding those equations would extend to additional roots for higher values of $n$, allowing arbitrary roots to be found.

[ EDIT WITH ANSWER ]

Based on the answer from @dxiv, the magnitude of the roots can more correctly be written in the form $R(n, k) = 2 \cos\left(\frac{k π}{n}\right)$, where $n$ is the depth of the continued fraction function and $k$ is the index of the root counting from largest (one) to smallest ($\lfloor\frac{n}{2}\rfloor$). This just happens to be equal to $\sqrt{B(n)}$ for $k = 1$ and equal to $B(n) - 2$ for $k = 2$. Thus the roots for all values of $n$ up to ten, ordered from largest to smallest, are as follows:

  • $n$ = 1: ∞
  • $n$ = 2: ∞, 0
  • $n$ = 3: ∞, $±2 i \cos\left(\frac{π}{ 3}\right)$
  • $n$ = 4: ∞, $±2 i \cos\left(\frac{π}{ 4}\right)$, 0
  • $n$ = 5: ∞, $±2 i \cos\left(\frac{π}{ 5}\right)$, $±2 i \cos\left(\frac{2 π}{ 5}\right)$
  • $n$ = 6: ∞, $±2 i \cos\left(\frac{π}{ 6}\right)$, $±2 i \cos\left(\frac{2 π}{ 6}\right)$, 0
  • $n$ = 7: ∞, $±2 i \cos\left(\frac{π}{ 7}\right)$, $±2 i \cos\left(\frac{2 π}{ 7}\right)$, $±2 i \cos\left(\frac{3 π}{ 7}\right)$
  • $n$ = 8: ∞, $±2 i \cos\left(\frac{π}{ 8}\right)$, $±2 i \cos\left(\frac{2 π}{ 8}\right)$, $±2 i \cos\left(\frac{3 π}{ 8}\right)$, 0
  • $n$ = 9: ∞, $±2 i \cos\left(\frac{π}{ 9}\right)$, $±2 i \cos\left(\frac{2 π}{ 9}\right)$, $±2 i \cos\left(\frac{3 π}{ 9}\right)$, $±2 i \cos\left(\frac{4 π}{ 9}\right)$
  • $n$ = 10: ∞, $±2 i \cos\left(\frac{π}{10}\right)$, $±2 i \cos\left(\frac{2 π}{10}\right)$, $±2 i \cos\left(\frac{3 π}{10}\right)$, $±2 i \cos\left(\frac{4 π}{10}\right)$, 0

Picture showing the magnitudes of the roots as functions of n for values up to ten.


Solution 1:

Let $\,f_n = \frac{p_n}{q_n}\,$ then for $\,n \ge 1\,$:

$$ \frac{p_{n+1}}{q_{n+1}}= f_{n+1} = \frac{1}{x+f_n}=\frac{1}{x+\frac{p_n}{q_n}}=\frac{q_n}{xq_n+p_n} \;\;\implies\;\;\\ \begin{cases}p_{n+1}=q_n \\ q_{n+1}=xq_n+p_n=xq_n+q_{n-1}\end{cases} $$

It follows that $\,p_{n+1}\,$ satisfies $\,p_{n+1}=xp_n+p_{n-1}\,$ with $\,p_0(x)=0, \,p_1(x)=1, \,p_2(x)=x\,$.

Let $\,p_n(x)=i^n \,r_n\left(\frac{x}{2i}\right)\,$, then after substituting and canceling a factor of $\,i^{n+1}\,$:

$$ r_{n+1}\left(\frac{x}{2i}\right) = 2\,\frac{x}{2i} r_n\left(\frac{x}{2i}\right) - r_{n-1}\left(\frac{x}{2i}\right) \;\;\implies\;\; \\r_{n+1}(z) = 2z\, r_n(z)-r_{n-1}(z) $$

This is the same recurrence satisfied by the Chebyshev polynomials. Moreover:

$$ \begin{align} r_1(z) &= i^{-1}\,p_1(2iz) = -i \cdot 1 \\ r_2(z) &= i^{-2}\,p_2(2iz) = -i \cdot 2z \end{align} $$

Aside from an index shift of $\,1\,$, these match the initial conditions for the Chebyshev polynomials of the second kind $\,U_0(z)=1\,$, $\,U_1(z)=2z\,$ scaled by a factor of $\,-i\,$, so $\,r_{n+1}(z)=-i\,U_n(z)\,$.

The roots of $\,r_{n}(z)\,$ are therefore the roots of $\,U_{n-1}(z)\,$, known to be $\,z_k=\cos \frac{k\pi}{n} \;\big|_{k = 1,2,\dots,n-1}\,$ and the roots of $\,p_{n}(x)\,$ are $\,x_k = 2i\,z_k\,$, which are also the zeros of $\,f_{n}\,$.


[ EDIT ] $\;$ The relation with Beraha constants follows from trig identities between their definition $B(n) = 2\left(1 + \cos \frac{2 \pi}{n}\right)$ and the expression for the roots $\,x_k = 2i \, \cos \frac{k\pi}{n} \;\big|_{k = 1,2,\dots,n-1}\,$.

  • $x_1^2 = x_{n-1}^2 = -4 \cos^2 \frac{\pi}{n} = -2\left(\cos \frac{2\pi}{n}+1\right) = -B(n)$

  • $x_2 = -x_{n-2} = 2i \,\cos\frac{2 \pi}{n} = i \,\big(B(n) - 2\big)$