Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that

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

for all $x, y \in \mathbb{R}$.

Origin. Netherlands (Birgit van Dalen).
Setting \( y=0 \) yields

\[
f(f(x))=4 x
\]

from which we derive that \( f \) is a bijective function. Also, we find that

\[
f(0)=f(4 \cdot 0)=f(f(f(0)))=4 f(0)
\]

hence \( f(0)=0 \). Now set \( x=0 \) and \( y=1 \) in the given equation and use (1) again:

\[
4=f(f(1))=2 f(1)
\]

so \( f(1)=2 \) and therefore also \( f(2)=f(f(1))=4 \). Finally substitute \( y=1-x \) in the equation:

\[
f(2(1-x)+f(x))=4 x+4(1-x)=4=f(2) \quad \text{for all } x \in \mathbb{R}
\]

As \( f \) is injective, from this it follows that \( f(x)=2-2(1-x)=2 x \). It is easy to see that this function satisfies the original equation. Hence the only solution is the function defined by \( f(x)=2 x \) for all \( x \in \mathbb{R} \).