Let us denote f(0)=c. Assume that c=0. Taking x=y=0 in the initial equation we get cf(c)=0. Hence, f(c)=0. Taking y=c and c−x instead of x in the initial equation and dividing it by c gives us the equality f(x)=x−c. Direct verification shows that no such function satisfies the given equality. Hence, c=f(0)=0.
Assume that f(y0)=0 for some y0=0. Initial equation with y=y0 becomes y0f(y0−x)=0. Thus, f(x)=0 for any real x, and this function satisfies the condition of the problem.
Now assume that f(y0)=0 only for y0=0. For any y∈R the equality f(f(y))=y holds. Indeed, it holds for y=0, and taking x=0 in the initial equation gives us yf(y)=f(f(y))f(y), which proves that f(f(y))=y for y=0.
The initial equation can now be rewritten as follows:
y(x+f(y−x))=f(f(x+y)−x)f(y).(1)
We will prove that for any x∈R the following equality holds:
f(x)−f(−x)=2x.(2)
Assume that it does not hold for some x=x0. Taking x=x0, y=f(x0)−x0 in (1) gives us the equality
(f(x0)−x0)(x0+f(f(x0)−2x0))=0.
If f(x0)=x0 then f(f(x0)−2x0)=−x0⟹f(x0)−2x0=f(f(f(x0)−2x0))=f(−x0)⟹f(x0)−f(−x0)=2x0 which is contrary to our assumption. Thus, f(x0)=x0. Similarly, taking x=−x0, y=f(−x0)+x0 in (1) one can prove that f(−x0)=−x0. However, this implies f(x0)−f(−x0)=x0−(−x0)=2x0 again, and we obtain a contradiction.
Now we take x=−y in (1):
yf(2y)=y2+f2(y).(3)
Similarly,
−yf(−2y)=y2+f2(−y).(4)
We add (3) and (4) and use (2) twice:
4y2=y(f(2y)−f(−2y))=2y2+f2(y)+f2(−y)=2y2+f2(y)+(f(y)−2y)2⟹(f(y)−y)2=0
Hence, we have proved that f(y)=y for all y∈R. This function satisfies the condition of the problem.