3. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$,

$$
f\left(x^{2}+f(y)\right)=y-x^{2}
$$
Solution. If we set $x=0$, we get $f(f(y))=y$, for every $y \in \mathbb{R}$. Therefore, for $x, y \in \mathbb{R}$ we have

$$
f\left(y-x^{2}\right)=f\left(f\left(x^{2}+f(y)\right)=x^{2}+f(y)\right.
$$

If we substitute $y=x^{2}$ in the last equation, we have:

$$
f\left(x^{2}-x^{2}\right)=f(0)=x^{2}+f\left(x^{2}\right)
$$

which means $f\left(x^{2}\right)=f(0)-x^{2}$. If we substitute $y=0$, we get $f\left(-x^{2}\right)=x^{2}+f(0)$. From here, we can conclude that $f(x)=-x+C$, for every real number $x$, where $C=f(0)$. Indeed, all functions $f: \mathbb{R} \rightarrow \mathbb{R}, f(x)=-x+C, C \in \mathbb{R}$ satisfy the condition of the problem:

$$
f\left(x^{2}+f(y)\right)=f\left(x^{2}-y+C\right)=-\left(x^{2}-y+C\right)+C=y-x^{2} .
$$