Find the integral $$\int\underbrace{\sqrt{2+\sqrt{2+\sqrt{2+\cdots+\sqrt{2+x}}}}}_{n}dx,x>-2$$
where $n$ define the number of the square
I know this if $0 \le x\le 2$, then let $$x=2\cos{t},0\le t\le\dfrac{\pi}{2}$$ so $$\sqrt{2+x}=\sqrt{2+2\cos{t}}=2\cos{\dfrac{t}{2}}$$ so $$\sqrt{2+\sqrt{2+x}}=2\cos{\dfrac{t}{2^2}}$$ so $$\int\sqrt{2+\sqrt{2+\sqrt{2+\cdots+\sqrt{2+x}}}}dx=\int2\cos{\dfrac{t}{2^n}}(-2\sin{t})dt$$
and for $x\ge 2$ case, I let $x=\cosh{t}$, but for $-2\le x\le 0$ case, I can't do it.
I think you have the wrong approach, take a look at this
$$f(x) = \sqrt{2+\sqrt{2+...+\sqrt{2+x}}} $$
Square both sides
$$(f(x))^2 = 2+\sqrt{2+...+\sqrt{2+x}} $$
$$(f(x))^2 = 2+f(x) $$
$$(f(x))^2 -f(x)-2= 0 $$
This has two solutions $f(x)=2$ and $f(x)=-1$
Note that $f(x)$ cannot be -1, since square root is always positive for real numbers, and it is given that $x > -2$
Hence you have $f(x)=2$, which is independent of $x$
The answer is therefore finally 2x