<s>[INST] Solving $x+\sqrt{a+\sqrt{x}}=a$ for $x$. I have to solve the following equation for $x$, for all values of $a$:
$$x+\sqrt{a+\sqrt{x}}=a$$
Clearly $x\gt0$
For $a\lt0,x\in\phi$ as RHS$\lt0$ but LHS$\gt0$.
$a=0\Rightarrow x=0$
Now for $a\gt0$
$$a-x=\sqrt{a+\sqrt{x}}  ,x\in(0,a)$$
$$(a-x)^2=a+\sqrt{x}.....(1)$$
Now plotting the graphs for $$y=(a-x)^2...a\gt0,x\in(0,a)$$ $$y=a+\sqrt{x}$$
For $a\in(0,1)$ the graphs don't intersect$\Rightarrow x\in\phi$. Also, $a=1\Rightarrow x=0$.
For $a\gt1$ the graphs intersect so $$a^2-a+x^2-2ax=\sqrt{x}...from (1)$$Squaring and rearranging
$$x^4-4ax^3+6a^2x^2-2ax^2-4a^3x+4a^2x+a^4-2a^3+a^2=x$$ which I am not able to solve further.
 [/INST] Let $x=(y^2-a)^2$ with $y^2>a$ then
$$x+\sqrt{a+\sqrt{x}}=a \iff (y^2-a)^2+y=a \iff y^4-2ay^2+y-a+a^2=0$$
and since the $y^3$ term is equal to zero we can guess
$$y^4-2ay^2+y-a+a^2=(y^2+y+A)(y^2-y+B)=$$
$$=y^4+(A+B-1)y^2+(B-A)y+AB$$
which leads to $A+B-1=-2a$, $B-A=1$, $AB=a^2-a$ that is
$$y^4-2ay^2+y-a+a^2=(  y^2 + y-a) ( y^2 - y + 1-a) = 0$$
</s>