(BMO 2007) Find all functions $f: \mathbb{R} \longrightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$,

$$
f(f(x)+y)=f(f(x)-y)+4 f(x) y
$$
With a bit of reflection and experience, one can recognize something that resembles a new remarkable identity in disguise, the $4 f(x) y$ corresponding to twice the double product. This indeed works well if $f$ is the square function. A bit of trial and error suggests that the solutions are $x \mapsto x^{2}$ and $x \mapsto 0$. This leads us to define the auxiliary function $g(x)=f(x)-x^{2}$ to eliminate the parasitic terms. By substituting in the initial equation, we simply get $g\left(g(x)+x^{2}+y\right)=g\left(g(x)+x^{2}-y\right)$.

Here, it is important to interpret this well: this equation indicates that the line with equation $x=g(z)+z^{2}$ is a vertical axis of symmetry for $g$ for any value of $z$. We remember that $g(z)+z^{2}=f(z)$, so if $f$ is not constant, then $g(z)+z^{2}$ takes at least two different values. The composition of two axial symmetries with parallel axes is a translation, so the graph of $g$ is invariant under translation, in other words, $g$ is periodic. More precisely, for any $y$, we have $g(y)=g(y+(f(x)-f(z)))$, by composing the symmetries with axes $f(x)$ and $f(z)$, for any $x$ and $z$. Let's take the time to appreciate all the information obtained without any substitution yet!

Let's proceed with our only necessary substitution: let $T$ be the period of $g$, we set $x=z+T$. Then $f(x)-f(z)=g(z+T)+(z+T)^{2}-g(z)-z^{2}=2 T z+T^{2}$. We see that $g$ is periodic with any real period, since we can choose $z$ arbitrarily. For example, we can formally choose $z$ such that $2 T z+T^{2}=-y$ and we will then have $g(y)=g(0)$ for all $y$, so $g$ is indeed constant. By re-injecting, we find that the constant must be zero, so the solutions are indeed those found at the beginning.