## Task 1.

Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that for all $a, b \in \mathbb{Z}$, the following holds:

$$
f(f(a)+f(b))=a+b-1
$$
## Solution.

If we substitute $b=1$ into the given equation, we get

$$
f(f(a)+f(1))=a
$$

for every integer $a$.

Let $n$ be any integer. Now substitute $a=f(n)+f(1)$ and $b=2 f(1)$. Then $f(a)=n$ and $f(b)=1$, so we have:

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

By induction, it is easy to prove that for every integer $n$,

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

where we denote $c=f(1)$.

Then $f(0)=-2 c+1$, and substituting $a=0$ and $b=1$ into the initial expression, we get:

$$
\begin{aligned}
f(f(0)+f(1)) & =0 \\
f(-c+1) & =0 \\
{[3(-c+1)-2] c-(-c+1)+1 } & =0 \\
c(-3 c+2) & =0
\end{aligned}
$$

Given that $c \in \mathbb{Z}$, we conclude that $c=0$. Therefore, the only solution to the given equation is $f(n)=-n+1$. Direct substitution verifies that this function indeed satisfies the given equation.