Finding all real valued functions that satisfy $f(f(y) + xf(x)) = y + (f(x))^2$

I would like some help with finding all real valued functions that satisfy this equation:

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

I tried the usual substitutions like $x = y = 0$, but my experience with this kind of problem is very limited.

EDIT: I'm an idiot and copied the wrong right side. Updated it now.

• $f(x) = x$ is a solution, I think, but this was just by guessing. – flawr Sep 17 '14 at 18:19
• Are you using $f^2$ to mean $f\circ f$? – Robin Goodfellow Sep 17 '14 at 18:20
• Let us try $x=0$. then $f^2(y) = y + f^2(0)$. This suggest that $f(x) = x+c$ is a solution. For $y=0$ we then get $f(f(0) +xf(x)) = f^2(x) \implies f(c+x(x+c)) = x+2c \implies 2c+x(x+c) = x+2c \implies x(x+c)=x \implies x+c = 0 \text{ for } x \neq 0 \implies x=c$ which is a contradiction. So $c=0$ if $f$ has the form $f(x) = x+c$ – flawr Sep 17 '14 at 18:28
• If $f(x)=x$, then $f(f(y)+xf(x))=y+x^2=y+f^2(x)=y+x$. – Robin Goodfellow Sep 17 '14 at 18:30
• This is a BMO (Balkan Math Olympiad) problem. See here for a clear solution. – user26486 Sep 17 '14 at 19:27

$$f(f(y) + xf(x)) = y + f^2(x)$$ Let $x=0$, then : $$f(f(y))=y+f^2(0)$$ So as $y$ is one-one and onto and invertible, that said that $f$ is onto, so there's no harm supposing that $f(x)=0$ or $x=f^{-1}(0)$: $$f(f(y))=y\implies f(y)=f^{-1}y$$ Does that give you a hint[$f$ is a one-one onto invertible self-inverse function]. Try $f(x)=x$ or $f(x)=-x$.