Solution by jasperE3.
f((x+f(x))f(y))=2xy.
f is injective, since if f(a)=f(b) then P(21,a) and P(21,b) give a=b.
Swap x,y, we obtain:
f((x+f(x))f(y))=2xy=f((y+f(y))f(x)),
so (x+f(x))f(y)=(y+f(y))f(x). Setting y=1, this simplifies as f(x)=xf(1) and we can test to get the only solution f(x)=x (since 1 is the unique root or r3+r2−2=0).