By taking x=1 into (1), we get
f(f(y)−f(1))=y+2f(1),∀y∈R.(2)
Hence f is bijection and so, there exists a unique real number a such that f(a)=0. Plugging x=a into (1), we have
f(af(y))=ay,∀y∈R.(3)
Plugging y=0 into (3), we have f(af(0))=0=f(a). Combined with f is injective, we get af(0)=a. Hence, a=0 or f(0)=1.
Consider the case a=0, i.e f(0)=0. Plugging y=0 into (1), we have f(−f(x))=2f(x). Since f is surjective, we conclude that f(x)=−2x for all x∈R. But this function is not satisfying the equation (1). Hence, a=0 and we get f(0)=1.
Plugging x=0 into (1), we have f(−1)=2. Plugging y=a into (3), we have a2=f(0)=1, i.e a=1 (because f(−1)=2), i.e f(1)=0.
Since f(1)=1, we can write the equation (2) as the form
f(f(y))=y,∀y∈R.(2′)
By plugging f(y) instead of y into (1) and using (2'), we get
f(xy−f(x))=2f(x)+xf(y),∀x,y∈R.
In this equation, consider x=0 and putting y=xf(x), we have
1=2f(x)+xf(xf(x)),
hence
f(xf(x))=x1−2f(x),∀x=0.
By putting y=xf(x) into (1) and using the above result, we have
f(1−3f(x))=3f(x),∀x=0.
Note that f is bijective and f(0)=1, so for all x=0, we can see that 1−3f(x) can get all real values, except −2. Therefore, from the above result, we conclude that f(x)=−x+1 for all x=−2.
In particular, f(3)=−2. Plugging y=3 into (2'), we have f(−2)=3. Therefore, f(x)=−x+1 for all x∈R. It is easy to see that this function satisfying the condition. ■