2. Find the exact formula for the number defined with $n$ nested square roots:
$$
a_{n}=\sqrt{2+\sqrt{2+\cdots+\sqrt{2+\sqrt{2}}}}
$$
2. We attempt to utilize trigonometric substitution. First, $a_{1}=2 \cos \left(\frac{\pi}{4}\right)$, and next, we have the double-angle formula $\cos 2 \alpha=2 \cos ^{2} \alpha-1$. Now we conjecture: $a_{n}=2 \cos \frac{\pi}{2^{n+1}}$.
Using this conjecture, we can get $a_{n+1}=\sqrt{2+2 \cos \frac{\pi}{2^{n+1}}}=2 \cos \frac{\pi}{2^{n+2}}$.