Problem: Solve over $\RR$ the functional equation
\[ f(y^2+2xf(y)+f(x)^2) = (y+f(x)) (x+f(y)). \]

\end{enumerate}

Solution: A key motivation throughout the problem
is that the left-hand side is asymmetric
while the right-hand side is symmetric.
Thus any time we plug in two values for $x$ and $y$
we will also plug in the opposite pair.
Once $f$ is injective this will basically kill the problem.

First, we prove the following.
\begin{lemma*}
  There is a unique $z \in \RR$ such that $f(z) = 0$.
\end{lemma*}
\begin{proof}
  Clearly by putting $y=-f(x)$ such $z$ exists.
  Now, suppose $f(u) = f(v) = 0$.
  Then:
  \begin{itemize}
    \ii Plug $(x,y) = (u,v)$ gives $f(v^2) = uv$.
    \ii Plug $(x,y) = (v,u)$ gives $f(u^2) = uv$.
    \ii Plug $(x,y) = (u,u)$ gives $f(u^2) = u^2$.
    \ii Plug $(x,y) = (v,v)$ gives $f(v^2) = v^2$.
  \end{itemize}
  Consequently $u^2 = uv = v^2$ which yields $u = v$.
\end{proof}

Next let $(x,y) = (z,0)$ and $(x,y) = (0,z)$ to get
\begin{align*}
  & f\left( 2zf(0) \right)
  = f\left( z^2 + f(0)^2 \right) = 0 \\
  \implies & 2z f(0) = z^2 + f(0)^2 = z \\
  \implies &\boxed{f(0) = z \in \left\{ 0, \half \right\}}.
\end{align*}

We now set to prove:
\begin{lemma*}
  The function $f$ is injective.
\end{lemma*}
\begin{proof}
  By putting $(x,y)=(x,z)$ and $(x,y)=(z,x)$ we get
  \[ f\left( f(x)^2 + z^2 \right) = f\left( 2zf(x) + x^2 \right) = x(z+f(x)). \]
  Now suppose $f(x_1) = f(x_2)$ but $x_1 \neq x_2$.
  This can only happen if $f(x_1) = f(x_2) = -z$.
  And now \[ f(x_i)^2 + z^2 = 2zf(x_i) + x_i^2 = z \qquad i = 1, 2. \]
  Solving, we have $x_i = \pm 1$, $z = \half$,
  (since $z = 0$ is not permissible).
  Thus we have ``almost injectivity''.

  Now plug in $(x,y) = (-1,0)$ and $(x,y) = (0,-1)$ in
  the original and equate in order to obtain
  $f(-\frac34) = f(\frac54)$, which contradicts the work above.
\end{proof}

Finally we may use the symmetry trick in full to obtain
\[ y^2 + 2xf(y) + f(x)^2 = x^2 + 2yf(x) + f(y)^2. \qquad(\heartsuit) \]
In particular, by setting $y=0$ we obtain
\[ f(x)^2 = \left( z - x \right)^2. \]
Two easy cases remain:
\begin{itemize}
  \ii In the $z=0$ case simply note
  that $(\heartsuit)$ gives
  $2xf(y) = 2yf(x)$, so for $x \neq 0$
  the value $f(x)/x$ is constant
  and hence $f(x) \equiv \pm x$ follows.
  \ii In the $z=\half$ case $(\heartsuit)$ becomes
  $ \left( 2f(y)+1 \right)x = \left( 2f(x)+1 \right)y $
  and hence we're done again by the same reasoning.
\end{itemize}