Solution by qwerttiger.
From P(0,0),
f(0)=f(0)2,
so
f(0)∈{0,1}.
From P(x,0),
f(x2)=x2+f(0)2.
If f(0)=1, then
f(x)=x+1
for x≥0.
However, P(1,1) gives
f(2)=1+f(1)2,
so
3=5,
a contradiction.
Thus
f(0)=0,
and
f(x)=x
for x≥0.
From P(0,x) and P(0,−x),
f(x)2=f(−x)2.
Thus
∣f(x)∣=−x
for x≤0.
The answer set is
f(x)=xfor x≥0
and
∣f(x)∣=−xfor x≤0.
To check this, notice that
x2+y2≥0,
so
f(x2+y2)=x2+y2.
Also,
f(y)2=y2,
regardless of whether f(y)=y or f(y)=−y. Hence
x2+y2=x2+y2,
as required.