<s>[INST] Find all $f : \mathbb R\to\mathbb R$ such that $f(f(x+y)) = f(x+y) + f(x)f(y) -xy$ Find all $f : \mathbb R\to\mathbb R$ such that
$$f(f(x+y)) = f(x+y) + f(x)f(y) -xy$$
for all reals $x,y.$ (Belarusian Mathematical Olympiad-1995)
My answer:
Consider $f(0) = c. ...(i)$
Let $x,y = 0$ at first.
$$f(f(x+y)) = f(x+y) + f(x)f(y) -xy$$
$$\implies f(f(0+0)) = f(0+0) + f(0)f(0) -0 \times 0$$
$$\implies f(f(0)) = f(0) + f(0)f(0) + 0$$
$$\implies f(c) = c + c \times c + 0$$
$$\implies f(c) = c + c^2$$
$$\implies f(c) - c = c^2 ...(ii)$$
Now, let $y = -x.$
Therefore,
$$f(f(x+y)) = f(x+y) + f(x)f(y) -xy$$
$$\implies f(f(x-x)) = f(x-x) + f(x)f(y) -(x\times -x)$$
$$\implies f(f(0)) = f(0) + f(x)f(-x) + x^2$$
$$\implies f(c) = c + f(x)f(-x) + x^2$$
$$\implies f(c)-c = f(x)f(-x) + x^2$$
From $..(ii),$
Therefore, $$c^2 = f(x)f(-x) + x^2$$
Now, let $x = c$
$$Therefore, c^2 = f(x)f(-x) + c^2$$
$$\implies c^2 - c^2 = f(c)f(-c)$$
$$\implies 0 = f(c)f(-c)$$
Hence,
$f(c) = 0 ...(iii)$
$f(-c) = 0 ...(iv)$
Multiplying $(i) and (iii),$
$$f(0) \times f(c) = c \times 0$$
$$\implies f(0) \times f(c) = 0$$
$$\implies f(0) = 0$$
$$\implies c = 0$$
Similarly, Multiplying $(i) and (iv)$
$\implies c = 0$
Hence $c = 0.$
But $f(c) = 0,$
Therefore, $f(c) = c$
I can't go further than that can anyone help me out.
 [/INST] $$f(f(x+y))=f(x+y)+f(x)f(y)-xy$$
As mentioned above, I have assumed $f(0)=c$ for some real $c$.

*

*$(x,y)\equiv(c,-c)$
$$f(c)=c+f(c)f(-c)+c^2$$

*$(x,y)\equiv(0,0)$
$$f(c)=c+c^2$$
The above equations imply that $f(c)f(-c)=0$. Hence, there exists some real $k$ such that $f(k)=0$.

*$(x,y)\equiv(k,0)$
$$f(f(k+0))=f(k+0)+f(k)f(0)-k\cdot0\implies c=0\implies f(0)=0 $$

*$(x,y)\equiv(x,0)$
$$f(f(x))=f(x)\implies f(f(x+y))=f(x+y)\implies f(x)=x\cdot \frac{y}{f(y)}$$
If $f(x)=0$ for all real $x$, we have, $xy=0$ for all reals,which is a contradiction. Hence there exists some real $p$ such that $f(p)=q$ and $q\ne 0$.

*$(x,y)\equiv(x,p)$
$$f(f(x+p))=f(x+p)\implies f\left((x+p)\cdot\frac{p}{q}\right)=(x+p)\cdot\frac{p}{q} \implies p=q$$
Therefore, $\boxed{f(x)=x}$ for all real $x$. Substitute this back into the original F.E to verify the result.

</s>