## Task A-4.2.

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

$$
f(x+f(y))=f(f(y))+2 x f(y)+x^{2}
$$
## First solution.

By substituting $x=-f(y)$, we get: $f(0)=f(f(y))-(f(y))^{2}$. Here, we set $y=0$ and denote $a=f(0)$, thus we have $f(a)=a^{2}+a$. Let's return to the given equation and substitute $y=0$:

$$
f(x+a)=f(a)+2 x a+x^{2}=x^{2}+2 x a+a^{2}+a=(x+a)^{2}+a.
$$

We conclude that the only candidates for solutions are functions of the form $f(x)=x^{2}+a$, where $a$ is an arbitrary real constant. Upon verification, we see that these are indeed all the solutions to the problem.