Find all $f:\Bbb{N_0}\to \Bbb{N_0}$ which obey the functional equation $$2f(m^2+n^2)=f(m)^2+f(n)^2$$ for all non-negative integers $m,n$.
My attempt
Putting $m=n=0$, we get $f(0)=0$ or $1$.
Case 1: $f(0)=0$
Putting $m=0, n=1$, we get $f(1)=0$ or $2$
Putting $m=1, n=1$, we get $f(2)=0$ or $4$
Putting $m=0$, we get $2f(n^2)=f(n)^2$
Let $f(n)=\displaystyle\sum_{p=0}^k a_pn^{k-p}\Rightarrow f(0)=a_k=0\Rightarrow $
$$f(n)^2=a_0^2n^{2k}+a_1^2n^{2k-2}+a_2^2n^{2k-4}+\dots+a_{k-2}^2n^4+a_{k-1}^2n^2+g(n)$$
$$2f(n^2)=2a_0n^{2k}+2a_1n^{2k-2}+2a_2n^{2k-4}+\dots+2a_{k-2}n^4+2a_{k-1}n^2$$ where $k\in \Bbb{N_0}$
Comparing the coefficients, we can say $g(n)=0$ and $a_p^2=2a_p\Rightarrow a_p={0,2}$ where $\{p\in N_0|p≤k\}$. $f(1)={0,2}$ i.e. sum of coefficients is $0$ or $2$. Hence $f(n)=2n^p$ or $0$ where $1≤p≤k$. Again $f(2)=4\Rightarrow 2\cdot2^p=4\Rightarrow p=1$ Therefore $f(n)=2n$ or $f(n)=0$
Putting $f(n)=0$ in $2f(m^2+n^2)=f(m)^2+f(n)^2$, we get $0=0$ which is very obvious.
Putting $f(n)=2n$ in $2f(m^2+n^2)=f(m)^2+f(n)^2$, we get $2\cdot2(m^2+n^2)=(2m)^2+(2n)^2$ which is true for all whole numbers.
Case 2: $f(0)=1$
Putting $m=0, n=1$, we get $f(1)=1$
Putting $m=1, n=1$, we get $f(2)=1$
Putting $m=0$, we get $2f(n^2)=1+f(n)^2$
Let $f(n)=\displaystyle\sum_{p=0}^{k-1} a_pn^{k-p}+1\Rightarrow$
$$2f(n^2)=2a_0n^{2k}+2a_1n^{2k-2}+2a_2n^{2k-4}+\dots+2a_{k-2}n^4+2a_{k-1}n^2+2$$
$$f(n)^2=a_0^2n^{2k}+a_1^2n^{2k-2}+a_2^2n^{2k-4}+\dots+a_{k-2}^2n^4+a_{k-1}^2n^2+1+g(n)$$
Comparing the coefficients, we can say $g(n)=0$ and $a_p^2=2a_p\Rightarrow a_p=0,2$ where $\{p\in N_0|p≤k\}$. $f(1)=1$ i.e. sum of coefficients is $1$. Hence $f(n)=1$. Again $f(2)=1\Rightarrow f(n)=1$ Therefore $f(n)=1$ is the only solution.
Putting $f(n)=1$ in $2f(m^2+n^2)=f(m)^2+f(n)^2$, we get $2=1+1$ which is always true.
Hence $f(x)=0$ or $f(x)=1$ or $f(x)=2x$
If the function is not a polynomial, then the output won't be whole number for every whole number as an input.
Is my solution correct ?
I don't think the solution is rigorous. To me, there are some gaps that need to be clarified.
For the first case,
For the second case, how do you derive $f(n) = 1$ from $2f(n^2) = 1 + f(n)^2$?