Find all functions $f$ such that $(x+y)f(x)+f(y^2)=(x+y)f(y)+f(x^2)$

Put $y = 1$

$$ (x+1)f(x) + f(1) = (x+1)f(1) + f(x^2)$$

Put $y = 0$

$$ xf(x) + f(0) = xf(0) + f(x^2)$$

and subtract latter from former, we get

$$f(x) + f(1) - f(0) = x(f(1) - f(0)) + f(1)$$

and so

$$f(x) = x(f(1) - f(0)) + f(0)$$

Since any $f(x) = ax+b$ is a solution, you are done.


Partial solution:

  1. Let $y=0, x=c(\neq 0)$: $cf(c)+f(0)=cf(0)+f(c^2)$

  2. Let $y=0, x=-c$: $-cf(-c)+f(0)=-cf(0)+f(c^2)$.

Subtracting, we get $c(f(c)+f(-c))=c(2f(0))$, so $f(c)+f(-c)=2f(0)$ for all nonzero $c$.


More partial solution:
Rewrite as $f(x^2)-f(y^2)=(x+y)(f(x)-f(y))$, then divide both sides by $x^2-y^2$ to get $$\frac{f(x^2)-f(y^2)}{x^2-y^2}=\frac{f(x)-f(y)}{x-y}$$

If we knew that $f$ was continuous, then taking limits as $y\rightarrow x$ we find that $f'(x)=f'(x^2)$.