Find all $f$ such that $ 2 f\left(m^{2}+n^{2}\right)=f(m)^{2}+f(n)^{2} $ question - 
Find all $f: \mathbb{N}_{0} \rightarrow \mathbb{N}_{0}$ which obey the functional equation
$$
2 f\left(m^{2}+n^{2}\right)=f(m)^{2}+f(n)^{2}
$$
for all nonnegative integers $m, n$
my attempt -
i showed that $f(0)=0$ or $1$  by taking $m=n=0$..
now if $f(0)=0$ then $f(1)=0$ or $2$ by taking $n=0$...
and $f(m^2 + n^2 )$=$f(m^2)$ + $f(n^2)$..
now from here i am not able to proceed...
hint says we have to use some identities but i am not sure what to do..
any help will be helpful
thankyou
 A: Let 
$$\mathcal H=\{n\mapsto 0,n\mapsto 1,n\mapsto 2n\}.$$
We verify that $f$ is a solution to the functional equation for all three choices of $f\in \mathcal H$.
From $m=n=0$, we find $f(0)=0$ or $=1$.
If $f(0)=1$, we find from $m=0,n=1$ that $f(1)=1$.
If $f(0)=0$, we similarly find that $f(1)=0$ or $f(1)=2$.
At any rate, it is possible to pick $h\in\mathcal H$
such that 
$$S:=\{\,n\in\Bbb N_0\mid f(n)=h(n)\,\} $$
contains at least $0$ and $1$ as elements.
As $h$ solves the functional equation, we conclude
Lemma. If two of the numbers $m,n,m^2+n^2$ are $\in S$ then so is the third. $\square$
and
Corollary. If $a^2+b^2=c^2+d^2$ and three of the numbers $a,b,c,d$ are $\in S$ then so is the fourth. $\square$
Using the lemma we quickly find $2=1^2+1^2\in S$, $4=2^2+0^2\in S$, $5=2^2+1^2\in S$, $3=\sqrt{5^2-4^2}\in S$.
Next, $8=2^2+2^2\in S$, $10=3^2+1^2\in S$, $6=\sqrt{10^2-8^2}\in S$
We might suspect that $f=h$ and prove
Proposition. For all $n\in\Bbb N_0$, we have  $n\in S$.
Proof. (by induction)
Let $n\in\Bbb N_0$ and assume $m\in S$ holds for all $m<n$. We want to show that $n\in S$. 


*

*If $n=2m+1$ is odd, then we may assume $m\ge3$ as we already know $1,3,5\in S$. Then 
$$n^2+(m-2)^2=5m^2+5=(m-2)^2+(m+2)^2$$
and as $m-2<m+2\le n-2<n$, we conclude $n\in S$ from the corollary.

*If $n=2m$ is even, we may assume $m\ge 4$ as we already know $0,2,4,6\in S$. Then 
$$n^2+(m-5)^2=5m^2-10m+25=(2m-4)^2+(m+3)^2$$
and as $m-5, 2m-4, m+3$ are all $<n$, we conclude from the corollary that $n\in S$.
$\square$
Result. $\mathcal H$ is precisely the set of solutions.
