4. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ for which

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

holds for all real numbers $x$ and $y$.
IV/4. By substituting $x=0$ into the functional equation, we get $f(0)=f(y)+y f(0)$. Therefore, $f$ is a linear function of the form $f(x)=a-a x$ for some real number $a$. We substitute this form into the functional equation and get that for all $x, y \in \mathbb{R}$, it holds that $x+a-a x(a-a y)=a-a y+y(a-a x)$, thus

$$
x-a^{2} x+a^{2} x y=-a x y
$$

If we substitute $y=0$ into this equation, we get $x=a^{2} x$ for all $x$, hence $a^{2}=1$. Considering this in the above equation, it simplifies to $x y=-a x y$ or $(1+a) x y=0$, from which it follows that $a=-1$, since the equation must hold for all $x$ and $y$.

We get $f(x)=x-1$. If we substitute this form into both sides of the original equation, we get

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

and

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

which is equal for all $x$ and $y$, so $f(x)=x-1$ is the only function that satisfies the given equation.

Substituting $x=0$ or $y=0$ into the functional equation 1 point Substituting the form $f(x)=a-a x$ into the original equation for $x$ and $y$ (can also be written as $f(x)=f(0)-x f(0))$

1 point

Concluding that for all $x$ and $y$ the equation $x-a^{2} x+a^{2} x y=-a x y$ holds (or equivalently,

![](https://cdn.mathpix.com/cropped/2024_06_07_24964e3bc413fb5af60fg-17.jpg?height=48&width=1625&top_left_y=2346&top_left_x=221)

![](https://cdn.mathpix.com/cropped/2024_06_07_24964e3bc413fb5af60fg-17.jpg?height=49&width=1625&top_left_y=2391&top_left_x=221)

![](https://cdn.mathpix.com/cropped/2024_06_07_24964e3bc413fb5af60fg-17.jpg?height=46&width=1627&top_left_y=2444&top_left_x=223)

![](https://cdn.mathpix.com/cropped/2024_06_07_24964e3bc413fb5af60fg-17.jpg?height=51&width=1627&top_left_y=2490&top_left_x=223)

Concluding that $f(x)=x-1$ is the solution .......................................................................