Using the identity x2+xy=(−x−y)2+(−x−y)y we obtain the following identity for the function f:
(f(x))2+xf(y)=(f(−x−y))2−(x+y)f(y).
Let's write down some particular cases of the last identity:
(1)(f(x))2+xf(−x)=(f(0))2 (it is obtained by putting y=−x)
(2)(f(x))2+xf(0)=(f(−x))2−xf(0) (it is obtained by putting y=0).
(1) implies (f(x))2+xf(−x)=(f(−x))2−xf(x) which is equivalent to
(f(x)+f(−x))(f(x)−f(−x)+x)=0
Suppose that for some a=0 we have f(a)+f(−a)+a=0. Then by (2) (f(a))2+2af(0)=(f(−a))2=(f(a)+a)2, it follows that
(3)2f(0)=2f(a)+a.
Eliminating f(0) and f(−a) in (1) by a,f(a), we obtain a2=a2/4, hence, a=0.
The contradiction says that f(x)+f(−x)=0 for all x=0. Now from (3) we get f(0)=0. The identity (1) is transformed to f(x)(f(x)−x)=0. If we put x=0 in the original identity we obtain f(f(y))=y, which means that f is injective. Hence, for x=0 we have f(x)=0. So, f(x)=x, and it obviously satisfies the given identity.