# Find functions $f:\mathbb{N}\rightarrow \mathbb{N}$ such that $f(m+n)=f(m)+f(n)+2mn$

Find functions $f:\mathbb{N}\rightarrow \mathbb{N}$ such that $f(m+n)=f(m)+f(n)+2mn$

Setting $m=n$ we see that: $$f(2n)=2f(n)+2n^2$$

Setting $m=1$:

$$f(n+1)=f(1)+f(n)+2n$$

Then, for example when $n=1$:

$$f(2)=f(1)+f(1)+2=2f(1)+2$$

And we can observe that $f(n)=n^2$ satisfies the equations, as:

$$f(m+n)=(m+n)^2=m^2+n^2+2mn=f(m)+f(n)+2mn$$

Then, if we assume that $f(n)=n^2+g(n)$, then we have:

$$f(m+n)=(m+n)^2+g(m+n)=m^2+g(m)+n^2+g(n)+2mn$$ and so:

$$g(m+n)=g(m)+g(n)$$ And that is Cauchy functional equation for natural numbers, so we see that we can only have $$g(n)=cn$$ for some $c$, so our solution would look like:

$$f(n)=n^2+cn$$

And in this case:

$$f(m+n)=(m+n)^2+c(m+n)$$ and $$f(m)+f(n)+2mn=m^2+cm+n^2+cn+2mn$$

so we see that $f(n)=n^2+cn$ is a solution. My question is:

is my solution correct? Does it suffice to do what I did to show that's the only one such function?

Hint Let $$g(n)=f(n)-n^2$$
Then $$g(m+n)=g(m)+g(n)$$
Then setting $g(1)=a$ what is $g(2), g(3),.., g(n)$?
• @AnneReve The solution is basically correct, but you need to also find the needed restrictions on c. The only comment is that I would refrain from using things like "If we assume that $f(n)=..$" because this can be missunderstood as the start of a proof by contradiction. Is better to say: define $g(n)=f(n)-n^2$, then $f(n)=..$ Mar 12 '17 at 15:09
• @AnneReve Also, keep in mind that you showed that there are infinitely many solutions. And not all $c$'s work, as some of them give you values outside $\mathbb N$. You need to also find which values of $c$ give you a function which takes only whole values. Mar 12 '17 at 15:10
Looks correct to me, wirh the addition of $f(1)$ being arbitrary and $f(n) = n^2+(f(1)-1)n$.