Finding all functions $f:\mathbb{R}\to\mathbb{R}$ such that $f\bigl(xf(x+y)\bigr)=f\bigl(yf(x)\bigr)+x^2$ 
Find all functions $f:\mathbb{R}\to\mathbb{R}$ such that:
$$f\bigl(xf(x+y)\bigr)=f\bigl(yf(x)\bigr)+x^2$$

I assume the only solution is $f(x)=x$ (because it satisfies the condition).
Also, I could prove that:
$f(0)=f\bigl(-xf(x)\bigr)+x^2$ and $f\bigl(xf(2x)\bigr)=f(0)+2x^2$. Then I don't know how to go any further.
 A: It's straightforward to verify that the identity function and its opposite are both solutions of the functional equation
$$ f \bigl ( x f ( x + y ) \bigr ) = f \bigl ( y f ( x ) \bigr ) + x ^ 2 \text . \tag 0 \label 0 $$
Indeed, they are the only functions with this property, which we try to prove. Suppose $ f : \mathbb R \to \mathbb R $ satisfies \eqref{0} for all $ x , y \in \mathbb R $. If $ f ( 0 ) \ne 0 $, then substituting $ 0 $ for $ x $ and $ \frac y { f ( 0 ) } $ for $ y $ in \eqref{0}, we get $ f ( y ) = f ( 0 ) $ for all $ y \in \mathbb R $, which leads to a contradiction, for example by putting $ x = y = 1 $ in \eqref{0}, and thus we must have $ f ( 0 ) = 0 $. Setting $ y = 0 $ in \eqref{0}, we get
$$ f \bigl ( x f ( x ) \bigr ) = x ^ 2 \tag 1 \label 1 $$
for all $ x \in \mathbb R $. In particular, \eqref{1} shows that if $ f ( x ) = 0 $ for some $ x \in \mathbb R $, then $ x = 0 $. Now, assuming $ f ( x ) = f ( y ) $ for some $ x , y \in \mathbb R $, we can use \eqref{0} and \eqref{1} to see that
$$ x ^ 2 = f \bigl ( x f ( x ) \bigr ) = f \bigl ( x f ( y ) \bigr ) = f \bigl ( ( y - x ) f ( x ) \bigr ) + x ^ 2 \text . $$
Hence $ f \bigl ( ( y - x ) f ( x ) \bigr ) = 0 $, and thus $ ( y - x ) f ( x ) = 0 $. From $ y \ne x $ we get $ f ( y ) = f ( x ) = 0 $, and thus $ x = y = 0 $, which leads to contradiction. Therefore, we must have $ x = y $, and consequently, $ f $ is injective. substituting $ - x $ for $ x $ in \eqref{1}, comparing with \eqref{1} itself, and using injectivity of $ f $ as well as $ f ( 0 ) = 0 $, we conclude that $ f $ is odd. By repeatedly using this and \eqref{0}, we get
\begin{align*}
f \bigl ( x f ( y ) \bigr )
& = f \bigl ( ( y - x ) f ( x ) \bigr ) + x ^ 2 \\
& = - f \bigl ( ( x - y ) f ( x ) \bigr ) + x ^ 2 \\
& = - f \bigl ( y f ( x - y ) \bigr ) - ( x - y ) ^ 2 + x ^ 2 \\
& = f \bigl ( y f ( y - x ) \bigr ) - ( x - y ) ^ 2 + x ^ 2 \\
& = f \bigl ( - x f ( y ) \bigr ) + y ^ 2 - ( x - y ) ^ 2 + x ^ 2 \\
& = - f \bigl ( x f ( y ) \bigr ) + 2 x y \text ,
\end{align*}
which implies
$$ f \bigl ( x f ( y ) \bigr ) = x y \tag 2 \label 2 $$
for all $ x , y \in \mathbb R $. Interchanging $ x $ and $ y $ in \eqref{2}, comparing with \eqref{2} itself and using injectivity of $ f $, we get
$$ y f ( x ) = x f ( y ) $$
for all $ x , y \in \mathbb R $, which in particular for $ y = 1 $ shows that $ f ( x ) = f ( 1 ) x $ for all $ x \in \mathbb R $. This together with \eqref{1} implies $ f ( 1 ) \in \{ - 1 , 1 \} $, which proves what was desired.
