Solution by waryckenmf.
The answer is f(x)=x for nonnegative x and f(−x)=±f(x)=±x(x>0),which can easily be seen to work.
Denote the given assertion with P(x,y).
Notice that P(0,0)⟹f(f(0)2)=0.Let t=f(0)2.
Claim 1: f(x)=x+t2 for nonnegative x.
Proof: P(x≥0,t) gives the desired result.
Claim 2: t=0 which also means f(0)=0.
Proof: Since the term inside the function in LHS is nonnegative,after setting y nonnegative we get x2+y2=f(x2+f(y)2)=x2+f(y)2+t2=x2+(y+t)2+t2=x2+y2+2yt+2t2⟹2yt+2t2=0⟹t=0.
From the two claims we get f(x)=x for nonnegative x.
Claim 3: f(a)=±a for negative a.
Proof:Notice that
f(x2+f(−a)2)=x2+a2=f(x2+f(a)2)
and from injectivity for nonnegative reals we get x2+f(−a)2=x2+f(a)2⟹f(a)=±f(−a)=±a.
From the three claims we get our characterized solution, done.■