# Find all functions if $f(x^2)+f(xy)=f(x)f(y)+yf(x)+xf(x+y)$ for all $x,y\in\mathbb{R}$.

Let $\mathbb{R}$ denote the set of real numbers. Find all functions $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $$f(x^2)+f(xy)=f(x)f(y)+yf(x)+xf(x+y)$$ for all $x,y\in\mathbb{R}$.

If we put $x=0$ and mark $a=f(0)$ we get $$2a=af(y)+ya$$ so for $a\ne 0$ we get $f(y)=2-y$ for all $y$. Now say $a=0$, so $f(0)=0$. Leting $y=0$ we get $\boxed{f(x^2) = xf(x)}$. If we put this in starting equation we get $$xf(x) +f(xy)=f(x)f(y)+yf(x)+xf(x+y)\;\;\;\;(*)$$

From boxed equation we see that $f$ is odd:

$$-xf(-x) = f((-x)^2)= f(x^2)=xf(x) \implies f(-x)=-f(x)$$

Leting $y=-x$ in $(*)$ we get: $$xf(x)-f(x^2) =-f(x)^2-xf(x)\implies \underline{f(x^2)= f(x)^2}$$

Here I'm stuck, we have $xf(x)=f(x)^2$ but I can't divide with $f(x)$ since it might have walue $0$ at some $x$. What to do?

• $x f(x) = f(x)^2 \iff (x-f(x)) f(x) = 0 \iff f(x) = x \vee f(x) = 0$ – md2perpe Aug 24 '18 at 17:11
• From that what you wrote we can deduce that $f$ is for some $x$ equal $0$ and for othe to $x$ it self. What can I do with that. – Aqua Aug 24 '18 at 17:18
• I can show that $f(x)=0$ for all $x\in\mathbb{Q}$, but I don't know yet how to extend to $\mathbb{R}$. – Batominovski Aug 24 '18 at 17:20
• From $f(x)=x \vee f(x)=0$ we see that there is some set $N \subset \mathbb{R}$ such that $f(x) = 0$ when $x \in N$ and $f(x) = x$ when $x \not\in N.$ – md2perpe Aug 24 '18 at 17:22
• According to @Batominovski we have $\mathbb{Q} \subseteq N.$ – md2perpe Aug 24 '18 at 17:23

Let $P(x,y)$ be the assertion that $$f(x^2)+f(xy)=f(x)\,f(y)+y\,f(x)+x\,f(x+y)\,.$$ If $f(0)=0$, then we already know that $$f(x^2)=x\,f(x)=\big(f(x)\big)^2\text{ and }f(-x)=-f(x)$$ for all $x\in\mathbb{R}$.
The condition $P(x,x)$ implies that $$2\,x\,f(x)=f(x^2)+f(x^2)=\big(f(x)\big)^2+x\,f(x)+x\,f(2x)=2\,x\,f(x)+x\,f(2x)\,.$$ Thus, $x\,f(2x)=0$ for all $x\in\mathbb{R}$. That is, $$f(2x)=0\text{ for all }x\neq 0\,.$$ Since $f(0)=0$, we conclude that $$f(x)=0\text{ for all }x\in\mathbb{R}\,.$$
Thus, there are two possible solutions. First, as the OP has discovered, we have $f(x)=2-x$ for all $x\in\mathbb{R}$. Second, we have the trivial solution $f\equiv 0$.
• There are two possible values of $f(0)$: $f(0)=2$ and $f(0)=0$. The solution $f(x)=2-x$ corresponds to $f(0)=2$. In my answer, I only dealt with $f(0)=0$, since the OP has completed the case $f(0)=2$. The condition $f(x^2)=\big(f(x)\big)^2$ is only true under the assumption that $f(0)=0$. – Batominovski Aug 24 '18 at 17:47
$x f(x) = f(x)^2$ says either $f(x) = 0$ or $f(x) = x$. Now if $f(x)=x$ and $f(y)=y$, $f(x^2) = x f(x) = x^2$, and your equation says $$x^2 + f(xy) = 2 x y + x f(x+y)$$ But this does not work with any combination of $f(x+y)=0$ or $f(x+y)=x+y$ and $f(xy)=0$ or $f(x+y)=xy$ unless $x=0$ or $y=0$ or $x=y$ or $x=2y$. Ultimately the conclusion should be that $f(x)=0$.
• So you suposed that there are two values for $f$ that it takes it to it self and then proved that this is impossibile? – Aqua Aug 24 '18 at 17:28