Q:

Find all functoins $f: \mathbb R \rightarrow \mathbb R$ such that $\forall x,y \in \mathbb R f(xy+f(x))=xf(y)+f(x)$

Find all functoins $f: \mathbb R \rightarrow \mathbb R$ such that $\forall x,y \in \mathbb R$ the equality::
$$f(xy+f(x))=xf(y)+f(x)$$
My work so far:
1) $f(0)=0$;
Let $f(a)=f(b)\not=0$
$x=a, y=b \Rightarrow f(ab+f(a))=af(b)+f(a)$;
$x=b, y=a \Rightarrow f(ba+f(b))=bf(a)+f(b)$;
Then $af(b)+f(a)=bf(a)+f(b) \Rightarrow a=b$
$x=0: f(f(0))=f(0) \Rightarrow f(0)=0$
2) $f(x)=x -$ solution. I have tried to prove that $g(x)=f(x)-x = 0 (\forall x \in \mathbb R)$
$$g(xy+x+g(x))=xg(y)$$

A:

So we have $f(0)=0$ and using this fact it is easy to prove that $f(f(x))=f(x)$ for any $x$, which means that at any point $x$, $f(x)=x$ or $f(x)=0$. Now suppose that at some point $a\ne0$ $f(a)\ne0$, this means that $f(a)=a$ and we have $$
f(ay+f(a))=af(y)+f(a)=>f(ay+a)=af(y)+a.
$$
This means that either $f(ay+a)=ay+a$ or $f(ay+a)=a$. The only case when $f(ay+a)=a$ is when $ay+a=a=>y=0$. This means that $f(x)=x$. So there two functions that satisfy above functional equality: $f(x)=0$ and $f(x)=x$.

