Solution by jasperE3.
We solve the general equation f(g(x)+yf(x))=xf(x)+f(xy).
If f(k)=0 for some k:
P(k,x)⇒f(g(k))=f(kx), so f is constant, only solution f(x)=0 which fits.
Otherwise assume f(x)=0 for all x=0.
If f(k)=k for some k:
P(k,k−f(k)g(k))⇒kf(k)=0.
If k=0 then f(k)=0 so k=0, contradiction. Only option is k=0, we’re left with f(x)=x for all x=0.
For x=0:
P(x,0)⇒f(g(x)+xy)=x2+f(0) so (f(0),∞)⊆f(R).
P(x,−f(x)g(x))⇒f(−f(x)xg(x))=−x2+f(0) so (−∞,f(0))⊆f(R).
so f is surjective (since f(0)∈f(R)), and therefore f(k)=0 for some k so k=0 and our solution is f(x)=x.