Studying the convergence of the series $\sqrt{2}+\sqrt{2+\sqrt{2}}+\sqrt{2+\sqrt{2+\sqrt{2}}}+ \cdots$ Studying the convergence of the series $$\sqrt{2}+\sqrt{2+\sqrt{2}}+\sqrt{2+\sqrt{2+\sqrt{2}}}+ \cdots$$
I saw this problem and I tried to do it my own way but I don't know what I'm doing wrong because I'm getting a divergent series while in the solution it says that it's convergent.
This is what I tried to do
I can write $\sqrt{2}=2\cos\frac{\pi}{4}=2\cos\frac{\pi}{2^2}$
$\sqrt{2+\sqrt{2}}=\sqrt{2+2\cos\frac{\pi}{4}}=2\sqrt{\frac{1+\cos2\frac{\pi}{8}}{2}}=2\cos\frac{\pi}{8}=2\cos\frac{\pi}{2^3}$
Continuing like this I get $$\underbrace{\sqrt{2+\sqrt{2+\cdots+\sqrt{2}}}}_{n\text{ times}}=2\cos\frac{\pi}{2^{n+1}}$$
So I can write the series $$\sqrt{2}+\sqrt{2+\sqrt{2}}+\sqrt{2+\sqrt{2+\sqrt{2}}}+ \cdots=2\sum_{n=1}^\infty\cos\frac{\pi}{2^{n+1}}$$
Since $$\lim_{n\to\infty}a_{n}=\lim_{n\to\infty}\cos\frac{\pi}{2^{n+1}}=1\ne0$$ the series diverges

Your conclusion that $\sum_{n=1}^\infty a_n$ diverges is correct. You don't need the explicit formula, it would suffice to observe that
$$
a_n = \underbrace{\sqrt{2+\sqrt{2+\cdots+\sqrt{2}}}}_{n\text{ times}} \ge \sqrt 2
$$
or that
$$
 0 < a_n < a_{n+1}
$$
for all $n \in \Bbb N$.
