1. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$,

$$
f(f(x y))=|x| f(y)+3 f(x y)
$$
1. If $x$ and $y$ are swapped, we get $f(f(x y)) = |y| f(x) + 3 f(x y)$, which by subtracting from the original equation gives $|x| f(y) = |y| f(x)$. For $y=1$, we have $f(x) = f(1) |x|$. Then for $x=y=1$ in the original equation, we get $f(f(1)) = 4 f(1)$, and since from the formula in the previous sentence it follows that $f(f(1)) = f(1) |f(1)|$, combining the last two equalities gives $f(1) |f(1)| = 4 f(1)$, i.e., $f(1) (|f(1)| - 4) = 0$. From this, it follows that $f(1) \in \{-4, 0, 4\}$, i.e., the candidates for solutions are the functions $f(x) \equiv 0$, $f(x) = 4|x|$, and $f(x) = -4|x|$. The first of these is clearly a solution, and we see that the second is also a solution because $|x| f(y) + 3 f(x y) = 4|x y| + 12|x y| = 16|x y| = f(f(x y))$, and similarly $f(x) = -4|x|$ is also a solution.