How to solve the functional equation $f\left(x^2+f(y)\right)=y+f(x)^2$ How to solve the following functional equation:
Find all $f:\mathbb{R}\to\mathbb{R}
$ such that:
$$
f\left(x^2+f(y)\right)=y+f(x)^2
$$
Holds for every $x,y\in\mathbb{R}$.
A friend gave it to me, probably its an olympiad question.
I started with the equation $f(f(y))=y+f(0)^2$ which seems to be quite helpful, but I couldn't do it effectively. How to solve it properly?
 A: Here is an elementary way to show that $ f=1_\mathbb R$
Claim 1: $f$ is an odd function.
If we substitute $x=y=0$ in the given equation, then we get $$f(f(0))=(f(0))^{2}.$$
We then substitute $x=0$ in the given equation and find out that $\forall y \in \Bbb R$, $$f(f(y))=y+(f(0))^{2}.$$ Now, we observe that, for all $x,y \in \Bbb R$, $$y+(f(x))^{2}=f(x^{2}+f(y))=f((-x)^{2}+f(y))=y+(f(-x))^{2}.$$
Hence $\forall x \in \Bbb R,$ $$f(-x)=f(x) \space \space or \space \space f(-x)=-f(x).$$
 But, if for some $x \in \Bbb R$, $f(-x)=f(x)$, then we would have, $$x+(f(y))^{2}=f(y^{2}+f(x))=f(y^{2}+f(-x))=-x+(f(y))^{2}$$ for any $y \in \Bbb R$ implying $x=0$. So, for any $x \neq 0$, $f(-x)=-f(x).$.Hence $f$ is an odd function.
Claim 2: $f(x)>0$ if $x>0$ and $f$ is increasing.
Note that $f(x)\neq 0$ if $x\neq 0$. Indeed, if $f(x)=0$, then 
$$0=f(0)=f(f(x))=x.$$ Furthermore, if $x>0$, then $f(x)>0$. Indeed, $f(x)=f(\sqrt{x}^2)=f(\sqrt{x})^2>0$.
Then in fact, $f$ is increasing. Since $f$ is odd, it suffices to show it is increasing on $(0,\infty)$. Well, if $x>y>0$, $$f(x)-f(y)=f(\sqrt{x}^2)+f(-y)=f(\sqrt x)^2+f(-y)=f(x+f(f(-y)))=f(x-y)>0.$$
But then, if $f(x) >x$, $x>f(f(x))>x$. Likewise, if $f(x)<x$, $x=f(f(x))<f(x)<x$.
As these are impossible, we must have $f(x)=x$ for all $x$
A: This problem is from the IMO 92.
Let $P(x,y)$ be the assertion $f\left(x^2+f(y)\right)=y+f(x)^2$. Then:
$$
P(0,y):\space f(f(y))=y+f(0)^2
$$
Thus we have $f\left(f\left(x^2+f(y)\right)\right)=f\left(y+f(x)^2\right) \iff x^2+f(y)+f(0)^2=f\left(y+f(x)^2\right)$. Let $Q(x,y)$ be this assertion.
Furthermore, $P(0,y)$ implies, that $f$ is bijective. Therefore, let $a\in\mathbb R$ be, such that $f(a)=0$. Consequently:
$$
Q(a,a):\space a^2+f(0)^2=0\iff a=f(0)=0
$$
Thus, $f(f(y))=y$. Now we have:
$$
P(x,0):\space f(x^2)=f(x)^2\implies f(x)≥0\space\forall x\in\mathbb{R_{≥0}}\\
P(-x,0):\space f(x^2)=f(-x)^2\implies f(-x)^2=f(x)^2\implies f(-x)=-f(x)\space\left(\text{$f(x)=f(-x)$ is impossible, because $f$ is bijective.}\right)\\
P\left(x,f(y)\right):\space f\left(x^2+y\right)=f(y)+f(x)^2=f(y)+f(x^2)\implies f(y+z)=f(y)+f(z)\forall y\in\mathbb R, z\in\mathbb{R_{≥0}}
$$
Now, we calculate $f(y-z)$ with $y\in\mathbb R, z\in\mathbb{R_{≥0}}$:
$$
f(y-z)=-f(-y+z)=-f(-y)-f(z)=f(y)+f(-z)
$$
Thus, we have $f(y+z)=f(y)+f(z)\space\forall y,z\in\mathbb R$. But we have $f(x)≥0\space\forall x\in\mathbb{R_{≥0}}$, so $f$ doesn't lay dense, and by Cauchy, we have that $f(x)=cx$ for some real constant $c$. Substituting this in the original equation, we can see, that $c=1$ and thus $f(x)=x$ is the only solution.
