## Task 1.

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

$$
f\left(x^{2}\right)+x f(y)=f(x) f(x+f(y)) .
$$
## Solution.

By substituting $x=0$ into the given equation, we get $f(0)=f(0) f(f(y))$, so

$$
f(0)[f(f(y))-1]=0, \quad \forall y \in \mathbb{R}
$$

If $f(f(y))=1, \forall y \in \mathbb{R}$, then $f(f(0))=1$ and $f(1)=f(f(f(0)))=1$. By substituting $x=y=1$ into the given equation, we get $f(1)+f(1)=f(1) f(1+f(1))$, which implies $f(2)=2$. However, $1=f(f(2))=f(2)=2$, which is a contradiction.

Therefore, $f(0)=0$ and by substituting $y=0$ into the given equation, we get

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

From the previous equation, we have $f\left(1^{2}\right)=f(1)^{2}$, so $f(1)=0$ or $f(1)=1$.

1. If $f(1)=0$, by substituting $x=1$ into the given equation, we get $0+f(y)=0$, i.e., $f(x)=0, \forall x \in \mathbb{R}$, which is a solution.
2. If $f(1)=1$, by substituting $x=1$ into the given equation, we get $1+f(y)=f(1+f(y))$, i.e.,

$$
f(f(x)+1)=f(x)+1, \quad \forall x \in \mathbb{R}
$$

By substituting $y=1$ into the given equation, together with equation (9), we get

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

which implies $f(x)=0 \Longrightarrow x=0$, i.e., $f(x) \neq 0, \forall x \in \mathbb{R} \backslash\{0\}$.

Furthermore, by substituting $y=x$ into the given equation and using (9), we get $f(x)^{2}+x f(x)=$ $f(x) f(x+f(x)), \forall x \in \mathbb{R}$. If $x \neq 0$, then $f(f(x)+x)=f(x)+x$. This also holds for $x=0$. Therefore,

$$
f(f(x)+x)=f(x)+x, \quad \forall x \in \mathbb{R}
$$

By substituting $y=x-1$ into the given equation, together with equation (9), we get

$$
\begin{aligned}
f(x)^{2}+x f(x-1) & =f(x) f(x+f(x-1)) \\
& =f(x) f(f(x-1)+(x-1)+1) \\
& \stackrel{(12)}{=} f(x) f(f(f(x-1)+(x-1))+1) \\
& \stackrel{(10)}{=} f(x)[f(f(x-1)+(x-1))+1] \\
& =f(x) f(f(x-1)+(x-1))+f(x) \\
& \stackrel{(12)}{=} f(x)[f(x-1)+(x-1)]+f(x) \\
& =f(x) f(x-1)+x f(x)
\end{aligned}
$$

which implies $[f(x)-x][f(x)-f(x-1)]=0, \forall x \in \mathbb{R}$.

If there exists $x_{0} \in \mathbb{R}$ such that $f\left(x_{0}\right)=f\left(x_{0}-1\right)$, then by substituting $x=x_{0}-1$ into (11), we get $f\left(x_{0}-1\right)^{2}+x_{0}-1=f\left(x_{0}-1\right) f\left(x_{0}\right)$ and thus $x_{0}=1$. However, we know that $f\left(x_{0}\right)=f(1)=1 \neq 0=f(0)=f\left(x_{0}-1\right)$, so the assumption is incorrect. Therefore, $f(x)=x, \forall x \in \mathbb{R}$, which is the second solution to the given equation.

Finally, $f(x)=0$ and $f(x)=x$ are the only two functions that satisfy the given conditions.