4. Let $\mathbb{R}^{+}$ be the set of all positive real numbers. Find all functions $f: \mathbb{R}^{+} \rightarrow \mathbb{R}^{+}$ such that

$$
f(x+f(y)+f(f(z)))=y f(1+f(f(y))(x+z)) \quad \text { for all } x, y, z \in \mathbb{R}^{+}
$$
4. If $f\left(y_{1}\right)=f\left(y_{2}\right)=c$, then for any $x$ and $z$ we have $y_{1}=$ $\frac{f(x+c+f(f(z)))}{f(1+f(c)(x+z))}=y_{2}$; from this we conclude that $f$ is "1-1". Now by substituting $y=z=1$ into the equality from the problem statement and using the injectivity of the function $f$, we get $x+f(1)+f(f(1))=1+f(f(1))(x+1)$, which simplifies to $x(1-f(f(1)))=$ $1-f(1)$, and this is possible for any $x \in \mathbb{R}^{+}$ only if $1-f(f(1))=0$, i.e., $f(f(1))=1$; then from the right side we get $f(1)=1$. Now substitute $x=y=1$ into the equality from the problem statement, which gives us (again using injectivity, as well as $f(1)=1) 1+1+f(f(z))=1+1+z$, from which it follows that $f(f(x))=x$ for any $x \in \mathbb{R}^{+}$. The given equation reduces to

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

Substitute $x+z=1$ into this expression, which gives us $f(1+f(y))=y f(1+y)$. By replacing $y$ with $f(x)$ in this equality, we get

$$
f(x) f(1+f(x))=f(1+f(f(x)))=f(1+x)=\frac{f(1+f(x))}{x}
$$

(where we have again used the previous equality at the end). From this we immediately get $f(x)=\frac{1}{x}$, and it is directly verified that this function indeed satisfies the conditions of the problem.

![](https://cdn.mathpix.com/cropped/2024_06_04_f254ba4f25ce7f8d9df1g-30.jpg?height=713&width=522&top_left_y=230&top_left_x=210)

Op 2017 4A 5