(BMO 2007)

Find all real functions $f$ such that for all $x, y \in \mathbb{R}$,

$$
f(f(x)+y)=f(f(x)-y)+4 f(x) y
$$
Let $g(x)=f(x)-x^{2}$. The equation becomes

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

For all real numbers $a, b, c$, by taking $x=a$ and $y=c-b^{2}-g(b)$, and $x=b, y=c-a^{2}-g(b)$, we obtain

$$
g\left(g(a)+a^{2}-g(b)-b^{2}+c\right)=g\left(g(a)+a^{2}+g(b)+b^{2}-c\right)=g\left(g(b)+b^{2}-g(a)-a^{2}+c\right)
$$

The equality between the first and the third member shows that $g\left(c^{\prime}\right)=g\left(c^{\prime}+2\left(g(a)+a^{2}-g(b)-b^{2}\right)\right)$ for all $c^{\prime} \in \mathbb{R}$. Thus, either $g(x)+x^{2}$ is a constant function, which implies that $f$ is constant, and then $f(x)=0$ for all real $x$ by returning to the original equation; or there exist $a \neq b$ such that $g(a)+a^{2} \neq g(b)+b^{2}$, and $g$ is periodic. In this case, let $T$ be its period. Taking $a=b+T$, we get $g\left(c^{\prime}\right)=g\left(c^{\prime}+2\left(2 y T+T^{2}\right)\right)$. Therefore, $g$ is $4 y T+2 T^{2}$-periodic. As $y$ ranges over $\mathbb{R}$, $4 y T+2 T^{2}$ also ranges over $\mathbb{R}$, so $g\left(c^{\prime}\right)=g\left(c^{\prime}+r\right)$ for all real $r$. Thus, $g$ is constant, and $f(x)=x^{2}+C$ where $C \in \mathbb{R}$. Conversely, if $g$ is constant, it clearly satisfies equation (VI.1) which is equivalent to the given equation, so these functions $f$ are solutions to the problem for any real $C$.