First, assume that f(0)=0. Inserting x=0 into the functional equation we get f(y)=0 for all y∈R. This function satisfies the equation.
Now, let f(0)=0. Inserting y=0 into the equation we get
(x−2)f(0)+f(2f(x))=f(x)
for all x∈R. Obviously, this means that f is injective.
Now, put x=2 into the equation to get
f(y+2f(2))=f(2+yf(2))for all y∈R.
Since f is injective, we have y+2f(2)=2+yf(2) for all y∈R. If we insert y=0, then we get f(2)=1.
Since f(2)=1 and f is injective, we have f(3)=1. Insert x=3 and y=1−f(3)3 into the equation to get
f(1−f(3)3+2f(3))=0.
We have shown that f has a zero. Let a be a zero of f, f(a)=0. Inserting y=a into the initial equation yields
f(a+2f(x))=f(x+af(x))for all x∈R.
Since f is injective, we have a+2f(x)=x+af(x) for all x∈R. Since a=2 (remember that f(2)=1=0), we get f(x)=2−ax−a.
Finally, inserting f(x)=2−ax−a into the equation we get a=1. The only two solutions to this functional equation are the functions f(x)=0 and f(x)=x−1.