## Task 1.

Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all real numbers $x$ and $y$,

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

If we substitute $x=y$ into the initial equation, we get

$$
0=f(0)(f(2 x)-1), \quad \forall x \in \mathbb{R}
$$

First case: $\quad f(0) \neq 0$

Then we have

$$
f(2 x)-1=0, \quad \forall x \in \mathbb{R} \quad \Rightarrow \quad f(x)=1, \quad \forall x \in \mathbb{R}
$$

By verification, we find that this function is indeed a solution to the initial functional equation.

Second case: $f(0)=0$

If we substitute $y=0$ into the initial equation, we get

$$
\begin{aligned}
f(f(x))-f(x) & =f(x)(f(x)-1), \quad \text{i.e.} \\
f(f(x)) & =f(x)^{2}, \quad \forall x \in \mathbb{R}
\end{aligned}
$$

By swapping $x$ and $y$, we get

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

Adding this to the initial equation gives

$$
0=(f(x+y)-1)(f(x-y)+f(y-x)), \quad \forall x, y \in \mathbb{R}
$$

If we substitute $y=-x$ into the above equation, we get

$$
0=(f(0)-1)(f(2 x)+f(-2 x)), \quad \forall x \in \mathbb{R}
$$

Since $f(0)=0$, it follows that

$$
f(2 x)=-f(-2 x) \quad \Rightarrow \quad f(x)=-f(-x), \quad \forall x \in \mathbb{R}
$$

This proves that the function is odd.

Now it follows that

$$
f(f(x)) \stackrel{(\star)}{=} f(x)^{2}=(-f(-x))^{2}=f(-x)^{2} \stackrel{(\star)}{=} f(f(-x))=f(-f(x))=-f(f(x))
$$

for every $x \in \mathbb{R}$

Finally, from (o) and ( $\star$ ) we get

$$
2 f(f(x))=0 \quad \Rightarrow \quad 2 f(x)^{2}=0 \quad \Rightarrow \quad f(x)=0, \quad \forall x \in \mathbb{R}
$$

It is easy to verify that this function is also a solution.