# Find all functions for $f:\Bbb{N}\to\Bbb{N}$ such that $f\left(m^2+f(n)\right)=f\left(m^2\right) +n$

I would have given my approach but i didnt get anywhere. I just substituted zeroes and got $$f(f(n)) =n$$ and I'm just lost. Any help would be appreciated

• Is $0$ natural number? – Aqua Jun 23 '19 at 11:18

Solution 1. assuming $$0\in\mathbb{N}$$

Note that $$f$$ is clearly injective, so if we substitute $$n=0$$ we find that $$f(m^2+f(0))=f(m^2)$$, from which we see that by injectivity that $$f(0)=0$$. Letting $$m=0$$ in the original equation, we see that $$f$$ is indeed an involution as OP found.

Then if we set $$m=1$$ and $$n=f(n)$$, we find that $$f(n+1)=f(n)+f(1)$$. A simple induction shows that $$f(n)=nf(1)$$ for all $$n\in\mathbb{N}$$, and so $$f(n)=nc$$ for some constant $$c$$.

Substituting this into our original equation, we find $$c^2=1$$, and after checking, we see that $$f(x)=x$$ is the only solution to the functional equation. ($$c\in\mathbb{N}$$, and so is not negative)

Solution 2. assuming $$0\notin \mathbb{N}$$

Note that when we put in $$m=1$$, we find that $$f(f(n)+1)=n+1\tag{1}$$ Setting $$n=f(n)+1$$ in $$(1)$$ shows that \begin{align*} f(f(f(n)+1)+1)&=f(n)+2 \\ \implies f(n+2)=f(n)+2 \tag{2}\end{align*}We now prove that $$f(1)=1$$. Suppose not, i.e. $$f(1)=k$$ for some integer $$k>1$$. Then $$k-1\in\mathbb{N^+}$$. So putting $$n=k-1$$ in $$(2)$$ shows that $$f(k+1)=f(k-1)+2$$. But if we put $$n=1$$ in $$(1)$$, we find that $$f(k+1)=f(f(1)+1)=2$$ which implies that $$f(k-1)=0$$, a contradiction. Hence $$k=1\implies f(1)=1$$. Hence $$f(2)=2$$, and a simple induction using $$(2)$$ shows that $$f(n)=n$$ for all $$n\in\mathbb{N^+}$$.

Assume $$0$$ is an element of $$\mathbb N$$. Set $$f(0) = N$$. Taking $$m=0$$ we see $$ff(n) = N + n$$ Now take $$n=0$$ in the original equation, we get a second identity $$f(m^2 + N) = f(m^2)$$

Apply $$f$$ to both sides to see (using first identity), $$m^2 + 2N = N + m^2$$ Taking $$m=0$$ implies $$N=0$$. So now we know $$ff(n) = n$$. This implies $$f$$ is bijective. Suppose $$f(M)=1$$. Then $$f(m^2 + 1) = f(m^2) + M$$ so we have $$f(0)=0\\ f(M) = 1\\ f(1) = M$$ Now $$f(2) = f(1^2+f(M))=f(1^2)+M = 2M$$, and therefore $$f(2) = 2M \\ f(2M)=2 \\$$ Now $$f(3)=f(1^2+f(2M))=f(1^2) + 2M = 3M$$, and therefore $$f(3)= 3M\\ f(3M)=3.$$ Inductively we obtain $$f(M)=M^2 \\ f(M^2)=M$$ so $$M$$ solves $$M^2=1$$ i.e. $$M=1$$, and $$f(n)=n$$ for all $$n$$.