Closed form of $\sqrt{2 + \sqrt{2 + ... + \sqrt{2 + \sqrt{x}}}}$ How to prove the following formula,
$$\sqrt{2 + \sqrt{2 + ... + \sqrt{2 + \sqrt{x}}}} = 
    \begin{cases} 
          2 \cos\Big[\frac{1}{2^{n}}\Big(\pi + \arctan{\frac{\sqrt{x(4-x)}}{x-2}}\Big)\Big] & 0 < x < 2 \\
          2 \cos\Big[\frac{1}{2^{n}}\arctan{\frac{\sqrt{x(4-x)}}{x-2}}\Big] & 2 < x \leq 4 \\
          2 \cosh\Big[\frac{1}{2^{n}}\text{arctanh}{\frac{\sqrt{x(x-4)}}{x-2}}\Big] & x \geq 4 
       \end{cases}
    \
$$
where $x \in \mathcal{R}$ and $n$ is the number of time the square root symbol $\sqrt{\text{ }\text{ }}$  appears.
This formula is a generalization of the following formula, which can be found here and here, and  which can be obtained by taking the above general formula in the limit $x = 2$.
$$\sqrt{2 + \sqrt{2 + ... + \sqrt{2 + \sqrt{2}}}} = 2\cos\Big(\frac{\pi}{2^{n+1}}\Big)$$

Hint If $a=2\cos(y)$ then
$$2+a= 2 + 2\cos(y)= 4 \cos^2(\frac{y}{2}) \,.$$
So write $\sqrt{x}=2 \cos(\alpha)$ and use the above formula:
$$2 +\sqrt{x}= (2 \cos(\frac{\alpha}{2}))^2 \\
2+\sqrt{2+\sqrt{x}}=2+2\cos(\alpha/2)= (2\cos(\alpha/4))^2 \\
...$$
