3. Find all functions $f: \mathbf{R} \rightarrow \mathbf{R}$ such that for all $x, y \in \mathbf{R}$, we have
$$
f(x f(y)) + x = x y + f(x).
$$
(2014, Singapore Mathematical Olympiad)
Let $x=1$, we get $f(f(y)+1)=y+f(1)$.
Thus, $f$ is bijective.
Let $y=0$, by the injectivity of $f$, we know $f(0)=0$.
When $x \neq 0$, let $y=-\frac{f(x)}{x}$, we get $f(x)=-c x$.
Therefore, the function $f(x)=x$ or $f(x)=-x$.