## Task 1.

Determine all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all real numbers $x, y$ the following holds

$$
f(x f(y)) = (1-y) f(x y) + x^2 y^2 f(y)
$$
## Solution.

Let $P(x, y)$ denote the substitution of values $x$ and $y$ into the initial equation. Then we have

$$
\begin{aligned}
& P(0,1): \quad f(0)=0 \\
& P(1,1): \quad f(f(1))=f(1) \\
& P(1, f(1)): \quad f(f(f(1)))=(1-f(1)) \cdot f(f(1))+f(1)^{2} \cdot f(f(1))
\end{aligned}
$$

From the second and third equations, we get

$$
f(1)=(1-f(1)) \cdot f(1)+f(1)^{3}, \quad \text { i.e., } \quad f(1)^{2}=f(1)^{3} \text {. }
$$

From here, we have two possibilities: $f(1)=1$ and $f(1)=0$.

If $f(1)=1$, we get

$$
P(x, 1): \quad f(x)=x^{2}
$$

so it should hold that $f(x)=x^{2}$ for every $x$. By direct substitution into the initial equation, we see that this is not possible, so we conclude that $f(1)=0$.

Now let $c$ be an arbitrary zero of the function $f$. We have

$$
P(x, c): \quad 0=(1-c) f(x c)
$$

Therefore, if $c \neq 1$, it also holds that $f(c x)=0$ for every $x \in \mathbb{R}$. If $c \neq 0$, this implies that $f(x)=0$ for every $x \in \mathbb{R}$. By direct verification, we confirm that $f \equiv 0$ is indeed one possible solution to the initial equation.

Now assume that $f$ is not identically zero. The above calculation shows that 0 and 1 are the only zeros of the function $f$. We then have

$$
P(1, y): \quad f(f(y))=(1-y) f(y)+y^{2} f(y)=\left(1-y+y^{2}\right) f(y)
$$

and for $x \neq 0$

$$
P\left(\frac{1}{x}, x\right): \quad f\left(\frac{f(x)}{x}\right)=f(x)
$$

since $f(1)=0$.

Now let $y_{1}, y_{2} \in \mathbb{R} \backslash\{0,1\}$ be such that $f\left(y_{1}\right)=f\left(y_{2}\right) \neq 0$. Then from (1) it easily follows that

$$
1-y_{1}+y_{1}^{2}=1-y_{2}+y_{2}^{2}, \quad \text { i.e., } \quad\left(y_{1}-y_{2}\right)\left(y_{1}+y_{2}-1\right)=0
$$

We conclude that

$$
f\left(y_{1}\right)=f\left(y_{2}\right) \Rightarrow y_{1}=y_{2} \text { or } y_{1}+y_{2}=1
$$

Combining relations (2) and (3), we get that for every $x \neq 0,1$ it holds that

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

i.e.,

$$
f(x)=x^{2} \text { or } f(x)=x-x^{2}
$$

Now let $x \in \mathbb{R}, x \notin\{0,1\}$ be such that $f(x)=x^{2}$. Substituting $y=x$ into (1), we get

$$
f\left(x^{2}\right)=\left(1-x+x^{2}\right) x^{2}
$$

We have two cases: $f\left(x^{2}\right)=x^{4}$ and $f\left(x^{2}\right)=x^{2}-x^{4}$. The first case gives $x^{4}=\left(1-x+x^{2}\right) x^{2}$, from which it easily follows that $x=0$ or $x=1$. Since we assumed $x \notin\{0,1\}$, this is not possible. The second case gives $x^{2}-x^{4}=\left(1-x+x^{2}\right) x^{2}$, from which it follows that $x=0$ or $x=\frac{1}{2}$. We discard the case $x=0$, and for $x=\frac{1}{2}$ we observe

$$
f\left(\frac{1}{2}\right)=\left(\frac{1}{2}\right)^{2}=\frac{1}{4}=\frac{1}{2}-\left(\frac{1}{2}\right)^{2}
$$

This shows that for all $x \neq 0,1$, $f(x)=x-x^{2}$. Since this formula also holds for $x=0,1$, we conclude that

$$
f(x)=x-x^{2}, \quad \forall x \in \mathbb{R}
$$

By direct substitution into the initial equation, we confirm that we have indeed found a solution. Therefore, the only solutions to the given equation are $f \equiv 0$ and $f(x)=x-x^{2}, \forall x \in \mathbb{R}$.