Proof of an equality involving cosine $\sqrt{2 + \sqrt{2 + \cdots + \sqrt{2 + \sqrt{2}}}}\ =\ 2\cos (\pi/2^{n+1})$ so I stumbled upon this equation/formula, and I have no idea how to prove it. I don't know how should I approach it:
$$
\sqrt{2 + \sqrt{2 + \cdots + \sqrt{2 + \sqrt{\vphantom{\large A}2\,}\,}\,}\,}\
=\
2\cos\left(\vphantom{\Large A}\pi \over 2^{n + 1}\right)
$$
where $n\in\mathbb N$ and the square root sign appears $n$-times.
I thought about using sequences and limits, to express the LHS as a recurrence relation but I didn't get anywhere.
edit: Solved, thanks for your answers and comments.
 A: I know it is a bit old, but I'd like to elaborate a bit the answer here going step by step.
As commented above, the best hint is to use the cosine half-angle formula ($*=\cos\left(\frac{\alpha}{2}\right)=\pm\sqrt{\frac{1+\cos(\alpha)}{2}}$) and work by induction. Therefore, let's get to it:
Base case:
The first partial sum, $S(1)$, will be:
$$S(1)=\sqrt{2}$$
Using the provided formula, one sees that
$$\sqrt{2}=\sqrt{2}\frac{\sqrt{2}}{\sqrt{2}}=\frac{2}{\sqrt{2}}=2\frac{1}{\sqrt{2}}=2\cos\left(\frac{\pi}{4}\right)=2\cos\left(\frac{\pi}{2^2}\right)=2\cos\left(\frac{1}{2}\cdot\frac{\pi}{2}\right)\stackrel{*}{=}2\sqrt{\frac{1+\cos\left(\frac{\pi}{2}\right)}{2}}=2\sqrt{\frac{1}{2}}=\frac{2}{\sqrt{2}}=\sqrt{2}$$
If we start directly from the cosine and try to get to the partial sum, it is actually nicer imho:
$$2\cos\left(\frac{\pi}{4}\right)=2\cos\left(\frac{\pi}{2^2}\right)=2\cos\left(\frac{1}{2}\cdot\frac{\pi}{2}\right)\stackrel{*}{=}2\sqrt{\frac{1+\cos\left(\frac{\pi}{2}\right)}{2}}=2\sqrt{\frac{1}{2}}=\frac{2}{\sqrt{2}}=\sqrt{2}$$
If we go for the second partial sum, we have:
$$S(2)=\sqrt{2+\sqrt{2}}$$
Which is:
$$2\cos\left(\frac{\pi}{8}\right)=2\cos\left(\frac{\pi}{2^3}\right)=2\cos\left(\frac{1}{2}\cdot\frac{\pi}{4}\right)\stackrel{*}{=}2\sqrt{\frac{1+\cos\left(\frac{\pi}{4}\right)}{2}}=2\sqrt{\frac{1}{2}+\frac{1}{2}\cos\left(\frac{\pi}{4}\right)}=2\sqrt{\frac{1}{2}+\frac{1}{2}\frac{\sqrt{2}}{2}}=2\sqrt{\frac{1}{2}+\frac{1}{4}\sqrt{2}}=2\sqrt{\frac{2+\sqrt{2}}{4}}=\sqrt{2+\sqrt{2}}$$
So now you can already develop some intuition that eventually you will have a factor $\frac{1}{2}$ inside the sum that will be cancelled by the outer 2.
Induction step:
Assume $S(n)$ works, i.e.:
$$\sqrt{2+\sqrt{2+\cdots+\sqrt{2+\sqrt{2}}}}=2\cos\left(\pi\over2^{n + 1}\right)$$
which clearly implies:
$$**=\frac{1}{2}S(n)=\frac{1}{2}\sqrt{2+\sqrt{2+\cdots+\sqrt{2+\sqrt{2}}}}=\cos\left(\frac{\pi}{2^{n+1}}\right)$$
Let's find out if $$S(n+1)=2\cos\left(\frac{\pi}{2^{n+2}}\right)$$
$$2\cos\left(\frac{\pi}{2^{n+2}}\right)=2\cos\left(\frac{1}{2}\cdot\frac{\pi}{2^{n+1}}\right)\stackrel{*}{=}2\sqrt{\frac{1+\cos\left(\frac{\pi}{2^{n+1}}\right)}{2}}=2\sqrt{\frac{1}{2}+\frac{1}{2}\cos\left(\frac{\pi}{2^{n+1}}\right)}\stackrel{**}{=}2\sqrt{\frac{1}{2}+\frac{1}{2}\frac{1}{2}S(n)}=2\sqrt{\frac{1}{2}+\frac{1}{4}S(n)}=2\sqrt{\frac{2+S(n)}{4}}=\sqrt{2+S(n)}$$

Bottom line for other cases:
To me, if I would encounter the $S(n)$, trying to get a nice closed-form solution would be the most complicated thing to do. Once you realise it goes in the direction of cosines is quite straight forward, as you can see. In this case, the trick was to observe that the cosine formula they relate it to is the half angle: see how $\cos\left(\frac{\alpha}{2^{n+1}}\right)$ has this $2^{n+1}$. It should pop up as an alarm as saying "hey, you will eventually have to split this denominator".
A: Hint:
Use induction and the half-angle formula for cosine.
Solution:
For $n=1$, the claim is true, since $\cos(\pi/4)=\sqrt{2}/2$. By the half-angle formula $$2\cos(x/2)=\sqrt{2+2\cos(x)}$$
Therefore
$$\sqrt{2+\sqrt{2+\cdots+\sqrt{2+\sqrt{2}}}}=\sqrt{2+2\cos\left(\frac{\pi}{2^n}\right)}=2\cos\left(\frac{\pi}{2^{n+1}}\right)$$
where in the left square root expressions there are $n$ square roots and in the first equality we have used the induction hypothesis that the claim holds for $n-1$.
