Solution by jasperE3.
Claim: if f(g(x)+f(xy))=x2+f(xy) then g(x)−x2 is constant for x=0 and f(x)−x is eventually constant.
Proof. Let c=1−g(1).
P(x,0)⇒f(g(x)+f(0))=x2+f(0)⇒[f(0),∞)⊆f(R).
P(1,x)⇒f(g(1)+f(x))=1+f(x)⇒f(x+g(1))=x+1 for all x≥f(0), so f(x)=x+c for all x≥f(0)+g(1) (proving that f(x)−x is eventually linear).
P(x,xy)⇒f(g(x)+f(y))=x2+f(y) for all x=0.
For any x=0, take y≥max{f(0)+g(1),−g(x)+f(0)+g(1)} and this equation turns into:
g(x)+y+2c=g(x)+f(y)+c=f(g(x)+f(y))=x2+f(y)=x2+y+c,
so g(x)=x2−c for all x=0.
f(f(x2)+f(xy))=x2+f(xy).
By the claim, f(x2)−x2=c for all x=0 and some constant c. Fix y and take x>max{0,∣f(y)+c∣}:
P(x,xy)⇒f(f(x2)+f(y))=x2+f(y)
and we obtain:
x2+f(y)+2c=f(x2+f(y)+c)=f(f(x2)+f(y))=x2+f(y),
so c=0.
Equation reduces to f(x2+f(xy))=x2+f(xy) so by #317 f has one of the following forms:
f(x)=x
f(x)=⎩⎨⎧xag(x)if x>cif x=0if 0=x≤c
where c=inff>0 and a∈(c,∞), and function g:(−∞,c]∖{0}→[c,∞)
f(x)=⎩⎨⎧xcg(x)if x≥cif x=0if 0=x<c
where c=inff>0 and function g:(−∞,c)∖{0}→[c,∞)
f(x)={xg(x)if x>cif x≤c
where c=inff≤0 and function g:(−∞,c]→[c,∞).
Narrowing this down with f(x)=x for all x>0 we have f≡x or c≤0 and hence the solution sets f(x)=x and f(x)={xg(x)if x>cif x≤c.
Take the case f≡x. Recall that f(0)≥c by the definition of c.
P(0,0)⇒f(2f(0))=f(0).
If f(0)>0, then 2f(0)>c so f(2f(0))=2f(0) which implies f(0)=0, contradiction.
If f(0)<0, P(−f(0),0)⇒f(0)=0, contradiction.
So we must have f(0)=0, our remaining solution set is:
(if c=0:)
f(x)={xg(x)if x≥0if x<0
which fits for any function g:(−∞,0)→[0,∞).
(if c<0:)
f(x)={xg(x)if x>cif x≤c
which fits for any constant c<0 and function g:(−∞,c]→[c,∞).