Functions satisfying $f(m+f(n)) = f(m) + n$

Plugging in $n=0$, we get that $$f(m+f(0))=f(m)\tag{1}$$ must hold for all $m\in\mathbb Z$. There are now two possibilities.

Case 1. $f(0)\neq 0$.

In this case, the equation $(1)$ tells us that $f$ is a periodic function. But this would necessarily imply that $f$ is bounded (since it would have to take only finitely many values), i.e. there exists a positive integer $M$ such that $-M\leq f(x)\leq M$ holds for all $x\in\mathbb Z$. But this is impossible: plugging in $n = 2M+1$ into the equation would then yield $$2M\geq f(m+f(2M+1))-f(m)=2M+1$$ which is absurd; therefore this case does not occur.

Case 2. $f(0) = 0$.

In this case, plug $m=0$ into the original equation. This tells us that $$f(f(n))=n\tag{2}$$ must hold for all $n\in\mathbb Z$. Plugging in $f(n)$ instead of $n$ into the original equation and using $(2)$ then tells us that $$f(m+n)=f(m)+f(n)$$ holds for all $m,n\in\mathbb Z$. Using the usual argument, this implies that $f$ is of the form $f(x) = c x$ for some constant $c$. By $(2)$, this constant is either $1$ or $-1$. Both choices satisfy the original equation.

Conclusion. The solutions to the equation are given precisely by $f(x)=x$ and $f(x) =-x$.


Clearly, $f(n) = \pm n$ is a solution. Now let us see if there are other solutions. Plug in $n=0$. We then have $$f(m+f(0)) = f(m)$$ If $f(0) \neq 0$, we then have $f$ to be periodic with period $f(0)$. This means $f(n)$ an take only finitely many values. Plugging $m=0$, we get that $$f(f(n)) = n + f(0)$$ which takes infinitely many values contradicting the previous fact. Hence, $f(0) = 0$. Now plug in $m=0$ to get $$f(f(n)) = n$$ Hence, we have $$f(m+n) = f(m+f(f(n))) = f(m) + f(n)$$ This means $$f(m) = \text{constant} \times m = km$$ This means $$f(m+f(n)) = f(m) + n \implies f(m+kn) = km+n \implies km + k^2n = km +n \implies k^2n = n$$ Since this is true for all $n$, we have $k^2=1$. Hence, $k = \pm 1$. Hence, the only solutions are $$f(n) = \pm n$$