6. find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ so that the following equation is satisfied for all real $x, y$:

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

## 1st solution
We set $a=f(0)$. With $x=y$ follows

$$
f(f(x))=x+\frac{a}{2}
$$

If this is inserted on the left-hand side of the equation and simplified, the following results

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

i.e. $f(z)=z+a$ for all real $z$. Inserting it into the original equation shows that $a=0$, so the only solution to the equation is the identity $f(x)=x$.

## 2nd solution

If you set $x=0$ in (3), you get $f(a)=\frac{3 a}{2}$. It also follows immediately from (3) that $f$ is surjective. We can therefore choose a $c$ with $f(c)=0$. If we now put $x=c$ and $y=0$ into the original equation, then the following follows with the already shown

$$
\frac{5 a}{2}=a+f(a)=0
$$

thus $a=0$ and therefore $f(0)=0$. Finally, if $y=0$ is inserted into the original equation, the result is $f(f(x))=f(x)$ and because of the surjectivity of $f$, $f(x)=x$ must therefore be the identity.

## 3rd solution

From (3) it follows that $f\left(f\left(\frac{a}{2}\right)\right)=a$, and also that $f$ is injective. Now put $y=\frac{a}{2}$ into the original equation, then follows

$$
f(f(x))=f\left(x-\frac{a}{2}\right)
$$

so $f(x)=x-\frac{a}{2}$ for all $x$ because of injectivity. Insert shows $a=0$.