Find all functions $f(x)$ such that $f\left(x^2+f(y)\right)$=$y+(f(x))^2$

Let me summarize the proposed ideas and give a self-contained answer: Let $f : \Bbb{R} \to \Bbb{R}$ satisfy the functional equation

$$ f(x^2 + f(y)) = y + f(x)^2 \tag{*}$$

for all $x, y \in \Bbb{R}$.

Step 1. $f(0) = 0$.

(This solution is due to @Leo163.) Let $a \in \Bbb{R}$ be such that $f(a) = 0$. For instance, plugging $y = -f(x)^2$ to $\text{(*)}$ confirms the existence of such $a$. Then plugging $(x, y) = (a, a)$ to $\text{(*)}$ gives

$$ f(a^2) = f(a^2 + f(a)) = a + f(a)^2 = a.$$

Finally, plugging $(x, y) = (0, a^2)$ to $\text{(*)}$ gives

$$ 0 = f(a) = f(f(a^2)) = a^2 + f(0)^2. $$

This shows that $f(0) = 0$.

Step 2. $f$ satisfies various identities:

  1. $f(x^2) = f(x)^2$.
  2. $f(f(x)) = x$. In particular, $f$ is bijective.
  3. $f(-x) = -f(x)$.
  4. $f(x+y) = f(x)+f(y)$.

The identity 1 (resp. 2) follow by plugging $y = 0$ (resp. $x = 0$) to $\text{(*)}$. For 3, we may assume that $x \geq 0$. Then replacing $(x, y)$ in $\text{(*)}$ by $(x^{1/2}, f(-x))$, we have

$$ 0 = f(x - x) = f(-x) + f(x^{1/2})^2 = f(-x) + f(x) $$

and 3 follows. Finally, replacing $(x, y)$ in $\text{(*)}$ by $(x^{1/2}, f(y))$ gives

$$ f(x + y) = f(x) + f(y), \qquad \forall x \geq 0, \ y \in \Bbb{R}. $$

The restriction that $x \geq 0$ can be removed by combining this with 3: if $x < 0$, then

$$ f(x+y) = -f(-x-y) = -(f(-x) + f(-y)) = f(x) + f(y). $$

Step 3. $f(x) = x$.

If $x > 0$ then by the first identity of the previous step,

$$ f(x) = f((x^{1/2})^2) = f(x^{1/2})^2 > 0. $$

(We can exclude the equality because $f$ is bijective and $f(0) = 0$.) Combining this with the fact that $f$ is an odd function, we have:

$$ f(x) \geq 0 \quad \Longleftrightarrow \quad x \geq 0.$$

Now for any $x \in \Bbb{R}$,

$$ f(x) -x = f(x) - f(f(x)) = f(x - f(x)). $$

Therefore $f(x) - x \geq 0$ if and only if $x - f(x) \geq 0$, which implies that $f(x) = x$.


Remark. The Cauchy functional equation has pathological solutions which are also involution, and we need to use the extra structure given by the equation $\text{(*)}$ to exclude such possibilities. The first identity of Step 2 was essential in our solution.


Suppose $a$ is such that $f(a)=0$ (we know there is such $a$, it is enough to consider $y=-f(x)^2$ for some $x$), then substituting $x=a$ and $y=a$, we have $$f(a^2)=a.$$ Then, set $x=0$ and $y=a^2$, to obtain $$0=f(f(a^2))=a^2+f(0)^2.$$ Since we are only dealing with real numbers, it means that $f(0)=0$, and no other number has $0$ as image.

As consequences, we have $f(f(y))=y$ and $f(y^2)=f(y)^2$ for every $y\in\mathbb{R}$.