4. Find all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that for $m, n \in \mathbb{N}$ and $m>n$ we have

$$
f(f(m+n)+f(m-n))=8 m
$$
Solution. If we set $k=m+n, l=m-n$, we get $f(f(k)+f(l))=4(k+l)$. We will prove that $f$ is an injection. Let $f(k)=f(l)$. Then

$$
4(k+l)=f(f(k)+f(l))=f(f(k)+f(k))=8 k
$$

so $k=l$.

On the other hand,

$$
f(f(k)+f(k))=4 \cdot 2 k=4((k-1)+(k+1))=f(f(k-1)+f(k+1))
$$

Since $f$ is an injection, it follows that $f(k)+f(k)=f(k+1)+f(k-1)$, or

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

For $k=2$ we have

$$
f(3)=2 f(2)-f(1)=2(f(2)-f(1))+f(1),
$$

and for $k=3$ we have

$$
f(4)=2 f(3)-f(2)=3(f(2)-f(1))+f(1)
$$

By induction, it is proven that

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

or

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

Thus, $f(n)=a n+b$, where $a, b \in \mathbb{Z}(a=f(2)-f(1), b=2 f(1)-f(2)$.

Substituting the last expression into the initial one, we get:

$$
\begin{aligned}
f(a(m+n)+b+a(m-n)+b) & =8 m \Leftrightarrow f(2 a m+2 b)=8 m \Leftrightarrow a(2 a m+2 b)+b=8 m \\
& \Leftrightarrow 2 a^{2} m+2 a b+b=8 m
\end{aligned}
$$

Since the last equality holds for every $m \in \mathbb{N}$, we get that

$$
a^{2}=4, b(2 a+1)=0
$$

or $a= \pm 2, b=0$.

For $a=-2$, we get $f(n)=-2 n$, but this is not a mapping from $\mathbb{N}$ to $\mathbb{N}$. Therefore, $f(n)=2 n$ is the only solution to the given equation.