Solution by jasperE3.
f(xf(x)+f(y)2)=f(x2)+yf(y).
If f(a)=f(b)=0:
P(x,a)⇒f(xf(x)+f(a)2)=f(x2)+af(a).
P(x,b)⇒f(xf(x)+f(a)2)=f(x2)+bf(a), so comparing, a=b.
If f(0)=0 we can use this on:
P(0,0)⇒f(f(0)2)=f(0), it implies f(0)2=0, contradiction.
Therefore f(0)=0.
Claim: f(x2)∈{0,x2} for all x.
Suppose f(u2)=0 for some u.
P(u,0)⇒f(uf(u))=f(u2), using our previously mentioned partial injectivity property, we have that if f(x2)=0 then uf(u)=u2. Moreover, since f(u2)=0 we have u=0, so f(u)=u.
P(0,u)⇒f(u2)=u2, the claim is proven.
P(0,x)⇒f(f(x)2)=xf(x), we can apply the above to this equation to get xf(x)∈{0,f(x)2}, so for all x we have f(x)∈{0,x}.
Finally, note the following two properties: first, if f(a)=a and f(b)=b then
P(0,a)⇒f(a2)=a2.
P(a,b)⇒f(a2+b2)=a2+b2
and secondly, if f(a)=0 then:
P(a,0)⇒f(a2)=0.
The contrapositive of the second statement is that if a=0 and f(a2)=a2 then f(a)=a, but f(a2)=a2⇒f(a)=a is also true for a=0. Therefore our solutions look like the following:
Let {0}⊆S⊆R with the property that if a,b∈S then a2+b2∈S, and if a2∈S then a∈S. Then:
f(x)={x0if x∈Sif x∈/S.
To see that these work, take cases.
If x,y∈S, then P(x,y)⇔f(x2+y2)=f(x2)+y2, true since x2+02∈S and x2+y2∈S.
If x∈S and y∈/S, then P(x,y)⇔f(x2)=f(x2).
If x∈/S and y∈S, then P(x,y)⇔f(y2)=f(x2)+y2, true since x2∈/S (x2∈S would imply x∈S) and 02+y2∈S.
If x,y∈/S, then P(x,y)⇔f(0)=f(x2), true since 0∈S and x2∈/S as before.
There exist non-trivial examples of S, like the algebraic numbers, the formulation can be slightly simplified to be about additive closure and closure under square roots (with some extra work done).