Solving for $k$: $\sqrt{k-\sqrt{k+x}}-x = 0$ 
$$\sqrt{k-\sqrt{k+x}}-x = 0$$
Solve for $k$ in terms of $x$

I got all the way to
$$x^{4}-2kx^{2}-x+k^{2}-x^{2}$$
but could not factor afterwards. My teacher mentioned that there was grouping involved
Thanks Guys!
Edit 1 : The exact problem was solve for $x$ given that $$\sqrt{4-\sqrt{4+x}}-x = 0$$ with a hint of substitute 4 with k

In this kind of problem, you have to be very careful about the domain of definition. Squaring the equation an find an equivalent polynomial equations is not enough, you need to verify if the solutions found are effective solutions of the original equation.
First two remarks : 


*

*$x=\sqrt{\cdots}\quad$ thus $x\ge 0$

*If $k<0$ then $k-\sqrt{k+x}<0$ and we cannot take the square root of this, so $k\ge 0$



In particular: with $x\ge 0$ and $k\ge 0$


*

*$\sqrt{x+k}$ is also well defined 

*$\sqrt{(x+a)^2}=x+a$ for any $a\ge 0$, we will use that property later.



The equation squared twice becomes $(x^2-k)^2=x+k$
$\iff k^2-k(2x^2+1)+(x^4-x)=0$ 
with $\Delta=(2x^2+1)^2-4(x^4-x)=(2x+1)^2$
So  $k=\frac 12(2x^2+1\pm(2x+1))=x(x-1)$ or $(x^2+x+1)$

Let's no substitute back in the original problem to eliminate superfluous solutions.


*

*$k=x(x-1)$


$\sqrt{k-\sqrt{k+x}}=\sqrt{x^2-x-\sqrt{x^2}}=\sqrt{x^2-x-x}=\sqrt{x^2-2x}$ 
This can be equal to $x$ if and only if $x=0\qquad$ [$x^2-2x=x^2\iff x=0$]


*

*$k=x^2+x+1$


$\sqrt{k-\sqrt{k+x}}=\sqrt{x^2+x+1-\sqrt{(x+1)^2}}=\sqrt{x^2+x+1-(x+1)}=\sqrt{x^2}=x$ 
So the equation is always verified

Finally the solutions are $(0,0)$ and $(x\ge 0,k=x^2+x+1)$

