Let f(0)=a,a∈R. We set x=0 and obtain f(a)=0. Next, y=a yields
f(f(x))=xf(a+1)(1).
Assume first that f(a+1)=0. Then f is an injection. Indeed, assuming f(x1)=f(x2) for some x1=x2, after putting these values in (1) we get contradiction. Set x=1 in the initial condition. Since f is injective, it follows
f(1)+f(y)=y+1(2)
Setting y=1 yields 2f(1)=2, hence f(1)=1. f(y)=y+1. Now, (2) gives us f(y)=y,∀y∈R, which indeed is solution.
Let now consider the case f(a+1)=0. Then
f(f(x))=0,∀x∈R.
This means that f(y)=0,∀y∈Im(f). Assume that there exists a point y0, for which f(y0+1)=0. Setting y=y0 in the initial condition yields
f(f(x)+xf(y0))=xf(y0+1)(3).
For any x0∈R putting x:=x0/(f(y0+1)) in (3), we get,
f(f(x)+xf(y0))=x0.
Since x0 is arbitrary, it means that f is surjective, which implies Im(f)=R.
Therefore, f(y)=0,∀y∈R, which contradicts the assumption f(y0+1)=0.
So, in this case we get f(x)=0,∀x∈R, which also is solution. □