Solution by jasperE3.
f(xf(x)+yf(x))=xf(x)+f(x)f(y).
P(−f(0),0)⇒f(−f(0)f(−f(0)))=0.
P(−f(0)f(−f(0)),0)⇒f(0)=0.
We claim that if f(k)=0 then f(−k)=0. It’s obvious for k=0, and for k=0 such that f(k)=0 we can do:
P(−k,k)⇒−kf(−k)=0⇒f(−k)=0.
P(x,−x)⇒f(−x)(f(x)−x)=0, so using the above fact, for all x either f(x)=x or (in the case f(−x)=0) f(x)=0.
Suppose f(a)=0 and f(b)=b for some a,b.
P(a,b)⇒f(a2+ab)=a2∈{0,a2+ab}.
Either case reduces to ab=0, which implies either f(a)=0 or f(b)=b, contradiction.
So we either have f(x)=0 for all x or f(x)=x for all x, both are solutions.