f(x)=2x, x∈R is the only solution. Assume that there exists a real number c=0 such that c=f(z)−2z for some z. Let P(x,y) be the assertion of the given equation.
P(f(y)−2y,y)→(f(y)−2y)f(f(y)−2y)=0,∀y.
This shows that f(c)=0. Since −2c=f(c)−2c=0, we also obtain that f(−2c)=0.
P(x,c)P(x,−2c)P(c,c)→f(c2)=f((x+c)2)−xf(x),→f(4c2)=f((x−2c)2)−xf(x),→f(c2)=f(4c2).
Therefore, we obtain that f((x+c)2)=f((x−2c)2). (1)
P(x−2c,c)P(x+c,−2c)→f(c2)=f((x−c)2)−(x−2c)f(x−2c),→f(4c2)=f((x−c)2)−(x+c)f(x+c).
Hence, we conclude that (x−2c)f(x−2c)=(x+c)f(x+c). (2)
Now for all x and y
P(x+c,y)→f(xf(y)+y2+cf(y))=f((x+y+c)2)−(x+c)f(x+c)
P(x−2c,y)→f(xf(y)+y2−2cf(y))=f((x+y−2c)2)−(x−2c)f(x−2c)
Using (1) and (2), we get
f(xf(y)+y2+cf(y))=f(xf(y)+y2−2cf(y)).
Since the function is surjective, for any two real numbers u=v, there exist two real numbers x,y such that
f(y)=3cu−v=0,x=f(y)u−y2−cf(y)
This means that f(u)=f(v) for any u=v, and f is constant which is not possible since it is surjective. Therefore such a c does not exist and f(x)=2x, x∈R. This function satisfies the equation:
f(xf(y) + y^2) = 4xy + 2y^2 = 2(x+y)^2 - 2x^2 = f((x+y)^2) - x f(x).