Solution by maromex.
Let P(x,y) denote the given assertion f(x2+y2)=f(x)2+f(y)2.
P(0,0):f(0)=2f(0)2. This means f(0)∈{0,21}.
Case 1: f(0)=0
P(x,0):f(x2)=f(x)2.
So f(x2+y2)=f(x2)+f(y2). Therefore f is additive on nonnegative reals, and is bounded ≥0 on nonnegative reals because f(x2)=f(x)2≥0. It follows that f(x)=cx for all x≥0 for some real constant c. We have cx2=c2x2, so c∈{0,1}.
Case 1.1: c=0
We get 0=f(x)2, so f(x)=0 for all real x. This function works.
Case 1.2: c=1
We get x2=f(x)2, and with f(x)=0 for all x≥0, this is equivalent to the problem. So we get
f(x)={xxg(x)x≥0x<0
for an arbitrary function g:(−∞,0)→{−1,1}. This works.
Case 2: f(0)=21
P(x,0):f(x2)=f(x)2+41.
So f(x2+y2)=f(x2)+f(y2)−21. Therefore x↦f(x)−21 is additive on nonnegative reals, and is bounded ≥−41 on nonnegative reals because f(x2)−21=f(x)2+41−21≥−41. It follows that f(x)=cx+21 for all x≥0 for some real constant c. We have cx2+21=(cx+21)2+41, so c=0.
We get 21=f(x)2+41. Therefore f(x)∈{−21,21} for all x<0. So
f(x)={21g(x)x≥0x<0
for an arbitrary function g:(−∞,0)→{−21,21}. This works.
Combining cases, the functions that work are f(x)=0 for all real x, $f(x) =
{xxg(x)x≥0x<0
for an arbitrary function g:(−∞,0)→{−1,1}, and $f(x) =
{21g(x)x≥0x<0
for an arbitrary function g:(−∞,0)→{−21,21}.