Determine all functions $f: \mathbb{R} \longrightarrow \mathbb{R}$ such that for all $x$ and $y$:

$$
f\left(x^{2}-y^{2}\right)=(x-y)(f(x)+f(y))
$$
By taking $x=y=0$ we obtain $f(0)=0$. By taking $y=0$ we find $f\left(x^{2}\right)=x f(x)$. In particular, $-x f(-x)=x f(x)$ so $f(-1)=-f(1)$.

Moreover, by taking $y=1$ and $y=-1$ we get $(x-1)(f(x)+f(1))=f\left(x^{2}-1\right)=$ $(x+1)(f(x)-f(1))$, which can be rewritten as $2 x f(1)=2 f(x)$ so $f(x)=x f(1)$ and $f$ is linear.

Conversely, we easily verify that all linear functions are solutions.