# Solving the functional equation $f(n^2+m)=f(n+m^2)$

I want to find all functions $f:\mathbb{Z}\rightarrow\mathbb{Z}$ such that for all integers $n,m\in\mathbb{Z}$,

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

Obviously, any constant function is a solution and probably there are not any further solutions (I am not completely sure about that though). Unfortunately, I do not know how to solve the above problem and would like to ask you to help me.

Obviously, the function has to be an even function (put e.g. $m=0$). I tried some more substitutions to obtain further information. E.g. putting $n=\pm 1$ gives $f(m^2-1)=f(m^2+1)$ for all $m\in\mathbb{Z}$. etc.

I would appreciate any help.

• I don't see how you get $f(m^2-1)=f(m^2+1)$. Is there a typo in the question or in this remark? Or am I just blind? – Arnaud Mortier Apr 3 '18 at 9:04
• @ArnaudMortier Set $n=1$ to get $f(1+m) = f(1+m^2)$; set $n=-1$ to get $f(1+m) = f(-1+m^2)$. Both are equal to $f(1+m)$. – Patrick Stevens Apr 3 '18 at 9:05
• @PatrickStevens Right! Thanks! – Arnaud Mortier Apr 3 '18 at 9:05
• Maybe you can do something in this line: Take $n, m_1, m_2$. with $m_1 +m_2 = 0$. Then $n+m_1^2=n+m_2^2$, but $n^2+m_1 \neq n^2+m_2$ $\forall m_1 \neq 0$. – Botond Apr 3 '18 at 9:08
• In fact $f(n^2+a)=f(n^2-a)$ for any $n$ and any $a$. – Arnaud Mortier Apr 3 '18 at 9:23

The answer is$$f(x) = \begin{cases} a; & x \text{ odd}\\ b; & x \text{ even} \end{cases},$$ where $a, b$ are constants.

First to verify that such $f$'s indeed satisfy the condition. For any $m, n \in \mathbb{Z}$, because $m^2 \equiv m \pmod{2}$ and $n^2 \equiv n \pmod{2}$, then either $m^2 + n$ and $m + n^2$ are both odd or both even. Thus either $f(m^2 + n) = a = f(m + n^2)$ or $f(m^2 + n) = b = f(m + n^2)$.

Next, suppose $f$ is any function satisfying the condition. For any $x \in \mathbb{Z}$, take $(m, n) = (x, 0)$, then $f(x) = f(x^2)$, which also implies $f(-x) = f(x^2) = f(x)$. Now take $(m, n) = (x - 1, 1)$, then $f(x) = f(x^2 - 2x + 2)$. Take $(m, n) = (-x + 1, 1)$, then $f(-x + 2) = f(x^2 - 2x + 2)$. Therefore,$$f(x) = f(-x + 2) = f(x - 2). \quad \forall x \in \mathbb{Z}$$

Another way to arrive at Alex Francisco's answer:

Write $n\equiv m$ if $f(n)=f(m)$ is a consequence of the problem's conditions.

Then one easily sees that $n^2-a\equiv n^2+a$ for any integers $n$ and $a$. In other words an integer and its symmetric about $n^2$ are always equivalent.

Now take any $n$ and perform the symmetry about $1=1^2$ followed by the symmetry about $0=0^2$. The result is $n-2$. Therefore $f(n)=f(n-2)$ for any integer $n$.