<s>[INST] Roots of unity and a system of equations by Ramanujan Is it immediately apparent that the solution to the system of equations,
$$\begin{aligned}
x_1^2 &= x_2+2\\ 
x_2^2 &= x_3+2\\
x_3^2 &= x_4+2\\
&\vdots\\
x_n^2 &= x_1+2\\
\end{aligned}\tag{1}$$
can be given by the roots of unity? Specifically,
$$x =\frac{y_k^2+1}{y_k}\tag{2a}$$
where the $y_k$ are,
$$\begin{aligned}
y_k &= \exp\Big(\frac{2\pi i k}{2^n-1}\Big),\; k = 0\dots 2^{n-1}-1\\ 
y_k &= \exp\Big(\frac{2\pi i k}{2^n+1}\Big),\; k = 1\dots 2^{n-1}\\
\end{aligned}\tag{2b}$$
Example. Let $n=4$. Then (1) is equivalent to,
$$x = (((x^2-2)^2-2)^2-2)^2-2\tag{3}$$
Expanded out, (3) is a $2^4=16$-deg polynomial and its 16 roots are given by (2) where,
$$y_k = \exp\Big(\frac{2\pi i k}{15}\Big),\; k = 0\dots 7$$ 
$$y_k = \exp\Big(\frac{2\pi i k}{17}\Big),\; k = 1\dots 8$$
Ramanujan considered the system (1) for $n=3,4$ in the general case and also as nested radicals. For $x = (((x^2-a)^2-a)^2-a)^2-a$,  see this related post. (Interestingly, $n=5$ in the general case is no longer completely solvable in radicals.) 
Question:
I observed (2) empirically. How do we prove from first principles that this is indeed the solution?
 [/INST] Let $f(x)=x^2-2$. Then $$f(2\cos u)=4\cos^2u-2=2(2\cos^2u-1)=2\cos2u$$ so $$f^n(2\cos u)=2\cos2^nu$$ Then $f^n(x)=x$ becomes $$\cos u=\cos2^nu$$ for which solutions are given by $$(2^n-1)u=2k\pi,k=0,\pm1,\pm2,\dots$$
</s>