Solution by Anonymous.
Plugging y=0 gives
f(0)=0.
If f(k)=0 for some nonzero k, then plugging x=k gives
f(ky)=0
so f is constantly 0, which is a solution.
Otherwise we have f(x)=0 if and only if x=0. If f(a)=f(b) for distinct a,b, then both a,b are nonzero so f(a) is nonzero. Plug x=a and
y=f(a)b−a
gives
f(b)=f(a)+f(ay)
so f(ay)=0, which is a contradiction as ay is nonzero. Hence f is injective.
Plugging x=1 gives
f(1+yf(1))=f(1)+f(y).
For nonzero x, plugging y=1/x gives
f(x+xf(x))=f(x)+f(1).
This gives
f(1+xf(1))=f(x+xf(x))
so by injectivity we get
f(x)=cx2+x,
where
c=f(1)−1.
This is also true for x=0. Therefore
f(x)=cx2+x
for all x. If c is nonzero then f is a quadratic so can’t be injective, hence c=0, so
f(x)=x,
which works.
Therefore the solutions are
f(x)=0andf(x)=x.