Problem (Algebra):
Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ with the property that

$$
f(x-f(y))=f(f(x))-f(y)-1
\tag{1}
$$

holds for all $x, y \in \mathbb{Z}$.

Solution:
It is immediately checked that both functions mentioned in the answer are as desired.

Now let $f$ denote any function satisfying (1) for all $x, y \in \mathbb{Z}$. Substituting $x=0$ and $y=f(0)$ into (1) we learn that the number $z=-f(f(0))$ satisfies $f(z)=-1$. So by plugging $y=z$ into (1) we deduce that

$$
f(x+1)=f(f(x))
\tag{2}
$$

holds for all $x \in \mathbb{Z}$. Thereby (1) simplifies to

$$
f(x-f(y))=f(x+1)-f(y)-1 .
\tag{3}
$$

We now work towards showing that $f$ is linear by contemplating the difference $f(x+1)-f(x)$ for any $x \in \mathbb{Z}$. By applying (3) with $y=x$ and (2) in this order, we obtain

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

Since (3) shows $f(x-1-f(x))=f(x)-f(x)-1=-1$, this simplifies to

$$
f(x+1)=f(x)+A
$$

where $A=f(-1)+1$ is some absolute constant.

Now a standard induction in both directions reveals that $f$ is indeed linear and that in fact we have $f(x)=A x+B$ for all $x \in \mathbb{Z}$, where $B=f(0)$. Substituting this into (2) we obtain that

$$
A x+(A+B)=A^{2} x+(A B+B)
$$

holds for all $x \in \mathbb{Z}$; applying this to $x=0$ and $x=1$ we infer $A+B=A B+B$ and $A^{2}=A$. The second equation leads to $A=0$ or $A=1$. In case $A=1$, the first equation gives $B=1$, meaning that $f$ has to be the successor function. If $A=0$, then $f$ is constant and (1) shows that its constant value has to be -1 . Thereby the solution is complete.

We commence by deriving (2) and (3) as in the first solution. Now provided that $f$ is injective, (2) tells us that $f$ is the successor function. Thus we may assume from now on that $f$ is not injective, i.e., that there are two integers $a>b$ with $f(a)=f(b)$. A straightforward induction using (2) in the induction step reveals that we have $f(a+n)=f(b+n)$ for all nonnegative integers $n$. Consequently, the sequence $\gamma_{n}=f(b+n)$ is periodic and thus in particular bounded, which means that the numbers

$$
\varphi=\min _{n \geqslant 0} \gamma_{n} \quad \text { and } \quad \psi=\max _{n \geqslant 0} \gamma_{n}
$$

exist.

Let us pick any integer $y$ with $f(y)=\varphi$ and then an integer $x \geqslant a$ with $f(x-f(y))=\varphi$. Due to the definition of $\varphi$ and (3) we have

$$
\varphi \leqslant f(x+1)=f(x-f(y))+f(y)+1=2 \varphi+1
$$

whence $\varphi \geqslant-1$. The same reasoning applied to $\psi$ yields $\psi \leqslant-1$. Since $\varphi \leqslant \psi$ holds trivially, it follows that $\varphi=\psi=-1$, or in other words that we have $f(t)=-1$ for all integers $t \geqslant a$.

Finally, if any integer $y$ is given, we may find an integer $x$ which is so large that $x+1 \geqslant a$ and $x-f(y) \geqslant a$ hold. Due to (3) and the result from the previous paragraph we get

$$
f(y)=f(x+1)-f(x-f(y))-1=(-1)-(-1)-1=-1 .
$$

Thereby the problem is solved.

Set $d=f(0)$. By plugging $x=f(y)$ into (1) we obtain

$$
f^{3}(y)=f(y)+d+1
\tag{4}
$$

for all $y \in \mathbb{Z}$, where the left-hand side abbreviates $f(f(f(y)))$. When we replace $x$ in (1) by $f(x)$ we obtain $f(f(x)-f(y))=f^{3}(x)-f(y)-1$ and as a consequence of (4) this simplifies to

$$
f(f(x)-f(y))=f(x)-f(y)+d
\tag{5}
$$

Now we consider the set

$$
E=\{f(x)-d \mid x \in \mathbb{Z}\}
\tag{6}
$$

Given two integers $a$ and $b$ from $E$, we may pick some integers $x$ and $y$ with $f(x)=a+d$ and $f(y)=b+d$; now (5) tells us that $f(a-b)=(a-b)+d$, which means that $a-b$ itself exemplifies $a-b \in E$. Thus,

$$
E \text { is closed under taking differences. }
$$

Also, the definitions of $d$ and $E$ yield $0 \in E$. If $E=\{0\}$, then $f$ is a constant function and (1) implies that the only value attained by $f$ is indeed -1 .

So let us henceforth suppose that $E$ contains some number besides zero. It is known that in this case (6) entails $E$ to be the set of all integer multiples of some positive integer $k$. Indeed, this holds for

$$
k=\min \{|x| \mid x \in E \text { and } x \neq 0\}
$$

as one may verify by an argument based on division with remainder.

Thus we have

$$
\{f(x) \mid x \in \mathbb{Z}\}=\{k \cdot t+d \mid t \in \mathbb{Z}\}
\tag{7}
$$

Due to (5) and (7) we get

$$
f(k \cdot t)=k \cdot t+d
$$



for all $t \in \mathbb{Z}$, whence in particular $f(k)=k+d$. So by comparing the results of substituting $y=0$ and $y=k$ into (1) we learn that

$$
f(z+k)=f(z)+k
\tag{8}
$$

holds for all integers $z$. In plain English, this means that on any residue class modulo $k$ the function $f$ is linear with slope 1 .

Now by (7) the set of all values attained by $f$ is such a residue class. Hence, there exists an absolute constant $c$ such that $f(f(x))=f(x)+c$ holds for all $x \in \mathbb{Z}$. Thereby (1) simplifies to

$$
f(x-f(y))=f(x)-f(y)+c-1 .
\tag{9}
$$

On the other hand, considering (1) modulo $k$ we obtain $d \equiv-1(\bmod k)$ because of $(7)$. So by (7) again, $f$ attains the value -1 .

Thus we may apply (9) to some integer $y$ with $f(y)=-1$, which gives $f(x+1)=f(x)+c$. So $f$ is a linear function with slope $c$. Hence, (8) leads to $c=1$, wherefore there is an absolute constant $d^{\prime}$ with $f(x)=x+d^{\prime}$ for all $x \in \mathbb{Z}$. Using this for $x=0$ we obtain $d^{\prime}=d$ and finally (4) discloses $d=1$, meaning that $f$ is indeed the successor function.

Final answer: $f(x)=-1$,$f(x)=x+1$