Find all $f$ that satisfies $f:\mathbb{R}\rightarrow\mathbb{R};f(x+y)+f(x)f(y)=(1+x)f(y)+(1+y)f(x)+f(xy)$ Find all $f$ that satisfies:
$1, ~f:\mathbb{R}\rightarrow\mathbb{R};\\
2,\forall x,y\in\mathbb{R},f(x+y)+f(x)f(y)=(1+x)f(y)+(1+y)f(x)+f(xy);
$
Maybe we can prove it's derivable or it's a linear function.
Any idea?
 A: The only solutions are $f(x)=0$, $f(x)=3x$, and $f(x)=x(x+1)$.  It is easy to verify these all work; let me now prove there are no other solutions.
First note that setting $y=0$ gives $$f(x)f(0)=(2+x)f(0).$$  So either $f(0)=0$ or $f(x)=2+x$ for all $x$. Since $f(x)=2+x$ does not satisfy the functional equation, we have $f(0)=0$.
Now let $c=f(1)$.  Setting $y=1$, we get $$f(x+1)=(3-c)f(x)+c(x+1).$$  If $c=3$, this tells us $f(x)=3x$ for all $x\in\mathbb{R}$.
Now suppose $c\neq 3$.  The solutions $f(x)=0$ and $f(x)=x(x+1)$ correspond to $c=0$ and $c=2$, so let us first show these are the only possible values of $c$.
Setting $x=-1$ in the recurrence above, we get $$0=(3-c)f(-1)$$ and so $f(-1)=0$ since $c\neq 3$.  Setting $y=-1$ in the original equation then gives $$f(x-1)=f(-x).$$  Setting $x=2$ gives $f(-2)=f(1)=c$.  But evaluating $f(-2)$ using the recurrence, we get $$f(-2)=\frac{c}{3-c}.$$  Thus $$c=\frac{c}{3-c}$$ which implies $c=0$ or $c=2$.
Now suppose $c=0$.  In that case, our recurrence is $f(x+1)=3f(x)$.  We also have $f(-x)=f(x-1)=f(x)/3$.  But then $f(x)=f(-(-x))=f(x)/9$, so $f(x)=0$ for all $x$.
This leaves the case $c=2$.  In this case, the recurrence is $f(x+1)=f(x)+2x+2$.  We also then have $f(-x)=f(x-1)=f(x)-2x$.  Applying the original equation with $y=2$, using $f(x+2)=f((x+1)+1)=f(x)+4x+6$ and $f(2)=6$, gives $$f(2x)=4f(x)-2x.$$  Applying the original equation with $y=x$ then gives $$f(x^2)=f(2x)+f(x)^2-2(1+x)f(x)=f(x)^2-2xf(x)+2f(x)-2x.$$ On the other hand, applying the original equation with $y=-x$ gives $$f(x)f(-x)=(1+x)f(-x)+(1-x)f(-x)+f(-x^2).$$  Substituting $f(-x)=f(x)-2x$ and $f(-x^2)=f(x^2)-2x^2$ and solving for $f(x^2)$ gives $$f(x^2)=f(x)^2-2xf(x)-2f(x)+4x^2+2x.$$ Comparing our two equations for $f(x^2)$, we see that $4f(x)=4x^2+4x$ and so $f(x)=x(x+1)$ for all $x$.
A: Let $x=y=0$.
Then $f(0)^2-2f(0)=0.$
Now, let $f(0)=2$.
After substitution $y=0$ in the given equality we obtain:
$$f(0)(f(x)-x-2)=0$$ for all real $x$, which gives 
$$f(x)=x+2.$$
Now, let $x=y=1$.
We obtain $f(2)=5f(1)-f(1)^2$ or
$$4=15-9,$$ which is wrong.
Thus, $f(0)=0$ only.
