4. Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that for all integers $x$, $y$ the following holds:

$$
f(f(x)+y)=x+f(y+2006) .
$$
SOLUTION. Let $f$ be any function with the required properties. By substituting $y=0$ and $y=1$ into the given relation, we obtain the equalities

$$
f(f(x))=x+f(2006), \quad \text { resp. } \quad f(f(x)+1)=x+f(2007)
$$

and by subtracting them,

$$
f(f(x)+1)-f(f(x))=f(2007)-f(2006) .
$$

The last relation can be simplified to

$$
f(z+1)-f(z)=f(2007)-f(2006)
$$

for any $z \in \mathbb{Z}$ that belongs to the range of the function $f$. However, the range of $f$ is the entire set $\mathbb{Z}$, as we can see from either of the equalities (1).

The equality (2) valid for any $z \in \mathbb{Z}$ means that the function $f$ on $\mathbb{Z}$ is a (bi-infinite) arithmetic sequence, so its formula must be of the form $f(z)=a z+b$ with suitable constants $a, b \in \mathbb{R}$. We can determine their possible values by substituting into both sides of the equality from the problem statement:

$$
\begin{aligned}
f(f(x)+y) & =a(f(x)+y)+b=a^{2} x+a y+a b+b, \\
x+f(y+2006) & =x+a(y+2006)+b=x+a y+2006 a+b .
\end{aligned}
$$

Such two expressions have the same value for all $x, y \in \mathbb{Z}$ if and only if $a^{2}=1$ and $2006 a=a b$, i.e., $a= \pm 1$ and $b=2006$. The solutions to the problem are thus the only two functions given by the formulas

$$
f_{1}(x)=x+2006 \text { and } f_{2}(x)=-x+2006 \text {. }
$$

## GUIDING AND SUPPLEMENTARY PROBLEMS: